summaryrefslogtreecommitdiff
path: root/src/dompa/html.cljc
blob: cea7b69085f62220d22f4ce4749c88adb7fb51d7 (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))