Skip to content
Merged
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
11 changes: 4 additions & 7 deletions src/dompa/coordinates.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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]}]
Expand Down Expand Up @@ -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
Expand All @@ -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`."
Expand Down
118 changes: 118 additions & 0 deletions test/dompa/html/michiel_borkent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html>
<head>
<title>Welkom op de homepagina van Michiel Borkent</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/lavish-bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="jumbotron">
<p class="lead">Michiel Borkent<br>Software developer, speaker, Clojure professional</p>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Business info</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Michiel Borkent - Clojure development</li>
<br>
<li><a href="mailto:michielborkent@gmail.com">michielborkent@gmail.com</a></li>
<br>
<li>Netherlands Chamber of Commerce / Kamer van Koophandel: 66357454</li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Curriculum vitae</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li><a href="cv/cv-EN.pdf">Curriculum vitae (EN)</a></li>
<li><img src="img/dutchflag_14px.jpg"> <a href="cv/cv.pdf">Curriculum vitae</a></li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Open source projects</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li><a href="https://github.com/borkdude/babashka">Babashka</a><span>: a fast-starting scripting environment for Clojure</span></li>
<li><a href="https://github.com/borkdude/clj-kondo">Clj-kondo</a><span>: a linter for Clojure that sparks joy</span></li>
<li><a href="https://github.com/borkdude/sci">Small Clojure Interpreter</a></li>
<li><a href="https://github.com/borkdude/jet">Jet</a><span>: CLI to transform between JSON, EDN and Transit</span></li>
<li><a href="https://github.com/borkdude/edamame">Edamame</a><span>: configurable EDN/Clojure parser with location metadata</span></li>
<li><a href="https://github.com/borkdude/re-find">Re-find</a><span>: find functions using spec</span></li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Talks</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Babashka and GraalVM; taking Clojure to new places - <a href="https://youtu.be/3EUMA6bd-xQ">video</a>, <a href="https://speakerdeck.com/borkdude/babashka-and-graalvm-taking-clojure-to-new-places-at-clojure-nyc-meetup">slides</a> and <a href="https://github.com/borkdude/babashka">code</a><span class="text-muted"> July 11th 2020, Clojure/NYC</span></li>
<li>Babashka and the Small Clojure Interpreter: using Clojure in new contexts - <a href="https://www.youtube.com/watch?v=Nw8aN-nrdEk">video</a>, <a href="https://speakerdeck.com/borkdude/babashka-and-the-small-clojure-interpreter-at-clojured-2020">slides</a> and <a href="https://github.com/borkdude/babashka">code</a><span class="text-muted"> February 2020, ClojureD, Berlin Germany</span></li>
<li>Clj-kondo: a linter for Clojure that sparks joy - <a href="https://www.youtube.com/watch?v=MB3vVREkI7s">video</a>, <a href="https://speakerdeck.com/borkdude/clj-kondo-a-linter-for-clojure-code-that-sparks-joy-at-clojutre-2019">slides</a><a href="https://github.com/borkdude/clj-kondo">code</a><span class="text-muted"> September 27th 2019, ClojuTRE, Helsinki Finland</span></li>
<li>Re-find: discover functions with spec - <a href="https://www.youtube.com/watch?v=Ygrml6tyrq0">video</a>, <a href="https://speakerdeck.com/borkdude/re-find-discover-functions-with-spec">slides</a> and <a href="https://borkdude.github.io/re-find.web/">demo</a><span class="text-muted"> April 6th 2019, Dutch Clojure Days</span></li>
<li>Functional Programming in Practice - <a href="https://github.com/borkdude/fp-hu-may-2016">repo and slides</a><span class="text-muted"> May 9th 2016, Hogeschool Utrecht</span></li><li>Full stack Clojure - <a href="https://github.com/borkdude/full-stack-clojure-han-okt-2015">repo and slides</a><span class="text-muted"> October 1 2015, Hogeschool Arnhem-Nijmegen</span></li>
<li>Functional programming in the browser with ClojureScript - <a href="https://github.com/borkdude/sytac-core-async">repo and slides</a><span class="text-muted"> July 29 2015, <a href="http://www.meetup.com/Sytac-Dev-Jam/events/223330464/">Sytac Devjam</a></span></li>
<li>ClojureScript &lt;3 React - <a href="http://domcode.org/videos/2015/05/26/clojurescript-and-reactjs/">video</a>, <a href="slides/domcode-may-26-2015.pdf">slides</a> and <a href="https://github.com/borkdude/domcode-cljs-react">code</a><span class="text-muted"> May 26 2015, <a href="http://www.meetup.com/DomCode/events/222548762/">DomCode meetup</a></span></li>
<li>Reagent - ClojureScript interface to React - <a href="slides/react-amsterdam-feb-12-2015.pdf">slides</a> and <a href="https://github.com/borkdude/react-amsterdam">code</a><span class="text-muted"> Feb. 12 2015, <a href="http://www.meetup.com/React-Amsterdam/events/220160608/">React Amsterdam</a></span></li>
<li>ClojureScript interfaces to React - <a href="http://vimeo.com/111289716">video</a>, <a href="oredev14/ClojureScript_interfaces_to_React.pdf">slides</a> and <a href="https://github.com/borkdude/oredev2014">code</a> <span class="text-muted"> Nov. 6 2014, <a href="http://oredev.org/2014/speakers/michiel-borkent">Øredev</a>, Malmö Sweden</span></li>
<li>ClojureScript for the web - <a href="http://vimeo.com/111214648">video</a>, <a href="oredev14/ClojureScript_for_the_web.pdf">slides and </a><a href="https://github.com/borkdude/oredev2014">code</a> <span class="text-muted"> Nov. 6 2014, <a href="http://oredev.org/2014/speakers/michiel-borkent">Øredev</a>, Malmö Sweden</span></li>
<li>ClojureScript/Om/Reagent - <a href="http://vimeo.com/109915707">video</a> and <a href="fpamsclj/fpamsclj.pdf"> slides </a><span class="text-muted">Oct. 16 2014, FP AMS, Amsterdam Netherlands</span></li><li>Immutable Stack (clojure workshop) - <a href="devnology-immutable-stack-04-10-2014/presentation.html">slides</a> and <a href="https://github.com/borkdude/immutable-webapp">code </a><span class="text-muted">Oct. 10 2014, Devnology, Leusden Netherlands</span></li>
<li><img src="img/dutchflag_14px.jpg"> Clojure introductie - <a href="gastcollege-han-28-05-2014/presentation.html">slides </a><span class="text-muted">Jun. 20 2013, Dec. 19 2013, May 5 2014, Hogeschool Arnhem-Nijmegen Netherlands</span></li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Writings</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li><a href="//jaxenter.com/clojure-alternative-java-169315.html">Clojure: a mature alternative to Java</a></li>
<li><img src="img/dutchflag_14px.jpg"> Artikel in Java Magazine januari 2016: <a href="nljug/18_21_Clojure.pdf">PDF</a>, <a href="https://nljug.org/java-magazine/clojure/">HTML</a></li>
<li><a href="//blog.michielborkent.nl">Blog about Clojure, Clojurescript and Datomic</a></li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Courses</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li><img src="img/dutchflag_14px.jpg"> <a href="clojurecursus/index.html">Clojure lesmateriaal</a> <span class="text-muted">(2012-2013)</span></li>
<li><img src="img/dutchflag_14px.jpg"> <a href="downloads/dotnet-public.zip">Lesmateriaal C# / .NET programmeren</a> <span class="text-muted">(2011-2013)</span></li>
</ul>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Etc.</h3></div>
<div class="panel-body">
<ul class="list-unstyled">
<li><img src="img/dutchflag_14px.jpg"> <a href="https://www.facebook.com/groups/tssnl">The Starch Solution Nederland community</a> <span class="text-muted">(&gt; 2 Aug. 2014)</span></li>
<li><img src="img/dutchflag_14px.jpg"> <a href="//www.eetvoorjeleven.nu">Mijn blog over gezond eten</a><span class="text-muted">(&gt; Aug. 2013)</span></li>
<li><a href="//www.michielborkent.nl/potmwebarchive/index.html">Website of my old band Picture of the Moon</a> <span class="text-muted">(2001-2008)</span> - Music: <a href="https://www.michielborkent.nl/potmwebarchive/www.pictureofthemoon.net/media/mp3/ad">Ageless Day</a>, <a href="https://www.michielborkent.nl/potmwebarchive/www.pictureofthemoon.net/media/mp3/wc">Waxing Crescent</a></li>
<li><a href="mmm/finalthesis.pdf">Final Thesis Music Mind Machine</a>,<a href="mmm/presentatie.pdf">slides</a> and <a href="mmm/drempdemo.html">demo</a> <span class="text-muted">(2005)</span></li>
<li><a href="mmm/stageverslag.pdf">Internship report Music Mind Machine</a>, <img src="img/dutchflag_14px.jpg"> <a href="mmm/presentatie-stage.pdf">presentatie</a> and <a href="mmm/tutorial.html">tutorial</a> <span class="text-muted">(2005)</span></li>
</ul>
</div>
</div>
</div>
<div class="col-md-4">
<p><img alt="Michiel" class="img-responsive" src="img/avatar-zwart-wit.jpg"></p>
<p class="text-right"><a href="//github.com/borkdude"><img alt="View Michiel Borkent's profile on Github" src="//github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="25%"></a></p>
<p class="text-right"><a href="//stackoverflow.com/users/6264/michiel-borkent"><img alt="Stackoverflow" height="58" src="//stackoverflow.com/users/flair/6264.png" title="profile for Michiel Borkent at Stack Overflow, Q&amp;A for professional and enthusiast programmers" width="208"></a></p>
<p class="text-right"><a class="twitter-follow-button" data-align="right" data-show-count="false" data-size="large" data-width="208px" href="https://twitter.com/borkdude">Follow @borkdude</a><script type="text/javascript"></script></p>
</div>
</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions test/dompa/round_trip_test.clj
Original file line number Diff line number Diff line change
@@ -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)))))