From a49b1e2a8c8b9b722e092f911832801fbcf39c4d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 9 May 2025 13:54:18 +0200 Subject: add Enclosure state BRACKETED_DONE --- .../semantic-markdown/semantic-markdown.lua | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to '_extensions') 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 -- cgit v1.2.3