Created
May 5, 2011 02:12
-
-
Save masaedw/956407 to your computer and use it in GitHub Desktop.
xml->hiccup
This file contains hidden or 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
| (defn xml->hiccup [xml] | |
| (cond | |
| (string? xml) xml | |
| (map? xml) | |
| (let [{:keys [tag attrs content]} xml] | |
| (-> [tag] | |
| (#(if (nil? attrs) % (conj % attrs))) | |
| (#(if (empty? content) % ((comp vec concat) % (map xml->hiccup content)))))) | |
| )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment