aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-04-08 11:33:05 +0200
committerJonas Smedegaard <dr@jones.dk>2025-04-08 11:33:05 +0200
commit2fbe90e86d3e8d7e38228e705aaef8397e3d7207 (patch)
tree61063666cf6a4e55500fc30466b9c90dcc5454e1
parent9ac07426999f134b53a87c56a2e5a3f5e391e03e (diff)
process default namespace
-rw-r--r--_extensions/ruc-play/semantic-markdown/semantic-markdown.lua28
1 files changed, 24 insertions, 4 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
index 70f4970..92d9fa7 100644
--- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
+++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
@@ -108,15 +108,35 @@ local curie_default = ":"
--- @see <https://pandoc.org/lua-filters.html#type-blocks>
--- @see <https://www.w3.org/TR/rdf12-concepts/#vocabularies>
local function Namespaces(blocks)
+
+ -- paragraph with only a braced reference CURIE, colon and one word
if #blocks.content == 3
and blocks.content[1].t == "Str"
and blocks.content[2].t == "Space"
- and blocks.content[3].t == "Str"
and blocks.content[1].text:match "^{"..curie_no_ref.."}%:%:$"
- and blocks.content[3].text:match "^https?:"
then
- -- FIXME: register namespace in Meta
- return pandoc.Blocks {}
+
+ -- default namespace, misparsed as a citation
+ if blocks.content[3].t == "Cite"
+ and #blocks.content[3].content == 1
+
+ -- TODO: maybe check case-insensitively
+ and blocks.content[3].content[1].text == "@default"
+ then
+ -- FIXME: add CURIE to metadata
+ return {}
+ end
+
+ -- namespace
+ if blocks.content[3].t == "Str"
+
+ -- TODO: maybe check case-insensitively
+ -- TODO: relax to match URI syntax without hardcoded protocols
+ and blocks.content[3].text:match "^https?:"
+ then
+ -- FIXME: add CURIE and URI to metadata
+ return {}
+ end
end
end