diff options
| author | unwox <me@unwox.com> | 2024-09-27 15:30:38 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-09-27 15:30:54 +0600 |
| commit | 103bd082143565adae273e23e46e8067431eea22 (patch) | |
| tree | 2ffc83727be6164cd41546cc20502485a2f9f9cd /html.fnl | |
| parent | d1cd901365859db3183667a992da4a9dcf90f6e0 (diff) | |
remove lua and fennel related files
Diffstat (limited to 'html.fnl')
| -rw-r--r-- | html.fnl | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/html.fnl b/html.fnl deleted file mode 100644 index 689f416..0000000 --- a/html.fnl +++ /dev/null @@ -1,31 +0,0 @@ -(local entity-replacements {"&" "&" ; must be first! - "<" "<" - ">" ">" - "\"" """}) - -(local entity-search - (.. "[" (table.concat (icollect [k (pairs entity-replacements)] k)) "]")) - -(fn escape [s] - (assert (= (type s) :string)) - (s:gsub entity-search entity-replacements)) - -(fn tag [tag-name attrs] - (assert (= (type attrs) "table") (.. "Missing attrs table: " tag-name)) - (let [attr-str (table.concat (icollect [k v (pairs attrs)] - (if (= v true) k - (.. k "=\"" v"\""))) " ")] - (.. "<" tag-name " " attr-str">"))) - -(fn render [document allow-no-escape?] - (if (= (type document) :string) - (escape document) - (and allow-no-escape? (= (. document 1) :NO-ESCAPE)) - (. document 2) - (let [[tag-name attrs & body] document] - (.. (tag tag-name attrs) - (table.concat (icollect [_ element (ipairs body)] - (render element allow-no-escape?)) " ") - "</" tag-name ">")))) - -{ :render render } |
