summaryrefslogtreecommitdiff
path: root/rst_parser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rst_parser.lua')
-rw-r--r--rst_parser.lua30
1 files changed, 19 insertions, 11 deletions
diff --git a/rst_parser.lua b/rst_parser.lua
index 01cd42d..cd44f51 100644
--- a/rst_parser.lua
+++ b/rst_parser.lua
@@ -826,7 +826,9 @@ local parser = P{
--bullet_stop = V"blank_line" * Cs(Cc("")) / rst.stopitemize,
bullet_stop = V"end_block" / rst.stopitemize,
- bullet_init = V"bullet_first" * V"bullet_itemrest",
+ bullet_init = Ct(C(V"bullet_first") * V"bullet_itemrest")
+ / rst.bullet_item
+ ,
bullet_first = #Cmt(V"bullet_indent", function (s, i, bullet)
local t = state
@@ -858,7 +860,9 @@ local parser = P{
end
return false
end)
- * Cs(V"bullet_indent") / rst.startitemize,
+ * V"bullet_indent"
+ / rst.startitemize
+ ,
bullet_indent = V"space"^0 * V"bullet_expr" * V"space"^1,
@@ -881,28 +885,32 @@ local parser = P{
return true
elseif conversion(t.lastbullet) == conversion(bullet) then -- same type
local autoconv = conversion(bullet) == "auto"
- local successor = helpers.list.successor(bullet, t.lastbullet)
+ --local successor = helpers.list.successor(bullet, t.lastbullet)
+ local greater = helpers.list.greater (bullet, t.lastbullet)
t.lastbullet = bullet
- return autoconv or successor
+ --return autoconv or successor or greater
+ return autoconv or successor or greater
end
--return t.bullets[t.depth] == bullet
- end) / "",
+ end),
-- ^^^^^
-- otherwise returns the value of V"bullet_indent", not sure why …
- bullet_continue = V"bullet_cont"
- * V"bullet_itemrest",
+ bullet_continue = Ct(C(V"bullet_cont") * V"bullet_itemrest")
+ /rst.bullet_item
+ ,
- bullet_itemrest = Cs(V"bullet_rest" -- first line
+ bullet_itemrest = C(V"bullet_rest" -- first line
* ((V"bullet_match" * V"bullet_rest")^0 -- any successive lines
--* (V"eol"
* (V"blank_line"
* (V"bullet_match" * (V"bullet_rest" - V"bullet_indent"))^1)^0))
- / rst.bullet_item,
+ --/ rst.bullet_item,
+ ,
-- ^^^^^^^^^^^^^
-- otherwise matches bullet_first
- bullet_rest = Cs((1 - V"eol")^1 * V"eol"), -- rest of one line
+ bullet_rest = (1 - V"eol")^1 * V"eol", -- rest of one line
bullet_next = V"space"^1
,
@@ -952,7 +960,7 @@ local parser = P{
section = V"section_before"^-1
* V"section_text"
* V"section_after"
- * (V"eol" + V"end_block")
+ * (V"end_block" + V"blank_line")
/ rst.section
,