diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-17 17:11:35 +0200 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2010-09-17 17:11:35 +0200 |
commit | a47844a42cfabc9eb893eef80dd375d75bdd436f (patch) | |
tree | f7bb03c87630b33e3a6c9c363535852f175e256f /rst_parser.lua | |
parent | 3320a5822121e59f07e0f5363edf22fe0c76f67c (diff) | |
download | context-rst-a47844a42cfabc9eb893eef80dd375d75bdd436f.tar.gz |
revised bullet list enumeration, accepting irregular numbering.
Diffstat (limited to 'rst_parser.lua')
-rw-r--r-- | rst_parser.lua | 30 |
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 , |