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
0
votes
1 answer

Should a doall Clojure function be used with a reduce call?

I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project. I am new to Clojure. At some point in the codebase there is a big use of doall command…
Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
0
votes
1 answer

Adding unique key to li tag in Clojure and Hiccup using a word and index as key

I have a quick question. I'm working on a Clojure project. I want to add unique key to each li tag, like this: (defn test [text] [:li {:key :index} text]) How I can set keys like "hi+index"? I tried {:key (str "hi" index)} but it does not…
niloofar
  • 2,244
  • 5
  • 23
  • 44
0
votes
0 answers

How do I make text within a container centered instead of floating at the top?

I have a container with two columns, an image on the left and text on the right (I'm making a landing page based on the one from ClojureBridge London). Right now the text is at the top of the column. How do I bring it down to the middle? (I'm…
JohnBradens
  • 119
  • 8
0
votes
1 answer

How do I make a clickable image in Clojure with Hiccup

Right now I have a logo and then a link to the homepage. I want to combine them so that someone can click the logo and be directed to the homepage. I can't figure out how to do this with Hiccup. [:div.navbar-brand [:img {:src…
JohnBradens
  • 119
  • 8
0
votes
2 answers

How to generate Hiccup structures conditionally?

I have a bunch of maps that describe locations: (def pizzeria { :LocationId "pizzeria" :Desc "Pizzeria where Timur works" :Address "Vorgartenstraße 126, 1020 Wien" :Comment "" }) (def dancing-school { :LocationId…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
0
votes
1 answer

How to create a Clojure function that returns a Hiccup structure?

Imagine I want to write a Clojure function that returns a Hiccup structure equivalent to

Hello

. How can I do it? I tried (defn render-location-details [cur-location] (let [] (list :h3 "Hello") ) ) and (defn…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
0
votes
0 answers

Idiomatic way to include style section to HTML using hiccup

I am working on transactional email like the responsive html email template. If I have the CSS in the file public/css/email.css, what is the most idiomatic way to include the contents of the email.css in the header of html file? Note that I do not…
user1135541
  • 1,781
  • 3
  • 19
  • 41
0
votes
1 answer

Clojure hiccup vanishing key namespaces

I'm printing out a map's key values to html, and the key namespaces are vanishing, which I don't want. layout below calls hiccup's html5 to render: (layout (str "Path " (:path/title path)) [:h1 "Title: " (:title path) slug] [:p (str path)] …
mwal
  • 2,803
  • 26
  • 34
0
votes
0 answers

JavaScript data into HTML

I'm looking for a particular JS library that turns hiccup-like data such as ['a', { href: 'https://example.com' }, 'Example'] into the corresponding HTML string: 'Example' IIRC, this library is quite popular…
Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115
0
votes
1 answer

Pause in the middle of a Clojure doseq function?

My program allows users to select files to import into a database. Before now, it only allowed them to import one file at a time. Letting them import more than one file at a time is easy. But the problem I have is that if the database already…
clartaq
  • 5,320
  • 3
  • 39
  • 49
0
votes
1 answer

SC_MONITORPOWER starts background tasks

Summary When putting the monitor in sleep mode in Windows 10, Windows seems to execute some tasks that don't get executed with the screen on. This is interfering with our software, and we need to get rid of it. Ful story For a hardware device with a…
0
votes
1 answer

Why can’t compojure-app and hiccup import function hiccup.form/form-to?

I use "lein new compojure-app" to create a web project, hiccup has been already imported in project.clj: :dependencies [[org.clojure/clojure "1.8.0"] [compojure "1.5.2"] [hiccup "1.0.5"] and I can see the jar file I use…
wang kai
  • 1,673
  • 3
  • 12
  • 21
0
votes
1 answer

how to host my hiccup clojure project on tomcat?

I have a clojure project in which i used the hiccup library. I want to ask does it work in a similar way as normal clojure and jsp projects ? When i am hosting it on a tomcat server and trying to run it on the web, file not found error comes. this…
N.Singh
  • 53
  • 4
0
votes
1 answer

Clojure: How can I get the value of a text field when clicking a button created using Hiccup?

In my Clojure program (using Hiccup), I'm looking to get the value of a text field when a user clicks on a button, and then append that date to a URL. I've attempted to use "ng-model" from AngularJS, however this results in the following…
podomunro
  • 495
  • 4
  • 16
0
votes
1 answer

How to add defer to script tag in hiccup?

I would like to add a defer attribute to a script tab in hiccup. But things like [:script {:src "main.js" :defer}] return an error, and forms like [:script {:src "main.js"} :defer] insert "defer" in the middle of the script opening and closing…
xav
  • 4,101
  • 5
  • 26
  • 32