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]
90 questions
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"]
![](../../users/profiles/1332608.webp)
Henry Zhu
- 3,443
- 5
- 24
- 36
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…
![](../../users/profiles/1150027.webp)
ndrw
- 763
- 6
- 15
5
votes
3 answers
Is there a parser for html to hiccup structures?
I'm looking for a function that reverses clojure hiccup
so
turns into
[:html]
etc.
Following up from the answer by @kotarak, This now works for me:
(use 'net.cgrand.enlive-html)
(import 'java.io.StringReader)
(defn…
![](../../users/profiles/1291986.webp)
zcaudate
- 13,076
- 7
- 52
- 105
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…
![](../../users/profiles/1018110.webp)
kfk
- 801
- 2
- 10
- 23
4
votes
2 answers
What is :<> in reagent hiccup?
I don't understand the tag ":<>" in the following code
clojure re-frame todomvc
(defn todo-app
[]
[:<>
[:section#todoapp
[task-entry]
(when (seq @(subscribe [:todos]))
[task-list])
[footer-controls]]
[:footer#info
[:p…
![](../../users/profiles/1101691.webp)
Jack Liu Shurui
- 439
- 5
- 11
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…
![](../../users/profiles/62225.webp)
Sean Hagen
- 742
- 8
- 27
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…
![](../../users/profiles/4443110.webp)
sakh1979
- 109
- 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…
![](../../users/profiles/226473.webp)
Ramy
- 17,760
- 36
- 94
- 141
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…
![](../../users/profiles/1119333.webp)
chirag ghiyad
- 680
- 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…
![](../../users/profiles/1018110.webp)
kfk
- 801
- 2
- 10
- 23
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 …
![](../../users/profiles/602323.webp)
Kevin
- 23,123
- 15
- 92
- 146
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…
![](../../users/profiles/849986.webp)
Clarice Bouwer
- 3,072
- 2
- 25
- 46
3
votes
1 answer
Render async script tag with hiccup
How would I render an async script tag in hiccup?
![](../../users/profiles/1327651.webp)
nha
- 16,039
- 11
- 76
- 108
3
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…
![](../../users/profiles/1841754.webp)
Oskar Skuteli
- 593
- 4
- 14
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…
![](../../users/profiles/198927.webp)
Petrus Theron
- 25,051
- 30
- 137
- 263