hickory.hiccup-utils documentation

Utilities for working with hiccup forms.

class-names

(class-names tag-elem)
Given a well-formed hiccup tag element, return a vector containing
any class names included in the tag, as strings. Ignores the hiccup
requirement that any id on the tag must come
first. Example: :div.foo.bar => ["foo" "bar"].

id

(id tag-elem)
Given a well-formed hiccup tag element, return a string containing
the id, or nil if there isn't one.

normalize-form

(normalize-form form)
Given a well-formed hiccup form, recursively normalizes it, so that it and
all children elements will also be normalized. A normalized form is in the
form
  [tag attributes content1 ... contentN].
That is, an unadorned tag name (keyword, lowercase), all attributes in the
attribute map in the second element, and then any children. Any content
that is a sequence is also expanded out into the main sequence of content
items.

tag-name

(tag-name tag-elem)
Given a well-formed hiccup tag element, return just the tag name as
a string.

tag-well-formed?

(tag-well-formed? tag-elem)
Given a hiccup tag element, returns true iff the tag is in 'valid' hiccup
format. Which in this function means:
   1. Tag name is non-empty.
   2. If there is an id, there is only one.
   3. If there is an id, it is nonempty.
   4. If there is an id, it comes before any classes.
   5. Any class name is nonempty.