Parse html as hickory

This commit is contained in:
bom 2024-05-16 10:27:35 +02:00
parent a5f4be5dc2
commit 92456c16bf
2 changed files with 13 additions and 4 deletions

View file

@ -1,13 +1,14 @@
;; shadow-cljs configuration ;; shadow-cljs configuration
{:source-paths {:source-paths
["src/dev" ["src/main"
"src/main"
"src/test"] "src/test"]
:dependencies :dependencies
[[orchestra "2021.01.01-1"] [[orchestra "2021.01.01-1"]
[hiccups "0.3.0"] [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"} :dev-http {8080 "public"}
:builds :builds
{:test {:target :node-test {:test {:target :node-test

View file

@ -13,10 +13,18 @@
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and ; See the License for the specific language governing permissions and
; limitations under the License. ; 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 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] (defn element-from-document-by-name [name]
(-> js/document (-> js/document
(.getElementById masto-embed) (.getElementById masto-embed)