Questions tagged [hiccup]

Hiccup is a library for representing HTML in Clojure. It uses vectors to represent tags, and maps to represent a tag's attributes.

101 questions
3
votes
1 answer

Change a div color in hiccup

Is there a way I can set a div background color in hiccup? Here is what I tried so far, with no result: [:div {:background-color "#003366"} (escape-html rest)] In the html, I see
which I do not believe is the correct…
Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92
3
votes
1 answer

The data-source property isn't propagated from reagent to the render method of the React Native ListView component

I'm trying to render a React Native ListView in reagent. I have the following snippet: (def data-source (React.ListView.DataSource. #js{:rowHasChanged (fn [a b] false)})) (defn render-row [] [ui/view]) (def rows (clj->js ["whoa",…
eploko
  • 5,347
  • 2
  • 28
  • 23
3
votes
2 answers

Interactive list in Reagent

I want to create a list of html elements (which include the results of a query) which are hidden by default but the user can toggle that state. I have tried a couple different ways below as toy examples but can't get either to work. This code…
wovenhead
  • 144
  • 9
3
votes
1 answer

How to convert HTML tag with style to Hiccup? React problems

I'm trying to parse HTML with CSS into Hiccup in a Reagent project. I am using Hickory. When I parse HTML with inline CSS, React throws an exception. (map as-hiccup (parse-fragment "
test
") ) The…
hzhu
  • 3,759
  • 5
  • 29
  • 39
3
votes
2 answers

Conditionals in Hiccup, can I make this more idiomatic?

Clojure beginner here! I added flash message support to my Hiccup code in a Noir project. What I'm trying to do is check if the message string for each specific was set or not. If there's no message, then I don't want to display the specific flash …
Alexandr Kurilin
  • 7,685
  • 6
  • 48
  • 76
3
votes
1 answer

traversing a vector tree

I want to traverse a vector tree that represents hiccup data structures: [:div {:class "special"} [:btn-grp '("Hello" "Hi")]] Then I want to dispatch on the keyword of the vector, if a multimethod has been defined for the keyword, then it would…
murtaza52
  • 46,887
  • 28
  • 84
  • 120
2
votes
2 answers

Parsing a clojure map of items -> categories-vectors into categorized lists

I have map of item names and vectors of vectors which store categories which the key string item are in. I am trying to parse this map into a couple hiccup defpartials which then can display them organized by category. What I think I need to do is…
Jon Rose
  • 1,457
  • 1
  • 15
  • 25
2
votes
1 answer

How to pretty print a Clojure data structure in HTML?

How to make the following code generate a similar visualization to pprint in HTML? (let [clj-structure {:ui {:selected #{[:A 3]}} …
Jp_
  • 5,973
  • 4
  • 25
  • 36
2
votes
1 answer

How to check for DOM .contains? in clojurescript?

In JS one does document.some_element.contains(other_element) to find whether an element is contained within another. How to do this in Clojurescript/Hiccup/Reagent framework? I have tried: (js/contains some-element another-element) (-> js/contains…
zengod
  • 1,114
  • 13
  • 26
2
votes
1 answer

How to use jHiccup with Solr?

I've tried use Solr with Jhiccup to analyze garbage collectors of Azul zing JVM and G1GC of Java-Hotspot. I launched solr, and want include jHiccup on it. of solr process is 1078. I used following command: ./jHiccup -l…
2
votes
1 answer

How do I access individual fields of a form in Clojure?

I'm building my very first web app, and I am having a hard time accessing individual fields of a form when the user submits the form. Here's what I have: (defroutes app (GET "/" [] homepage) (POST "/city" request display-city) (route/resources…
2
votes
1 answer

Render table element with colspan in Reagent

I have a table in reagent and have set the col-span of a table header = 2. (defn my-table [] [:table.table.table-striped.table-bordered [:thead [:tr [:th "Col1"] [:th "Col2"] (doall (for [id @ids] ^{:key id} …
2
votes
2 answers

Clojure - Hiccup Dropdown menu

I have a Clojure table in Hiccup that is populated from a database. In one column I have status which is set from the database. What I want to do is be able to click on this value, and have a dropdown menu appear where you can pick a new status…
rbb
  • 989
  • 6
  • 19
2
votes
1 answer

Hiccup: How can I render a quotation mark in Reagent?

I am trying to render quotes around text with Hiccup. [:p "I want double quotes around this string"] I tried &qout; to no avail.
hzhu
  • 3,759
  • 5
  • 29
  • 39
2
votes
1 answer

How to use Hickory with Clojurescript (OM/Reagent)?

In my Reagent project, I'm parsing HTML with Hickory and rendering a Hiccup page. The hiccup is rendered. But when I change the page (!reset my view atom), React.js goes crazy because Hickory has generated: [:div (as-hiccup (parse "

HELLO…

hzhu
  • 3,759
  • 5
  • 29
  • 39