diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-05-09 13:54:18 +0200 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-05-10 12:58:58 +0200 |
| commit | a49b1e2a8c8b9b722e092f911832801fbcf39c4d (patch) | |
| tree | bb3a3fee33ac6fe7e4a499b113df136e1acf2b75 /_extensions | |
| parent | b3ad61eec252fd287785b5ae4f9f230118276c8c (diff) | |
add Enclosure state BRACKETED_DONE
Diffstat (limited to '_extensions')
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index f6f0579..4980a6b 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -62,7 +62,8 @@ os.setlocale 'C' local Enclosure = { NONE = "0", BRACKETED = "1", - BRACED = "2", + BRACKETED_DONE = "2", + BRACED = "3", } -- TODO: cover non-ASCII Unicode characters @@ -263,13 +264,21 @@ function Statements (block) else b = pos end + stack_next = stack_next..s + + -- exiting bracketed enclosure if el.text:sub(b, b) == "]" then - c = b + 1 + pos = b + 1 + enclosure = Enclosure.BRACKETED_DONE + end + end + + -- exited bracketed enclosure + if enclosure == Enclosure.BRACKETED_DONE then -- entering braced enclosure - if el.text:sub(c, c) == "{" then - pos = c + 1 - stack_next = stack_next..s + if el.text:sub(pos, pos) == "{" then + pos = pos + 1 enclosure = Enclosure.BRACED -- leaving non-annotation enclosure @@ -282,11 +291,6 @@ function Statements (block) -- TODO: parse remains of Str goto continue end - - -- staying enclosed - else - stack_next = stack_next..s - end end -- in braced enclosure, leaving it |
