diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-04-07 11:05:35 +0200 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-07 13:14:45 +0200 |
| commit | 6b6283bc65a05d6a111107df723f204b7f97c2f8 (patch) | |
| tree | e8cef7b72b9e6df2130e00539a280c9d4a95a63a /_extensions | |
| parent | a081b22f78c4c113ae82f9cefe67b7cb3995450c (diff) | |
fix conditionals (zero != false in Lua)
Diffstat (limited to '_extensions')
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index 4135ccb..1dc17aa 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -164,7 +164,7 @@ function Statements (block) if el.t == 'Str' and not (bracketed or braced) then _, a, pre = string.find(el.text, "([^\\]?)%[") if a and pre == '' then - bracketed = 1 + bracketed = true pos = a + 1 end end @@ -178,14 +178,14 @@ function Statements (block) -- entering braced enclosure if el.text:sub(c, c) == "{" then - braced = 1 + braced = true pos = c + 1 table.insert(new_inlines, pandoc.Str(s)) -- leaving non-annotation enclosure else - bracketed = 0 - braced = 0 + bracketed = false + braced = false end end end @@ -197,15 +197,19 @@ function Statements (block) _, d = string.find(el.text, "^"..curie_long.."}", pos) if d then statement_count = statement_count + 1 + bracketed = false + braced = false + pos = d + 1 + -- TODO: add any bracket-enclosed content to stack -- TODO: call same function with remains of Str end - end + else table.insert(new_inlines, el) + end + end + if statement_count > 0 then + return pandoc.Blocks {new_inlines} end --- FIXME --- if statement_count then --- return pandoc.Inlines {new_inlines} --- end end -- First resolve namespace declarations, then statements. |
