summaryrefslogtreecommitdiff
path: root/rst_parser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rst_parser.lua')
-rw-r--r--rst_parser.lua31
1 files changed, 15 insertions, 16 deletions
diff --git a/rst_parser.lua b/rst_parser.lua
index 46142ba..f5e3f28 100644
--- a/rst_parser.lua
+++ b/rst_parser.lua
@@ -988,18 +988,12 @@ local parser = P{
-- Paragraphs * Inline Markup
--------------------------------------------------------------------------------
- --paragraph = V"par_setindent"
- --* Ct(C((1 - V"eol")^1) * V"eol"
- --* (V"par_matchindent" * C((1 - V"eol")^1) * V"eol")^0)
- --* V"end_block"
- --/ rst.paragraph,
-
paragraph = Ct(V"par_first"
* V"par_other"^0)
* V"end_block"
/ rst.paragraph,
- par_first = V"par_setindent" * C((1 - V"eol")^1) * V"eol",
+ par_first = V"par_setindent" * C((1 - V"literal_block_shorthand" - V"eol")^1) * V"eol",
par_other = V"par_matchindent"
* C((1 - V"literal_block_shorthand" - V"eol")^1)
@@ -1034,20 +1028,25 @@ local parser = P{
end)
,
- --literal_block_shorthand = ((V"colon" * V"space"^1)^-1
- --* V"double_colon") / ":"
- --* (V"eol" * V"blank_line" / "")
- --,
-
- literal_block_shorthand = (((V"double_colon" * V"space"^0)
- + (V"colon" * V"space"^1 * V"double_colon"))
+ literal_block_shorthand = Cs(((V"colon" * V"space" * V"double_colon")
+ + V"double_colon")
+ * V"whitespace"^0
* V"eol"
- * V"blank_line" / ":")
+ * V"blank_line")
+ -- The \unskip is necessary because the lines of a
+ -- paragraph get concatenated from a table with a
+ -- space as separator. And the literal block is
+ -- treated as one such line, hence it would be
+ -- preceded by a space. As the ":" character
+ -- always follows a non-space this should be a
+ -- safe, albeit unpleasant, hack. If you don't
+ -- agree then file a bug report and I'll look into
+ -- it.
+ / "\\\\unskip:"
,
literal_block_markerless = Cs(V"literal_block_lines"
* (V"blank_line"^1 * V"literal_block_lines")^0)
- --* V"end_block"
* V"blank_line"
/ rst.included_literal_block
,