aboutsummaryrefslogtreecommitdiff
path: root/src/static/api.lua
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-07-30 20:17:25 +0200
committerMartin Fischer <martin@push-f.com>2022-07-30 22:21:23 +0200
commit56c071bb832304ba9a2ec67215b1a8ae40723840 (patch)
tree2282e1f0eafcf65e807f2e9120617401b705d75c /src/static/api.lua
parenta920436c3af249266ff907d15755c1291737905a (diff)
implement lua scripting
Inspired by the Scribunto extension for MediaWiki.
Diffstat (limited to 'src/static/api.lua')
-rw-r--r--src/static/api.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/static/api.lua b/src/static/api.lua
new file mode 100644
index 0000000..3ca9830
--- /dev/null
+++ b/src/static/api.lua
@@ -0,0 +1,15 @@
+local gitpad = {} -- gitpad namespace
+
+function gitpad.html_escape(s)
+ return (string.gsub(s, "[\"><'&]", {
+ ["&"] = "&amp;",
+ ["<"] = "&lt;",
+ [">"] = "&gt;",
+ ['"'] = "&quot;",
+ ["'"] = "&#39;",
+ }))
+end
+
+-- TODO: add API to build HTML tags
+
+return gitpad