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
1
vote
2 answers

How to write the following clojure enlive selector?

I am trying to scrape a website using clojure's enlive library. The corresponding CSS selector is: body > table:nth-child(2) > tbody > tr > td:nth-child(3) > table > tbody > tr > td > table > tbody > tr:nth-child(n+3) I have tested the above…
Rohit
  • 127
  • 1
  • 10
1
vote
1 answer

Use Enlive to match a specific TD tag in a group of TD tags

I am just getting started using Elive for an HTML screen scraping task. If I wanted the text from the second and fourth TD nodes of the following table, how would I specify the selector? I read through the tutorial but didn't find any examples of…
Michael Frederick
  • 297
  • 2
  • 5
  • 12
1
vote
1 answer

Multiple transforms on an html page using enlive

Clojure and enlive are great. In trying to fathom the power of Enlive I'm attempting to apply two transformations to an html page. The HTML page has 2 areas (divs) that I want to transform. The first div in question gets cloned ~16 times. The…
sova
  • 5,468
  • 10
  • 40
  • 48
1
vote
1 answer

How to insert anti forgery token with Clojure Enlive

I try to insert anti forgery token using ring.util.anti-forgery into html form: (html/defsnippet post-edit-form "templates/blog.html" [:.post-edit] [] [:form] (html/after (html/html-content (anti-forgery-field)))) Get…
uNmAnNeR
  • 600
  • 5
  • 12
1
vote
1 answer

Clojure Enlive: Applying snippet on a list

I am trying to define an enlive template for a html table, that shows data from a map. template-div for this example is right here. Dummy content that for the cells in the template is here. defsnippet for cell value and deftemplate are defined…
Vesna
  • 345
  • 2
  • 11
1
vote
1 answer

Enlive templates - how to append script to end of the page

I am adding custom backbone.js scrips to my pages and it needs to be at the end of page, I have viewed the solution for adding scripts to the html head as described here : Enlive templates – add to head section Unfortunately, I need to add scripts…
user193116
  • 3,498
  • 6
  • 39
  • 58
1
vote
0 answers

How do I parse HTML using Enliven?

Here is a parsing example using Enlive. Would there be differences with Enliven? (ns parse.enlive (:require [net.cgrand.enlive-html :as html])) (def ^:dynamic *base-url* "https://news.ycombinator.com/") (defn fetch-url [url] …
leontalbot
  • 2,513
  • 1
  • 23
  • 32
1
vote
1 answer

HTML entities showing up as ? only when served through Jetty

My HTML entities, such as © and mdash; are showing up as ?, both when rendered on the page and when I view the underlying source -- but only when served through my production Jetty server (in the webapps directory). The HTML entities look fine…
David J.
  • 31,569
  • 22
  • 122
  • 174
1
vote
1 answer

Enlive and tags in arbitrary places

Here's the thing with enlive 1.1.5 (source formatting/whitespace changes added for clarity.): blogen.core> (html/sniptest " <span id=\"foo\"/> " …
mike3996
  • 17,047
  • 9
  • 64
  • 80
1
vote
2 answers

Enlive templating - Adding CSS includes to

I'm not sure how I should be approaching this. I have a list of CSS files that I want to feed into something and get HTML back. For example, (list "base.css" "index.css" "more_css.css") ;vector might be more appropriate? should be transformed…
deadghost
  • 5,017
  • 3
  • 34
  • 46
1
vote
1 answer

Clojure: Enlive has selector doesn't return anything

I'm trying to get images inside links from enlive document. The following works: (html/select nodes [:a :img]) But this way I only get the image nodes, I want the links too! So the next step was (html/select nodes [:a (html/has [:img])]) But for…
mikkom
  • 3,521
  • 5
  • 25
  • 39
1
vote
3 answers

enlive remove html tag

I have this html snippet. I want parse that snippet and emit html without javascript tags
lorem ipsum
calvin91
  • 15
  • 4
1
vote
1 answer

Clojure: Template with Enlive

I copied a very basic sample from https://github.com/cgrand/enlive, but it doesn't compile: (ns web.handler (:require [compojure.core :refer :all] [compojure.handler] [compojure.route :as route] [net.cgrand.enlive-html :as…
demi
  • 5,384
  • 6
  • 37
  • 57
1
vote
2 answers

replace-vars in enlive 1.1.4

I have the following html that is loaded into a template... Welcome ${fullname} I have the following selector/action in a template... [:#alert-username] (replace-vars {:fullname (fullname request)}) This is rendered as…
BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
1
vote
1 answer

Clojure: Custom functions inside Enlive selectors?

Here is an example where I use html/text directly inside a selector vector. (:use [net.cgrand.enlive-html :as html]) (defn fetch-url [url] (html/html-resource (java.net.URL. url))) (defn parse-test [] (html/select (fetch-url…
leontalbot
  • 2,513
  • 1
  • 23
  • 32