From 2fbe90e86d3e8d7e38228e705aaef8397e3d7207 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 8 Apr 2025 11:33:05 +0200 Subject: process default namespace --- .../semantic-markdown/semantic-markdown.lua | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to '_extensions/ruc-play/semantic-markdown/semantic-markdown.lua') 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 --- @see 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 -- cgit v1.2.3