summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rst_context.lua2
-rw-r--r--rst_parser.lua33
2 files changed, 10 insertions, 25 deletions
diff --git a/rst_context.lua b/rst_context.lua
index e6c20ee..5ca5573 100644
--- a/rst_context.lua
+++ b/rst_context.lua
@@ -293,7 +293,7 @@ function rst_context.deflist (str)
end
function rst_context.deflist_item (str)
- return [[\\definitionitem{%]] .. str .. [[}]]
+ return [[\\definitionitem{%]] .. str .. [[}% end definition item]]
end
function rst_context.deflist_classifier (str)
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",