diff --git a/src/dompa/coordinates.cljc b/src/dompa/coordinates.cljc index 2388fcd..dbb4e0e 100644 --- a/src/dompa/coordinates.cljc +++ b/src/dompa/coordinates.cljc @@ -117,7 +117,7 @@ {:coord-type :text, :coord-name :dompa/text}))) (def ^:private void-elements - #{"area" "base" "br" "col" "embed" "hr" "img" + #{"!DOCTYPE" "!doctype" "area" "base" "br" "col" "embed" "hr" "img" "input" "link" "meta" "param" "source" "track" "wbr"}) (defn- handle-opening-tag [{:keys [stack unified coord coord-name start]}] @@ -201,9 +201,7 @@ "Parses a given HTML node attribute string into a key-value pair." [attr] - (->> (partition-by #(= % \=) attr) - (filter #(not= (-> % first) \=)) - (map #(reduce str %)))) + (str/split attr #"=" 2)) (defn- normalize-html-attr-str "Normalizes a given HTML attribute string. If it @@ -221,9 +219,8 @@ treated as boolean attributes, and are always `true`." [html-attr-str] (let [[k v] (html-attr-str->k-v html-attr-str) - k (keyword k) - v (if (nil? v) true (normalize-html-attr-str v))] - {k v})) + k (keyword k)] + {k (if (nil? v) true (normalize-html-attr-str v))})) (defn- html->str->node-attrs-reducer-fn "Returns a reducer function with initial state of `attrs-html`." diff --git a/test/dompa/html/michiel_borkent.html b/test/dompa/html/michiel_borkent.html new file mode 100644 index 0000000..a3f1c22 --- /dev/null +++ b/test/dompa/html/michiel_borkent.html @@ -0,0 +1,118 @@ + + + + Welkom op de homepagina van Michiel Borkent + + + + + + +
+
+
+
+

Michiel Borkent
Software developer, speaker, Clojure professional

+
+ +
+

Business info

+
+
    +
  • Michiel Borkent - Clojure development
  • +
    +
  • michielborkent@gmail.com
  • +
    +
  • Netherlands Chamber of Commerce / Kamer van Koophandel: 66357454
  • +
+
+
+ +
+

Curriculum vitae

+ +
+ +
+

Open source projects

+
+
    +
  • Babashka: a fast-starting scripting environment for Clojure
  • +
  • Clj-kondo: a linter for Clojure that sparks joy
  • +
  • Small Clojure Interpreter
  • +
  • Jet: CLI to transform between JSON, EDN and Transit
  • +
  • Edamame: configurable EDN/Clojure parser with location metadata
  • +
  • Re-find: find functions using spec
  • +
+
+
+ +
+

Talks

+
+
    +
  • Babashka and GraalVM; taking Clojure to new places - video, slides and code July 11th 2020, Clojure/NYC
  • +
  • Babashka and the Small Clojure Interpreter: using Clojure in new contexts - video, slides and code February 2020, ClojureD, Berlin Germany
  • +
  • Clj-kondo: a linter for Clojure that sparks joy - video, slidescode September 27th 2019, ClojuTRE, Helsinki Finland
  • +
  • Re-find: discover functions with spec - video, slides and demo April 6th 2019, Dutch Clojure Days
  • +
  • Functional Programming in Practice - repo and slides May 9th 2016, Hogeschool Utrecht
  • Full stack Clojure - repo and slides October 1 2015, Hogeschool Arnhem-Nijmegen
  • +
  • Functional programming in the browser with ClojureScript - repo and slides July 29 2015, Sytac Devjam
  • +
  • ClojureScript <3 React - video, slides and code May 26 2015, DomCode meetup
  • +
  • Reagent - ClojureScript interface to React - slides and code Feb. 12 2015, React Amsterdam
  • +
  • ClojureScript interfaces to React - video, slides and code Nov. 6 2014, Øredev, Malmö Sweden
  • +
  • ClojureScript for the web - video, slides and code Nov. 6 2014, Øredev, Malmö Sweden
  • +
  • ClojureScript/Om/Reagent - video and slides Oct. 16 2014, FP AMS, Amsterdam Netherlands
  • Immutable Stack (clojure workshop) - slides and code Oct. 10 2014, Devnology, Leusden Netherlands
  • +
  • Clojure introductie - slides Jun. 20 2013, Dec. 19 2013, May 5 2014, Hogeschool Arnhem-Nijmegen Netherlands
  • +
+
+
+ +
+

Writings

+ +
+ +
+

Courses

+
+ +
+
+ + +
+
+

Michiel

+

View Michiel Borkent's profile on Github

+

Stackoverflow

+

+
+
+
+ + \ No newline at end of file diff --git a/test/dompa/round_trip_test.clj b/test/dompa/round_trip_test.clj new file mode 100644 index 0000000..0e5d1fa --- /dev/null +++ b/test/dompa/round_trip_test.clj @@ -0,0 +1,11 @@ +(ns dompa.round-trip-test + (:require [clojure.test :refer [deftest is testing]] + [dompa.nodes :as nodes] + [dompa.html :as html])) + +(deftest round-trip-test + (testing "michiel borkent website" + (let [input-html (slurp "test/dompa/html/michiel_borkent.html") + nodes (html/->nodes input-html) + output-html (nodes/->html nodes)] + (is (= input-html output-html))))) \ No newline at end of file