diff options
Diffstat (limited to 'src/rst_context.lua')
-rw-r--r-- | src/rst_context.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/rst_context.lua b/src/rst_context.lua index 1654832..db05537 100644 --- a/src/rst_context.lua +++ b/src/rst_context.lua @@ -817,10 +817,11 @@ function rst_context.startitemize(str) return result end -local last_item = {} -- stack +local item_stack = { } + local current_itemdepth = 0 function rst_context.stopitemize(str) - last_item[current_itemdepth] = nil + item_stack[current_itemdepth] = nil current_itemdepth = current_itemdepth - 1 return str .. [[ \\stopitemize @@ -828,7 +829,6 @@ function rst_context.stopitemize(str) end function rst_context.bullet_item (tab) - local li = last_item -- The capture of the first item has the \startitemize as -- *second* element in the array. local content = #tab == 2 and tab[2] or tab[3] @@ -837,17 +837,17 @@ function rst_context.bullet_item (tab) local result = startstr or "" if startstr then current_itemdepth = current_itemdepth + 1 - li[current_itemdepth] = itemtype - elseif li[current_itemdepth] then - if helpers.list.successor(itemtype, li[current_itemdepth]) then + item_stack[current_itemdepth] = itemtype + elseif item_stack[current_itemdepth] then + if helpers.list.successor(itemtype, item_stack[current_itemdepth]) then -- just leave it alone - elseif helpers.list.greater(itemtype, li[current_itemdepth]) then + elseif helpers.list.greater(itemtype, item_stack[current_itemdepth]) then local itemnum = tonumber(stringstrip(itemtype)) or helpers.list.get_decimal(itemtype) result = result .. stringformat([[ \\setnumber[itemgroup:itemize]{%s} ]], itemnum) end - li[current_itemdepth] = itemtype + item_stack[current_itemdepth] = itemtype end return result .. [[ |