Skip to content

Commit

Permalink
fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Dec 6, 2024
1 parent 865dd74 commit c133ef0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/clj/hickory/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
DocumentType Element TextNode XmlDeclaration]
[org.jsoup.parser Tag Parser]))

(set! *warn-on-reflection* true)

(defn- end-or-recur [as-fn loc data & [skip-child?]]
(let [new-loc (-> loc (zip/replace data) zip/next (cond-> skip-child? zip/next))]
(if (zip/end? new-loc)
Expand Down Expand Up @@ -68,9 +70,10 @@
DocumentType
(as-hiccup
([this] (trampoline as-hiccup this (hzip/hiccup-zip this)))
([this loc] (end-or-recur as-hiccup loc (utils/render-doctype (.attr this "name")
(.attr this "publicid")
(.attr this "systemid")))))
([this loc]
(end-or-recur as-hiccup loc (utils/render-doctype (.name this)
(.publicId this)
(.systemId this)))))
Element
(as-hiccup
([this] (trampoline as-hiccup this (hzip/hiccup-zip this)))
Expand Down Expand Up @@ -141,12 +144,16 @@
([this] (trampoline as-hickory this (hzip/hickory-zip this)))
([this loc] (end-or-recur as-hickory loc (.getWholeText this)))))

(set! *warn-on-reflection* false)

(defn parse
"Parse an entire HTML document into a DOM structure that can be
used as input to as-hiccup or as-hickory."
[s]
(Jsoup/parse s))

(set! *warn-on-reflection* true)

(defn parse-fragment
"Parse an HTML fragment (some group of tags that might be at home somewhere
in the tag hierarchy under <body>) into a list of DOM elements that can
Expand Down

0 comments on commit c133ef0

Please sign in to comment.