diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-04-07 11:01:06 +0200 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-07 13:14:45 +0200 |
| commit | a081b22f78c4c113ae82f9cefe67b7cb3995450c (patch) | |
| tree | 8d0772c7a14cd1fe45580d4ab34b2f4be527d409 /_extensions | |
| parent | f83a3d6e6669cd9bfbf5ac381381878bf0d32075 (diff) | |
use single-letter enclosure markers
Diffstat (limited to '_extensions')
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index ef4e7e4..4135ccb 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -128,18 +128,18 @@ end --- ```ASCII-art --- Simple ontological annotation: --- "A [map]{foaf:depiction} is not the territory" ---- | || | ---- | |`brace_begin `brace_end ---- | `bracket_end ---- `bracket_begin +--- | ||\~~~~~~~~~~~~/| +--- a bc curie d --- --- Nested and mixed-use annotations: --- ["[Ceci]{foaf:depiction} n'est pas une pipe"]{lang=fr dc:Text} ---- | | || | || | ---- | | |`brace_begin `brace_end |`brace_begin | ---- | | `inner_bracket_end | brace_end ---- | `inner_bracket_begin `outer_bracket_end ---- `outer_bracket_end +--- | | ||\~~~~~~~~~~~~/| || \~~~~~/| +--- a a1 |c1 curie1 d1 bc curie d +--- b1 +--- +--- Legend: +--- a-b, a1-b1: braced enclosure +--- c-d, c1-d1: bracketed enclosure --- ``` --- --- @param inlines Markdown with semantic annotations as Inlines @@ -162,10 +162,10 @@ function Statements (block) -- unenclosed, entering bracketed enclosure -- TODO: support nested bracketed enclosure if el.t == 'Str' and not (bracketed or braced) then - a, b, pre = string.find(el.text, "([^\\]?)%[") - if b and pre == '' then + _, a, pre = string.find(el.text, "([^\\]?)%[") + if a and pre == '' then bracketed = 1 - pos = b + 1 + pos = a + 1 end end @@ -173,13 +173,13 @@ function Statements (block) -- TODO: support backslash in bracket enclosure -- TODO: support nested bracket enclosure if el.t == 'Str' and bracketed and not braced then - a, b, s = string.find(el.text, "^([^%[%]}\\]*)%]{?", pos) - if b then + _, c, s = string.find(el.text, "^([^%[%]}\\]*)%]{?", pos) + if c then -- entering braced enclosure - if el.text:sub(b, b) == "{" then + if el.text:sub(c, c) == "{" then braced = 1 - pos = b + 1 + pos = c + 1 table.insert(new_inlines, pandoc.Str(s)) -- leaving non-annotation enclosure @@ -194,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 - a, b = string.find(el.text, "^"..curie_long.."}", pos) - if b then + _, d = string.find(el.text, "^"..curie_long.."}", pos) + if d then statement_count = statement_count + 1 -- TODO: call same function with remains of Str end |
