aboutsummaryrefslogtreecommitdiff
path: root/src/static/api.lua
diff options
context:
space:
mode:
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