summaryrefslogtreecommitdiff
path: root/src/dompa/html.cljc
blob: 6268fa0d092fc8144e47c5566d3ccb9764bd66f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(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]
  (->> coordinates/compose
       (coordinates/unify html)))

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