From 8a2b1fc87836edbbaaebdc3ae8759f843711f95f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 13 Sep 2010 20:57:36 +0200 Subject: =?UTF-8?q?enumerations=20now=20don=E2=80=99t=20need=20an=20extra?= =?UTF-8?q?=20\setupitemize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rst_parser.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'rst_parser.lua') 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 … -- cgit v1.2.3