aboutsummaryrefslogtreecommitdiff
path: root/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
diff options
context:
space:
mode:
Diffstat (limited to '_extensions/ruc-play/semantic-markdown/semantic-markdown.lua')
-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