diff options
Diffstat (limited to '_extensions')
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index a8ef886..ef4e7e4 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -162,23 +162,24 @@ function Statements (block) -- unenclosed, entering bracketed enclosure -- TODO: support nested bracketed enclosure if el.t == 'Str' and not (bracketed or braced) then - _, pos = string.find(el.text, "%[") - if pos then + a, b, pre = string.find(el.text, "([^\\]?)%[") + if b and pre == '' then bracketed = 1 - pos = pos + 1 + pos = b + 1 end end -- in bracketed enclosure, entering braced enclosure + -- TODO: support backslash in bracket enclosure -- TODO: support nested bracket enclosure if el.t == 'Str' and bracketed and not braced then - _, pos, s = string.find(el.text, "^([^%[%]}]*)%]{?", pos) - if pos then + a, b, s = string.find(el.text, "^([^%[%]}\\]*)%]{?", pos) + if b then -- entering braced enclosure - if el.text:sub(pos, pos) == "{" then + if el.text:sub(b, b) == "{" then braced = 1 - pos = pos + 1 + pos = b + 1 table.insert(new_inlines, pandoc.Str(s)) -- leaving non-annotation enclosure @@ -193,8 +194,8 @@ function Statements (block) -- TODO: support mixed-use enclosure -- TODO: cover curie_prefix and curie_local and curie_default if el.t == 'Str' and braced then - _, pos = string.find(el.text, "^"..curie_long.."}", pos) - if pos then + a, b = string.find(el.text, "^"..curie_long.."}", pos) + if b then statement_count = statement_count + 1 -- TODO: call same function with remains of Str end |
