From 9d75a4bff7160403d62c1f0b1bee101afb496d1f Mon Sep 17 00:00:00 2001 From: ubq323 Date: Wed, 6 Nov 2024 00:07:27 +0000 Subject: add a extension --- prose.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'prose.lua') 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") -- cgit v1.2.3