Created
January 17, 2015 01:20
-
-
Save AlexBaranosky/5167547ce97eb8b14375 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
;; Copied from: | |
;; https://github.com/davidsantiago/hickory/blob/6c02f7e5383549906855246358a15f3e0dcd3264/src/hickory/core.cljs#L69 | |
;; | |
;; .. with one small modification commented inline. SEE: hickory/Text | |
;; Original modified line: | |
;; https://github.com/davidsantiago/hickory/blob/6c02f7e5383549906855246358a15f3e0dcd3264/src/hickory/core.cljs#L95 | |
(extend-protocol hickory/HiccupRepresentable | |
object | |
(as-hiccup [this] | |
(condp = (aget this "nodeType") | |
hickory/Attribute | |
[(hickory-utils/lower-case-keyword (aget this "name")) | |
(aget this "value")] | |
hickory/Comment | |
(str "<!--" (aget this "data") "-->") | |
hickory/Document | |
(map hickory/as-hiccup (aget this "childNodes")) | |
hickory/DocumentType | |
(hickory/format-doctype this) | |
hickory/Element | |
(let [tag (hickory-utils/lower-case-keyword (aget this "tagName"))] | |
(into [] (concat [tag | |
(into {} (map hickory/as-hiccup (aget this "attributes")))] | |
(if (hickory-utils/unescapable-content tag) | |
(map #(aget % "wholeText") (aget this "childNodes")) | |
(map hickory/as-hiccup (aget this "childNodes")))))) | |
hickory/Text | |
(aget this "wholeText")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment