From 865dd74c8a0afa04df36224b7c5a931156a318ff Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 6 Dec 2024 11:30:55 +0100 Subject: [PATCH 1/5] Bump jsoup --- deps.edn | 2 +- project.clj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 14472e6..7303e43 100644 --- a/deps.edn +++ b/deps.edn @@ -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"}}} diff --git a/project.clj b/project.clj index e874df8..6cb641b 100644 --- a/project.clj +++ b/project.clj @@ -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"] From c133ef0a259bf669b95a752129c19723dcbdfdf7 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 6 Dec 2024 12:03:54 +0100 Subject: [PATCH 2/5] fix some errors --- src/clj/hickory/core.clj | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/clj/hickory/core.clj b/src/clj/hickory/core.clj index 3212d4e..0814512 100644 --- a/src/clj/hickory/core.clj +++ b/src/clj/hickory/core.clj @@ -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) @@ -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))) @@ -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 ) into a list of DOM elements that can From f077be08a23854e5bde842e155dc9e237ef41f4b Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Mar 2025 20:45:50 +0100 Subject: [PATCH 3/5] Bump jsoup --- deps.edn | 2 +- project.clj | 2 +- test/cljc/hickory/test/core.cljc | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deps.edn b/deps.edn index 7303e43..5130d4b 100644 --- a/deps.edn +++ b/deps.edn @@ -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.18.3"}} ;hold back jsoup upgrade due to graal incompatibility + org.jsoup/jsoup {:mvn/version "1.19.1"}} :aliases {:test {:extra-paths ["test/cljc"]} :cljs {:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.60"}}} diff --git a/project.clj b/project.clj index 6cb641b..8d8a385 100644 --- a/project.clj +++ b/project.clj @@ -11,7 +11,7 @@ :dependencies [[org.clojure/clojure "1.11.1"] [org.clojure/clojurescript "1.11.60" :scope "provided"] - [org.jsoup/jsoup "1.18.3"]] + [org.jsoup/jsoup "1.19.1"]] :source-paths ["src/clj" "src/cljc" "src/cljs"] diff --git a/test/cljc/hickory/test/core.cljc b/test/cljc/hickory/test/core.cljc index 807979b..aefaedb 100644 --- a/test/cljc/hickory/test/core.cljc +++ b/test/cljc/hickory/test/core.cljc @@ -16,7 +16,8 @@ (is (= {:type :document, :content [{:type :document-type, - :attrs {:name "html", :publicid "", :systemid ""}} + :attrs {:name "html", :publicid "", :systemid "" + :#doctype "html"}} {:type :element, :attrs nil, :tag :html, @@ -57,7 +58,8 @@ (is (= {:type :document, :content [{:type :document-type, - :attrs {:name "html", :publicid "", :systemid ""}} + :attrs {:name "html", :publicid "", :systemid "" + :#doctype "html"}} {:type :element, :attrs nil, :tag :html, From 749ba998aa64f19092876cda967e6c562c56b81d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Mar 2025 20:48:57 +0100 Subject: [PATCH 4/5] Fix tests for CLJS --- test/cljc/hickory/test/core.cljc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cljc/hickory/test/core.cljc b/test/cljc/hickory/test/core.cljc index aefaedb..fd3caae 100644 --- a/test/cljc/hickory/test/core.cljc +++ b/test/cljc/hickory/test/core.cljc @@ -17,7 +17,7 @@ (is (= {:type :document, :content [{:type :document-type, :attrs {:name "html", :publicid "", :systemid "" - :#doctype "html"}} + #?@(:clj [:#doctype "html"])}} {:type :element, :attrs nil, :tag :html, @@ -59,7 +59,7 @@ (is (= {:type :document, :content [{:type :document-type, :attrs {:name "html", :publicid "", :systemid "" - :#doctype "html"}} + #?@(:clj [:#doctype "html"])}} {:type :element, :attrs nil, :tag :html, From 4e3f69047f4fec337c32c7aeba9884f7f366c1b2 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Mar 2025 21:02:20 +0100 Subject: [PATCH 5/5] remove warn on reflection --- src/clj/hickory/core.clj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/clj/hickory/core.clj b/src/clj/hickory/core.clj index 0814512..8069659 100644 --- a/src/clj/hickory/core.clj +++ b/src/clj/hickory/core.clj @@ -144,16 +144,12 @@ ([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 ) into a list of DOM elements that can