-
-
Save dark4eg/d386b5e9e3aca6aabbdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns one.helpers.html | |
(:require [om-tools.dom :as d :include-macros true])) | |
(def tags | |
{:a d/a | |
:abbr d/abbr | |
:address d/address | |
:area d/area | |
:article d/article | |
:aside d/aside | |
:audio d/audio | |
:b d/b | |
:base d/base | |
:bdi d/bdi | |
:bdo d/bdo | |
:big d/big | |
:blockquote d/blockquote | |
:body d/body | |
:br d/br | |
:button d/button | |
:canvas d/canvas | |
:caption d/caption | |
:cite d/cite | |
:code d/code | |
:col d/col | |
:colgroup d/colgroup | |
:data d/data | |
:datalist d/datalist | |
:dd d/dd | |
:del d/del | |
:dfn d/dfn | |
:div d/div | |
:dl d/dl | |
:dt d/dt | |
:em d/em | |
:embed d/embed | |
:fieldset d/fieldset | |
:figcaption d/figcaption | |
:figure d/figure | |
:footer d/footer | |
:form d/form | |
:h1 d/h1 | |
:h2 d/h2 | |
:h3 d/h3 | |
:h4 d/h4 | |
:h5 d/h5 | |
:h6 d/h6 | |
:head d/head | |
:header d/header | |
:hr d/hr | |
:html d/html | |
:i d/i | |
:iframe d/i | |
:img d/img | |
:ins d/ins | |
:kbd d/kbd | |
:keygen d/keygen | |
:label d/label | |
:legend d/legend | |
:li d/li | |
:link d/link | |
:main d/main | |
:map d/map | |
:mark d/mark | |
:marquee d/marquee | |
:menu d/menu | |
:menuitem d/menuitem | |
:meta d/meta | |
:meter d/meter | |
:nav d/nav | |
:noscript d/noscript | |
:object d/object | |
:ol d/ol | |
:optgroup d/optgroup | |
:output d/output | |
:p d/p | |
:param d/param | |
:pre d/pre | |
:progress d/progress | |
:q d/q | |
:rp d/rp | |
:rt d/rt | |
:ruby d/ruby | |
:s d/s | |
:samp d/samp | |
:script d/script | |
:section d/section | |
:select d/select | |
:small d/small | |
:source d/source | |
:span d/span | |
:strong d/strong | |
:style d/style | |
:sub d/sub | |
:summary d/summary | |
:sup d/sup | |
:table d/table | |
:tbody d/tbody | |
:td d/td | |
:tfoot d/tfoot | |
:th d/th | |
:thead d/thead | |
:time d/time | |
:title d/title | |
:tr d/tr | |
:track d/track | |
:u d/u | |
:ul d/ul | |
:var d/var | |
:video d/video | |
:wbr d/wbr | |
;; svg | |
:circle d/circle | |
:ellipse d/ellipse | |
:g d/g | |
:line d/line | |
:path d/path | |
:polyline d/polyline | |
:rect d/rect | |
:svg d/svg | |
:text d/text | |
:defs d/defs | |
:linearGradient d/linearGradient | |
:polygon d/polygon | |
:radialGradient d/radialGradient | |
:stop d/stop | |
:tspan d/tspan}) | |
(defn render-element | |
"Render a tag vector as a HTML element." | |
[x] | |
(let [tag (nth x 0) | |
attrs (nth x 1) | |
content (nth x 2)] | |
(println "tag" tag) | |
(((keyword tag) tags) attrs (if (vector? content) | |
;(apply render-element content) | |
(render-element content) | |
content)))) | |
(defn render-html | |
"Turn a Clojure data type into a string of HTML." | |
[x] | |
(render-element x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment