diff options
Diffstat (limited to 'src/static/api.lua')
-rw-r--r-- | src/static/api.lua | 15 |
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, "[\"><'&]", { + ["&"] = "&", + ["<"] = "<", + [">"] = ">", + ['"'] = """, + ["'"] = "'", + })) +end + +-- TODO: add API to build HTML tags + +return gitpad |