summaryrefslogtreecommitdiff
path: root/rst_parser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rst_parser.lua')
-rw-r--r--rst_parser.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/rst_parser.lua b/rst_parser.lua
index 26636a1..01cd42d 100644
--- a/rst_parser.lua
+++ b/rst_parser.lua
@@ -331,7 +331,6 @@ local parser = P{
while n < #tcb.slices do
local from = tcb.slices[n] .stop
local to = tcb.slices[n+1].start
- --print(n, from, to, content)
local between = spaces_only:match(content, from)
if not between then -- Cell spanning more than one row.
-- pass
@@ -590,10 +589,10 @@ local parser = P{
literal_block = V"literal_block_marker"
* Cs(V"literal_block_lines"
* (V"blank_line"^1 * V"literal_block_lines")^0)
- * V"blank_line"^0
+ * V"end_block"
/ rst.literal_block,
- literal_block_marker = V"double_colon" * V"eol" * V"blank_line",
+ literal_block_marker = V"double_colon" * V"whitespace"^0 * V"eol" * V"blank_line",
literal_block_lines = V"unquoted_literal_block_lines"
+ V"quoted_literal_block_lines",
@@ -608,12 +607,17 @@ local parser = P{
literal_block_first = Cmt(V"space"^1, function (s, i, indent)
warn("lbk-f", #indent, "", "", i)
- if not indent or
+ if not indent or
indent == "" then
return false
end
- state.currentindent = indent
- return true
+ if state.currentindent and #state.currentindent < #indent then
+ state.currentindent = state.currentindent .. " "
+ return true
+ else
+ state.currentindent = " "
+ return true
+ end
end)
* V"rest_of_line"
* V"eol",
@@ -957,14 +961,17 @@ local parser = P{
section_before = C(Cmt(V"section_adorn", function(s,i, adorn)
state.previousadorn = adorn
warn ("sec-f", state.valid_adornment:match(adorn), adorn:sub(1,2) .. "...", "", i)
- return state.valid_adornment:match(adorn)
+ if state.valid_adornment:match(adorn) then
+ return true
+ end
+ return false
end))
* V"whitespace"^0
* V"eol"
* V"whitespace"^0
,
- section_text = C((1 - V"space" - V"eol")^1) * V"eol",
+ section_text = C((1 - V"space" - V"eol") * (1 - V"eol")^1) * V"eol",
section_after = C(Cmt(V"section_adorn", function(s,i, adorn)
local tests = false