Hiccup is a library for representing HTML in Clojure. It uses vectors to represent tags, and maps to represent a tag's attributes.
Questions tagged [hiccup]
101 questions
5
votes
1 answer
How to prevent HTML escaping in Clojure Reagent (Hiccup like)
I am using ClojureScript Reagent. Which provides hiccup-like HTML generation.
I have a String with HTML:
(def code "hello world")
When passed to Hiccup it will be escaped and I get no bold text on my page:
[:div code]
How to pass code to my…

Witek
- 6,160
- 7
- 43
- 63
5
votes
3 answers
Garden Generated Inline-styles in Reagent's Hiccup
In reagent, one can specify inline CSS styles like this:
[:div {:style {:border "1px solid red"}} "My Text"]
garden can make such CSS properties containing several values in a list more generic. Vectors for comma separated lists and nested vectors…

Anton Harald
- 5,772
- 4
- 27
- 61
5
votes
1 answer
How can I parse string into Hiccup?
How can I parse a string of Hiccup into a Hiccup node?
For example,
"[:b 'hello world']" into [:b "hello world"]

hzhu
- 3,759
- 5
- 29
- 39
5
votes
3 answers
How can I pass edn to clojurescript from clojure without making ajax request (i.e. via hiccup-generated page)
I'm developing RIA with clojure and clojurescript. Backend uses hiccup to generate a resulting html, like
(html5
[:head
(include-js "/js/my-cljs-generated.js")]
[:body ... ])
How can I pass edn(hashmap, vector, etc.) to clojurescript within the…

ndrw
- 773
- 7
- 15
4
votes
3 answers
Clojure use of (for) with hiccup and noir
I am using clojure and hiccup (with noir) and I have this code:
(defn dataframe [id]
(db/db-to-data id))
(defpartial drop-downs [nms]
(for [nm (keys nms)] (drop-down nm (get nms nm))[:br])
(submit-button "Refresh")
)
(defpage…

kfk
- 831
- 2
- 12
- 25
4
votes
3 answers
How to get index for an item in reagent
When I iterate over vector in Reagent, like this:
(for [item ["rattata" "pidgey" "spearow"]]
[:li item])])
I would like to get index of a specific item - like this:
[:li item index]
I'm not asking about general clojure 'for', because another…

Oskar Skuteli
- 648
- 6
- 16
4
votes
1 answer
Clojure: zipper -> html
After a few days of trying to wrap my brain around zippers, I think I finally understand how to create them from sequential data.
However, after searching for a few days, I can't seem to find any resources on how convert a zipper into something…

Sean Hagen
- 752
- 10
- 30
4
votes
2 answers
Clojure (Hiccup): How can I know which submit button got pressed in a form?
I have a form, using hiccup framework. It looks like this:
(form-to {:enctype "multipart/form-data"}
[:post "/add-data"]
...
(submit-button {:class "btn"} "Save")
(submit-button {:class "btn} "Clone"))
How do I know which submit button…

sakh1979
- 119
- 8
4
votes
1 answer
hiccup form-helper with compojure
Exception: Exception in thread "main" java.io.FileNotFoundException: Could not locate hiccup/form_helpers__init.class or hiccup/form_helpers.clj on classpath:
I'm trying to get a toy compojure app up and running. The original app was from CloudBees…

Ramy
- 20,541
- 41
- 103
- 153
3
votes
2 answers
hiccup code not responding without (do (html5 at each level
I am not able to run inner [:tr] without (do (html5 ..)) when i am using nested let statement having for loop.
(defpartial column-settings-layout [& content]
(html5
[:head
[:title "my-noir-proj"]
(include-css…

chirag ghiyad
- 690
- 1
- 6
- 14
3
votes
1 answer
Clojure: Hiccup form-handler
I am implementing a simple drop-down using hiccup:
;DATASET/CREATE
(defn get-cols-nms [table]
"This function gets the list of columns of a specific table".
(do (db/cols-list table)))
(defpartial form-dataset [cols-list]
(text-field…

kfk
- 831
- 2
- 12
- 25
3
votes
1 answer
clojure/compojure/hiccup NullPointerException
The stack trace I have does not contain any reference to my code. I'm not sure how to begin finding out what might be wrong here:
LazySeq.java:47 clojure.lang.LazySeq.sval
LazySeq.java:56 clojure.lang.LazySeq.seq
Cons.java:39 …

Kevin
- 24,871
- 19
- 102
- 158
3
votes
1 answer
How do I add a click event to trigger a JavaScript event in ClojureScript using Reagent Hiccup
I have just started using Reagent and am very new to Clojure.
I have created a mobile menu function and want the mobile hamburger menu to be clickable in order to show the actual menu. When clicked on again, the menu must hide. I have no idea how to…

Clarice Bouwer
- 3,631
- 3
- 32
- 55
3
votes
1 answer
Render async script tag with hiccup
How would I render an async script tag in hiccup?

nha
- 17,623
- 13
- 87
- 133
3
votes
1 answer
How to conditionally unroll Hiccup data structures in Clojure
How to elegantly render a conditonal list of menu items in Clojure's Hiccup-like data structures? My templating function ends up littered with calls to into and does not read naturally.
Desired result:
[:div.menu
[:div.item "Home"]
[:div.item…

Petrus Theron
- 27,855
- 36
- 153
- 287