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
17
votes
2 answers

How Can I Output an HTML Comment in Compojure/Hiccup?

I'd like my program to output the following HTML: Is there a way to output html comment literals with Hiccup?
Chris Bilson
  • 1,884
  • 1
  • 17
  • 20
12
votes
1 answer

EOF exception while reading clojure file

When I run the web application in the ring jetty server, I got EOF exception, I can't fix this, since there is no clue on which line the error has occurred. I'm using compojure and hiccup on my clojure code. I'm using Emacs 23 as editor. Here is the…
Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
10
votes
3 answers

Idiomatic way of rendering style info using Clojure Hiccup

I need to build style info within hiccup in order to place an element at a location indicated by the variables "top" and "left". My code looks like so: (html [:div {:style (str "top" top ";left" left)} "some text"]) This code is pretty…
drcode
  • 3,287
  • 2
  • 25
  • 29
9
votes
1 answer

how to return a clojure function as a string

is there any way to return a clojure function as a string? I am making some online documentation and I would really like to be able to add code into the html by somehow evaluating a function into text. thanks
Jon Rose
  • 1,457
  • 1
  • 15
  • 25
9
votes
1 answer

hiccup 1.0.0-beta1 error

I'm creating a compojure project using hiccup-1.0.0-beta1. I get the following stack trace when I run lein ring server-headless: Caused by: java.lang.IllegalAccessError: defelem does not exist at clojure.core$refer.doInvoke(core.clj:3287) at…
Kevin
  • 24,871
  • 19
  • 102
  • 158
9
votes
5 answers

Clojure web framework for designers/ front end devs

All of the popular Clojure web frameworks I am seeing use hiccup to generate HTML. I find hiccup is hard to have a front end design person adjust to, compared to other frameworks that parse the syntax out of templates. Is there a clojure web…
Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92
9
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…
Jack Liu Shurui
  • 540
  • 1
  • 5
  • 14
9
votes
1 answer

Pagination in Clojure

Is there anything equivalent to will_paginate for noir/hiccup? How do people usually paginate with noir/hiccup? Thank you
Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
8
votes
4 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…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
7
votes
2 answers

Composing templates with Hiccup and Compojure

I'm relatively new to Clojure and Compojure web development. The first issue that I've noticed in the toy example that I'm building is that of HTML templating. I'd like to have support for something like partials in Rails, or the templating…
Jack Slingerland
  • 2,651
  • 5
  • 34
  • 56
6
votes
2 answers

Using Compojure, Hiccup and Ring to upload a file

To upload a file to a server I'm writing in Clojure I need a client form that looks something like this:
justinhj
  • 11,147
  • 11
  • 58
  • 104
6
votes
2 answers

Automatically escaping HTML with Hiccup, is it possible?

I just tried this with Hiccup: (hiccup.core/html [:h1 ""]) and to my surprise I got an alert box, Hiccup is not escaping strings by default. I see that there's a method to escape strings, but in my opinion if it's not…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
6
votes
1 answer

CSS fails with extended paths in Compojure / Hiccup

I've been converting some Noir websites to Compojure. I have a function here that creates the layout of the page: (defn layout [title & content] (html5 [:head [:title "My Site | " title] (include-css "css/main.css") [:body …
dizzystar
  • 1,055
  • 12
  • 22
6
votes
2 answers

Clojure: Dynamically create functions from a map -- Time for a Macro?

I have a function that begins like this: (defn data-one [suser] (def suser-first-name (select db/firstNames (fields :firstname) (where {:username suser}))) (def suser-middle-name (select…
dizzystar
  • 1,055
  • 12
  • 22
5
votes
2 answers

How do I embed javascript in clojure Hiccup?

I'm writing a webserver app in clojure with Hiccup (and other things). I'm trying to have a check-box enable and disable two drop-down fields with a little JS but I can't make it work. [:head [:script "function toggleText(cb, t1, t2) { …
Kingfranz
  • 184
  • 1
  • 12
1
2 3 4 5 6 7