summaryrefslogtreecommitdiff
path: root/src/dompa
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2025-09-20 20:25:34 +0300
committerAsko Nõmm <asko@nmm.ee>2025-09-20 20:25:34 +0300
commit5f163f2b62613368714d8a1e8b342daaac0f89d5 (patch)
tree1e7a557002c24a9d78e1dd575ec3c03d0958459a /src/dompa
parent9f31cc6a5aae83f7986e733603e62e91eae31196 (diff)
Fix issue with node name capture, add another test case.
Diffstat (limited to 'src/dompa')
-rw-r--r--src/dompa/coordinates.cljc2
-rw-r--r--src/dompa/html.cljc10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/dompa/coordinates.cljc b/src/dompa/coordinates.cljc
index 3584dc9..abaf233 100644
--- a/src/dompa/coordinates.cljc
+++ b/src/dompa/coordinates.cljc
@@ -149,7 +149,7 @@
(if (str/starts-with? html "<")
(->> (subs html 1)
(take-while #(not (contains? #{\space \>} %)))
- (reduce str)
+ (apply str)
keyword)
:dompa/text))
diff --git a/src/dompa/html.cljc b/src/dompa/html.cljc
index 6268fa0..cea7b69 100644
--- a/src/dompa/html.cljc
+++ b/src/dompa/html.cljc
@@ -6,12 +6,14 @@
"Transform a `html` string into a vector of coordinates
indicating where an HTML node ends and begins."
[html]
- (->> coordinates/compose
- (coordinates/unify 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]
- (->> (->coordinates html)
- (coordinates/->nodes html))) \ No newline at end of file
+ (-> html
+ ->coordinates
+ coordinates/->nodes)) \ No newline at end of file