From c45e21547a2a471ab2147494f505001269374480 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 16 Sep 2010 19:57:49 +0200 Subject: fixed grouped single-line comments --- rst_context.lua | 3 ++- rst_parser.lua | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rst_context.lua b/rst_context.lua index 3107a29..00b93f5 100644 --- a/rst_context.lua +++ b/rst_context.lua @@ -96,7 +96,7 @@ do local w = S" \v\t\n" / "_" local wp = Cs((w + 1)^1) function rst_context.whitespace_to_underscore(str) - return wp:match(str) + return str and wp:match(str) or "" end end @@ -477,6 +477,7 @@ function rst_context.paragraph (data) else str = data end + print(str) return string.format([[ \\startparagraph diff --git a/rst_parser.lua b/rst_parser.lua index f5e3f28..f09e959 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -1055,16 +1055,17 @@ local parser = P{ -- Comments -------------------------------------------------------------------------------- - comment = V"double_dot" * V"whitespace"^0 + --comment_block = V"comment" * (V"blank_line"^-1 * V"comment")^0, + comment = (V"double_dot" * V"whitespace"^0) / "" * ((V"block_comment" + V"line_comment") - V"footnote_marker" - V"bar") , block_comment = V"eol" * Cs(V"indented_lines") - * V"eol"^0 + * V"end_block" / rst.block_comment, - line_comment = Cs((1 - V"eol")^0 * V"eol") + line_comment = Cs((1 - V"eol")^0 * V"eol") * V"end_block"^-1 / rst.line_comment, -------------------------------------------------------------------------------- -- cgit v1.2.3