summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-11-06 00:07:27 +0000
committerubq323 <ubq323@ubq323.website>2024-11-06 00:07:38 +0000
commit9d75a4bff7160403d62c1f0b1bee101afb496d1f (patch)
treef52b2f8841c02b8a5cff0fb17567301891b0e906
parenta841432ff0be2171cea75a28035677a4cecd7186 (diff)
add a extension
-rw-r--r--prose.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/prose.lua b/prose.lua
index b064826..7f86d5f 100644
--- a/prose.lua
+++ b/prose.lua
@@ -93,6 +93,13 @@ extensions.meta = function(S,text)
local fn = assert(load(string.format("return {%s}", text),"meta", "t"))
S.meta = fn()
end
+
+extensions.a = function(S,text)
+ local url, ni = text:match("(%S+)%s*()")
+ local body = prose(S, text:sub(ni))
+ return T.a({href=url},body)
+end
+
setmetatable(extensions, {__index = function(t, k)
return function(S, text)
io.stderr:write("warning: unknown extension "..k.."\n")