Liking cljdoc? Tell your friends :D

hickory.hiccup-utils

Utilities for working with hiccup forms.

Utilities for working with hiccup forms.
raw docstring

class-namesclj/s

(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"].

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"].
sourceraw docstring

idclj/s

(id tag-elem)

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

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

normalize-formclj/s

(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.

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.
sourceraw docstring

tag-nameclj/s

(tag-name tag-elem)

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

Given a well-formed hiccup tag element, return just the tag name as
a string.
sourceraw docstring

tag-well-formed?clj/s

(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.
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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close