diff options
Diffstat (limited to 'rst_parser.lua')
-rw-r--r-- | rst_parser.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rst_parser.lua b/rst_parser.lua index d8ddb32..b3e5f27 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -53,6 +53,7 @@ state.depth = 0 state.bullets = {} -- mapping bullet forms to depth state.bullets.max = 0 state.lastbullet = "" +state.lastbullets = {} state.roman_cache = {} -- storing roman numerals that were already converted state.currentindent = "" -- used in definition lists and elsewhere state.currentwidth = 0 -- table layout @@ -852,6 +853,7 @@ local parser = P{ warn("close", t.depth) t.bullets[t.depth] = nil -- “pop” t.depth = t.depth - 1 + t.lastbullet = t.lastbullets[t.depth] return true end), @@ -867,7 +869,9 @@ local parser = P{ warn("first", t.depth, (t.depth == 0 and n_spaces == 1) or - (t.depth > 0 and n_spaces > 1), bullet, oldbullet, + (t.depth > 0 and n_spaces > 1), + bullet, + oldbullet, t.conversion(bullet)) if t.depth == 0 and n_spaces == 1 then -- first level @@ -878,6 +882,7 @@ local parser = P{ return true elseif t.depth > 0 and n_spaces > 1 then -- sublist (of sublist)^0 if n_spaces >= utf.len(oldbullet) then + t.lastbullets[t.depth] = t.lastbullet t.depth = t.depth + 1 t.bullets[t.depth] = bullet t.lastbullet = bullet @@ -898,6 +903,7 @@ local parser = P{ bullet == t.bullets[t.depth], bullet, t.bullets[t.depth], + t.lastbullets[t.depth], t.conversion(t.lastbullet), t.conversion(bullet) ) @@ -907,9 +913,12 @@ local parser = P{ elseif not t.conversion(bullet) and t.bullets[t.depth] == bullet then return true elseif t.conversion(t.lastbullet) == t.conversion(bullet) then -- same type - return t.conversion(bullet) == "auto" or t.successor(bullet, t.lastbullet) + local autoconv = t.conversion(bullet) == "auto" + local successor = t.successor(bullet, t.lastbullet) + t.lastbullet = bullet + return autoconv or successor end - return t.bullets[t.depth] == bullet + --return t.bullets[t.depth] == bullet end) / "", -- ^^^^^ -- otherwise returns the value of V"bullet_indent", not sure why … |