From b4b0dcb09b3c78cd5726477d5f83f71971b45d71 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 Sep 2010 00:01:35 +0200 Subject: fixes to definition list. minor cleanup. --- rst_parser.lua | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'rst_parser.lua') diff --git a/rst_parser.lua b/rst_parser.lua index 5795ebd..a88a263 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -188,18 +188,10 @@ local parser = P{ document = Cs(V"block"^1), - --block = (V"spacing" + V"paragraph")^1, - --block = (Cs(V"paragraph") / rst.escape - --+ V"target_block")^1, - -------------------------------------------------------------------------------- -- Blocks -------------------------------------------------------------------------------- - --block = V"target_block" - --+ Cs(V"section"^0 * V"paragraph") / rst.escape - --+ V"comment", - block = V"target_block" + Cs(V"section") / rst.escape + Cs(V"transition") --/ rst.escape @@ -222,15 +214,15 @@ local parser = P{ -------------------------------------------------------------------------------- definition_list = Cs(V"definition_item" - * (V"blank_line" * V"definition_item")^0) - * V"eol" + * (V"blank_line" * V"definition_item")^0) + * V"blank_line" / rst.deflist , definition_item = Cs(V"definition_term" - * V"definition_classifiers" - * V"eol" - * V"definition_def") + * V"definition_classifiers" + * V"eol" + * V"definition_def") / rst.deflist_item, definition_term = Cs((1 - V"eol" - V"definition_classifier_separator")^1) @@ -258,14 +250,11 @@ local parser = P{ * (V"definition_parline" - V"blank_line")^0) / rst.paragraph, - definition_par = V"blank_line"^0 - * Cs((V"definition_parline" - - V"blank_line")^1) - / rst.paragraph, - --* V"eol"^1), + definition_par = V"blank_line" + * Cs((V"definition_parline" - V"blank_line")^1) + / rst.paragraph, definition_parinit = V"definition_indent" - --* (R"az" + R"AZ" + S",.")^1 --testing * (1 - V"eol")^1 * V"eol" , @@ -585,7 +574,6 @@ local parser = P{ -------------------------------------------------------------------------------- word = (1 - V"endpar" - V"spacing" - V"eol")^1, -- TODO : no punctuation (later) - --word = (1 - V"endpar" - V"spacing" - V"eol" - V"punctuation")^1 * V"spacing" - V"eol", asterisk = P"*", double_asterisk = V"asterisk" * V"asterisk", @@ -620,16 +608,13 @@ local parser = P{ space = P" ", spaces = V"space"^1, whitespace = (P" " + Cs(P"\t") / " " + Cs(S"\v") / " "), - --whitespace = (P" " + Cs(P"\t") / " " + Cs(S"\v\n") / " ") - V"endpar", spacing = V"whitespace"^1, - --blank_line = V"eol" + V"space"^0 * V"eol", blank_line = V"space"^0 * V"eol", eol = P"\n", eof = V"eol"^0 * -P(1), - --endpar = V"eol" * (V"eol"^1 + V"eof"), - endpar = V"eol" * V"blank_line"^1, + endpar = V"eol" * (V"blank_line"^1 + V"eof"), delimiters = P"‐" + P"‑" + P"‒" + P"–" + P"—" + V"space", -- cgit v1.2.3