From 92456c16bfbd5bc79c7cf607f72eae82effa9445 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 16 May 2024 10:27:35 +0200 Subject: [PATCH] Parse html as hickory --- shadow-cljs.edn | 7 ++++--- src/main/dda/masto_embed/browser.cljs | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 539e868..803cf6e 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -1,13 +1,14 @@ ;; shadow-cljs configuration {:source-paths - ["src/dev" - "src/main" + ["src/main" "src/test"] :dependencies [[orchestra "2021.01.01-1"] [hiccups "0.3.0"] - [com.andrewmcveigh/cljs-time "0.5.2"]] + [org.clj-commons/hickory "0.7.4"] + [com.andrewmcveigh/cljs-time "0.5.2"] + [org.domaindrivenarchitecture/c4k-common-cljs "6.2.3"]] :dev-http {8080 "public"} :builds {:test {:target :node-test diff --git a/src/main/dda/masto_embed/browser.cljs b/src/main/dda/masto_embed/browser.cljs index 2691c1c..6e2c3df 100644 --- a/src/main/dda/masto_embed/browser.cljs +++ b/src/main/dda/masto_embed/browser.cljs @@ -13,10 +13,18 @@ ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. -(ns dda.masto-embed.browser) +(ns dda.masto-embed.browser + (:require + [hickory.core :as h] + [shadow.resource :as rc])) (def masto-embed "masto-embed") +(def index-html (rc/inline "dda/masto_embed/resources/index.html")) + +(defn index-html-hiccup [] + (h/as-hiccup (h/parse index-html))) + (defn element-from-document-by-name [name] (-> js/document (.getElementById masto-embed)