kuhumcst / hiccup-tools

Navigate and manipulate Hiccup documents.
1 stars 0 forks source link

get-in #3

Open simongray opened 1 day ago

simongray commented 1 day ago

Basically, it would have the same interface as the get-in of Clojure Core, but the behaviour of the existing get in this library where the coll of ks represents ancestry.

This would rely on a matcher function for ancestry, e.g. maybe called ancestors + a generic matcher for the node itself.

It would also be great to have a similar pair for selecting nodes based on descendants, e.g. a descendants matcher + a generic matcher. However, I'm not sure what to call it since there is no real equivalent in Clojure Core.

simongray commented 1 day ago

Another way around it would be to simply extend the functionality of the existing hiccup matcher to match layers of children as descendants. That way it would be obvious that the outer element is the one selected.

simongray commented 1 day ago

For selecting unknown elements, we will need a universal matcher, maybe change the default of no-argument any to (constantly true) rather than (constantly false)?