-
-
Save cemerick/2a64e0067c960ea86354 to your computer and use it in GitHub Desktop.
hiccup -> clojure.xml
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
; problems: | |
; * doesn't elide empty attrs e.g. id="" class="" | |
; * doesn't convert e.g. {:selected true} into selected=selected | |
(defn- hiccup->corexml | |
[x] | |
(if (coll? x) | |
(let [[tag attrs content] (#'hiccup.core/normalize-element x)] | |
{:tag (keyword tag) :attrs attrs :content (map hiccup->corexml content)}) | |
(str x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment