Questions tagged [enlive]

Enlive is a Clojure library for HTML/XML extraction, transformation, and templating.

Enlive is a Clojure library for HTML/XML extraction and transformation.

Links:

89 questions
15
votes
3 answers

How to use selector negation (but ...) in Enlive on a more complex HTML snippet?

I have got an HTML snippet similar to:

Jochen Rau
  • 390
  • 1
  • 6
9
votes
1 answer

Enlive - Extract content of tag if attribute has designated value

I am trying use Clojure and Enlive to extract content of p html tag under condition that one of attributes has values I designated. Something like this

Some content I want to extract

So I want to get Some content I…
Vuk Stanković
  • 7,864
  • 10
  • 41
  • 65
9
votes
2 answers

How do I use snippets in enlive?

I'm a Rails dev getting my feet wet in Clojure. I'm trying to do something which was very simple with ERB but I can't for the life of me figure it out in enlive. Say I have a simple layout file for a website in layout.html:
Chris Bui
  • 1,055
  • 1
  • 13
  • 24
8
votes
1 answer

Parsing snippets of html with enlive

Why does the following snippet does not work? (html/select (:body (client/post "http://www.web.onpe.gob.pe/modElecciones/elecciones/elecciones2011/2davuelta/onpe/presidente/extras/provincias.php" {:form-params {"elegido" "010000"}})) [:option]) Do…
PuercoPop
  • 6,707
  • 4
  • 30
  • 40
7
votes
1 answer

Clojure web frameworks for responsive apps

I have recently inherited a non-finished web app written in Clojure, based on compojure and hiccup basically. It's a bad attempt to model some sort of MVC with OO style not in the FP style as seen here . So I bet to re-start the project almost from…
Jaime Agudo
  • 8,076
  • 4
  • 30
  • 35
6
votes
3 answers

Selector based html templating library for Java similar to Enlive

Is anyone aware of a template library for java similar in nature to Enlive? The concept of using plain html for pages, without any markup inside, and to use the equivalent of CSS selectors to populate the page with dynamic data seems pretty good to…
Marko
  • 30,263
  • 18
  • 74
  • 108
5
votes
1 answer

With enlive, how do you get the tag of a link based off of its content?

I've got some html that looks like this: text How do I get the a by using a selector that says "find any link with a content of text"? I've learned about text-pred, but that just returns…
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
4
votes
1 answer

Clojure, using Enlive to extract raw HTML from a selector?

I need to retrieve some some raw HTML from a certain part of an HTML page. I wrote the scraper and it grabs the appropriate div, but it returns a map of tags. (:use [net.cgrand.enlive-html :as html]) (defn fetch-url [url] (html/html-resource…
kush
  • 16,408
  • 17
  • 48
  • 65
4
votes
1 answer

Extracting consecutive html fragments with enlive

I need to scrape html that has the following form:

Headline1

Text1
Text2
Text3

Headline2

Text4
Text5

Headline3

Majnu
  • 524
  • 4
  • 14
4
votes
1 answer

Clojure Enlive: How to convert enlive nested map data back into HTML?

I am writing a scraper for a site, and the goal is to create a reformatted version of the site. As part of the scraping, I dive into some comments, which might contain html formatting, so that we have: {... :content ("And, in a lower voice, \"Is…
liamdalton
  • 239
  • 1
  • 7
4
votes
2 answers

How to use enlive's clone-for with an HTML template to remove dummy child elements

See this google groups topic Several people have expressed confusion with using clone-for to insert a list of dynamically generated elements into a template which includes several dummy elements. For example, maybe the template looks like…
Johnny Brown
  • 1,000
  • 11
  • 18
4
votes
1 answer

clojure, enlive, multi-site

Trying to load a particular template based on what :server-name returns in the request: (ns rosay.views.common (:use noir.core) (:require [noir.request :as req] [clojure.string :as string] [net.cgrand.enlive-html :as…
battlemidget
  • 249
  • 1
  • 4
  • 15
4
votes
2 answers

Binding a local var in deftemplate for enlive

I'm brand new to clojure and the web development stack. I'm trying to use enlive to set values in an HTML template: (en/deftemplate project-main-page (en/xml-resource "project-main.html") [id] [:#project-name] (en/content (str "Name: "…
DCWoods
  • 123
  • 4
4
votes
2 answers

Clojure: How do you transform a lazyseq of map entries into a structmap?

I'm new to clojure and have been working with enlive to transform text nodes of html documents. My end goal is to convert the structure back into html, tags and all. I'm currently able to take the structmap returned by enlive-html/html-resource and…
jmw
  • 327
  • 1
  • 2
  • 14
4
votes
1 answer

Broken links when deploying Clojure webapps to Jetty with relative links and non-root context path

I've been experimenting with writing webapps in Clojure, and it's been pretty easy until now. I followed Chas Emerick's excellent screencast starting clojure and got an url shortener up and running pretty quickly. Next I wanted to be able to deploy…
corvuscorax
  • 5,850
  • 3
  • 30
  • 31
1
2 3 4 5 6