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.

90 questions
15
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,764
  • 1
  • 15
  • 20
10
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
  • 26,826
  • 11
  • 67
  • 101
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,379
  • 1
  • 13
  • 24
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
  • 23,123
  • 15
  • 92
  • 146
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
  • 15,230
  • 20
  • 73
  • 91
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
  • 23,843
  • 11
  • 53
  • 92
9
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,087
  • 2
  • 22
  • 27
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,305
  • 4
  • 32
  • 53
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
  • 10,416
  • 9
  • 52
  • 99
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…
pupeno
  • 256,034
  • 114
  • 324
  • 541
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
  • 941
  • 6
  • 17
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
  • 941
  • 6
  • 17
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
  • 163
  • 10
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
  • 5,670
  • 7
  • 39
  • 59
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,402
  • 2
  • 17
  • 45
1
2 3 4 5 6