From 392695a606ac0618ecfd74d92abf13f3d4feedb4 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 11 May 2025 13:08:15 +0200 Subject: check non-Str element highest state first to support fall-through --- .../semantic-markdown/semantic-markdown.lua | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 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 407912d..3dd08d8 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -234,24 +234,25 @@ local function Statements (block) local pos = 1 local chars = "" - -- non-string element + -- non-string element, highest state first to support fall-through if el.t ~= 'Str' then - -- specific elements represent content enclosure - if encl == Enclosure.NONE then - if ElementTypeIsEnclosure[el.t] then - encl = Enclosure.BRACKETED_DONE - end + -- collect element, except in braced enclosure + -- TODO: support mixed-use braced enclosure + if encl ~= Enclosure.BRACED then + elems:insert(el) + end -- disqualify bracketing not directly followed by brace - elseif encl == Enclosure.BRACKETED_DONE then + if encl == Enclosure.BRACKETED_DONE then encl = Enclosure.NONE end - -- collect element, except in braced enclosure - -- TODO: support mixed-use braced enclosure - if encl ~= Enclosure.BRACED then - elems:insert(el) + -- specific elements represent content enclosure + if encl == Enclosure.NONE then + if ElementTypeIsEnclosure[el.t] then + encl = Enclosure.BRACKETED_DONE + end end goto continue -- cgit v1.2.3