aboutsummaryrefslogtreecommitdiff
path: root/_extensions
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-10 14:14:33 +0200
committerJonas Smedegaard <dr@jones.dk>2025-05-10 14:14:40 +0200
commitc8ad87c59dec9e50d88e6314199b5fef24f9335c (patch)
treee990dbcf0f64d78c9fd2195c9e21b93ae2331f5e /_extensions
parent4fd48a1b3acf131629a16a34facd8e8c71817a20 (diff)
resolve block element only once
Diffstat (limited to '_extensions')
-rw-r--r--_extensions/ruc-play/semantic-markdown/semantic-markdown.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
index 0ce1dcd..ef02b83 100644
--- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
+++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua
@@ -133,13 +133,14 @@ local function Namespaces(blocks)
and blocks.content[2].t == "Space"
and blocks.content[1].text:match(curie_pattern)
then
+ local el = blocks.content[3]
-- default namespace, misparsed as a citation
- if blocks.content[3].t == "Cite"
- and #blocks.content[3].content == 1
+ if el.t == "Cite"
+ and #el.content == 1
-- TODO: maybe check case-insensitively
- and blocks.content[3].content[1].text == "@default"
+ and el.content[1].text == "@default"
then
-- FIXME: add CURIE to metadata
return {}
@@ -147,11 +148,11 @@ local function Namespaces(blocks)
-- namespace
local proto_pattern = "^https?:"
- if blocks.content[3].t == "Str"
+ if el.t == "Str"
-- TODO: maybe check case-insensitively
-- TODO: relax to match URI syntax without hardcoded protocols
- and blocks.content[3].text:match(proto_pattern)
+ and el.text:match(proto_pattern)
then
-- FIXME: add CURIE and URI to metadata
return {}