summaryrefslogtreecommitdiff
path: root/src/dompa/html.cljc
blob: 13bd9e60b0c1dda0bdaf28553f694531574491d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(ns dompa.html
  (:require
   [dompa.coordinates :as coordinates]))

(defn ->coordinates
  "Transform a `html` string into a vector of coordinates
  indicating where an HTML node ends and begins."
  [html]
  (->> html
       coordinates/compose
       coordinates/unify))

(defn ->nodes
  "Transform a `html` string into a tree of nodes,
  each representing one HTML node and its children."
  [html]
  (-> html
      ->coordinates
      coordinates/->nodes))