Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump jsoup #91

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{:paths ["src/clj" "src/cljc" "src/cljs"]
:deps
{org.clojure/clojure {:mvn/version "1.11.1"}
org.jsoup/jsoup {:mvn/version "1.14.3"}} ;hold back jsoup upgrade due to graal incompatibility
org.jsoup/jsoup {:mvn/version "1.18.3"}} ;hold back jsoup upgrade due to graal incompatibility
:aliases
{:test {:extra-paths ["test/cljc"]}
:cljs {:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.60"}}}
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

:dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/clojurescript "1.11.60" :scope "provided"]
[org.jsoup/jsoup "1.15.2"]]
[org.jsoup/jsoup "1.18.3"]]

:source-paths ["src/clj" "src/cljc" "src/cljs"]

Expand Down
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
Loading