aboutsummaryrefslogtreecommitdiff
path: root/_extensions
diff options
context:
space:
mode:
Diffstat (limited to '_extensions')
-rw-r--r--_extensions/ruc-play/semantic-markdown/semantic-markdown.lua33
1 files changed, 25 insertions, 8 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
index ca724d4..230f351 100644
--- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
+++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
@@ -169,26 +169,40 @@ function Statements (block)
goto continue
end
- -- unenclosed, entering bracketed enclosure
- -- TODO: support nested bracketed enclosure
+ -- unenclosed
+ -- TODO: support backslash except immediately before bracket
if not (bracketed or braced) then
- _, a, pre = string.find(el.text, "([^\\]?)%[")
- if a and pre == '' then
+ _, x, s = string.find(el.text, "^([^%[\\]*)")
+ if x then
+ a = x + 1
+ else
+ a = 1
+ end
+ if el.text:sub(a, a) == "[" then
+
+ -- entering bracketed enclosure
bracketed = true
pos = a + 1
-- staying unenclosed
else
table.insert(stack, el)
+ goto continue
end
end
- -- in bracketed enclosure, entering braced enclosure
- -- TODO: support backslash in bracket enclosure
+ -- in bracketed enclosure
+ -- TODO: support backslash except immediately before bracket/brace
-- TODO: support nested bracket enclosure
if bracketed and not braced then
- _, c, s = string.find(el.text, "^([^%[%]}\\]*)%]{?", pos)
- if c then
+ _, x, s = string.find(el.text, "^([^%[%]}\\]*)", pos)
+ if x then
+ b = x + 1
+ else
+ b = pos
+ end
+ if el.text:sub(b, b) == "]" then
+ c = b + 1
-- entering braced enclosure
if el.text:sub(c, c) == "{" then
@@ -200,6 +214,9 @@ function Statements (block)
else
bracketed = false
braced = false
+
+ -- TODO: parse remains of Str
+ goto continue
end
end
end