-
Book Overview & Buying
-
Table Of Contents
The Clojure Workshop
By :
Hiccup is a library for representing HTML in Clojure. In Activity 6.01, Generating HTML from Clojure Vectors, you implemented a simplified version of Hiccup. As you'll remember, Hiccup uses:
In a Hiccup vector, the first element is a keyword that specifies the corresponding HTML element:
:div for a <div> tag:span for a <span> tag:img for a <img> tagIn Hiccup, an empty <div> is represented by [:div].
The second element is an optional map that represents the element's attributes where the names of the attributes follow the kebab-case convention: we separate the words with one underscore character (on-click instead of onClick).
For example, [:div {:class "myDiv"}] represents <div class="myDiv"></div>.
Notice that in HTML, the style attribute is a string...