diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-03-25 07:44:43 +0100 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-03-25 07:44:58 +0100 |
| commit | 8cff67e7ec91a0b7b3e82a3f5fb22043b726406d (patch) | |
| tree | c3bd410e9e6346d21ef019793b6d98a688ca3a1e /_extensions | |
| parent | 7efa16a6572dc8960b5d469aac551675253981d0 (diff) | |
rename bracket/brace to begin/end (not open/close); refine ASCII-art
Diffstat (limited to '_extensions')
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index 032bc05..a19f83f 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -129,16 +129,17 @@ end --- Simple ontological annotation: --- "A [map]{foaf:depiction} is not the territory" --- | || | ---- | |brace_open brace_close ---- | bracket_close ---- bracket_open +--- | |`brace_begin `brace_end +--- | `bracket_end +--- `bracket_begin --- --- Nested and mixed-use annotations: ---- ["[Ceci]{foaf:depiction} n'est pas une pipe"{lang=fr dc:Text} ---- | | || | ---- | | |brace_open brace_close ---- | | bracket_close ---- | bracket_open +--- ["[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 --- ``` --- --- @param inlines Markdown with semantic annotations as Inlines @@ -147,7 +148,7 @@ end function Statements (inlines) -- positions of enclosure markers - local bracket_open, bracket_close, brace_open, brace_close + local bracket_begin, bracket_end, brace_begin, brace_end -- maintain states across inlines local bracketed, braced, has_hints @@ -164,8 +165,8 @@ function Statements (inlines) -- unenclosed if not (bracketed or braced) then - _, bracket_open = string.find(el.text, "%[") - if bracket_open then + _, bracket_begin = string.find(el.text, "%[") + if bracket_begin then bracketed = true end end @@ -173,9 +174,9 @@ function Statements (inlines) -- enters a bracket enclosure -- TODO: maybe support nested bracket enclosure if bracketed and not braced then - _, bracket_close, s = string.find(el.text, "^([^%[%]}]*)%]{", - bracket_open) - if bracket_close then + _, bracket_end, s = string.find(el.text, "^([^%[%]}]*)%]{", + bracket_begin) + if bracket_end then braced = true table.insert(new_inlines, pandoc.Str(s)) end @@ -187,9 +188,9 @@ function Statements (inlines) -- TODO: support mixed-use enclosure -- TODO: cover curie_prefix and curie_local and curie_default if braced then - _, brace_close = string.find(el.text, "^"..curie_long.."}", - bracket_close) - if brace_close then + _, brace_end = string.find(el.text, "^"..curie_long.."}", + bracket_end) + if brace_end then has_hints = true -- TODO: call same function with remains of Str end |
