Created
September 13, 2021 12:01
-
-
Save rotaliator/cf1a3859298bcdba3c68b22f688c323c to your computer and use it in GitHub Desktop.
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->map | |
"Konwertuje sparsowanego xml'a na mapę. | |
Uwaga, uwzględnia tylko tagi i zawartość. Ignoruje atrybuty" | |
[xml] | |
(walk/postwalk | |
(fn [e] | |
(let [content (:content e)] | |
(cond | |
(map? e) {(:tag e) | |
(if (<= (count content) 1) | |
(first content) | |
content)} | |
:else e))) | |
xml)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment