Comments (3)
It looks like the example is outdated. Here's a new version:
(ns net.cgrand.enlive-html.examples
(:use [net.cgrand.enlive-html :as html :only [clone-for deftemplate at content set-attr attr? strict-mode substitute]] :reload))
(deftemplate microblog-template "net/cgrand/enlive_html/example.html"
[title posts]
[:title] (content title)
[:h1] (content title)
[:div.no-msg] (if (empty? posts)
identity
(substitute nil))
[:div.post] (clone-for [{:keys [title body]} posts]
[:h2 :a] (content title)
[:p] (content body))
[[:a (attr? :href)]] (set-attr :title "it's a link"))
(defn render
[nodes]
(apply str nodes))
(comment
(render (microblog-template "Hello user!"
[{:title "post #1"
:body "hello with dangerous chars: <>&"}
{:title "post #2"
:body "dolor ipsum"}])))
It will yield following html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Hello user!</title>
</head>
<body>
<h1>Hello user!</h1>
<div class="post">
<h2><a title="it's a link" href="http://cgrand.net/">post #1</a></h2>
<p>hello with dangerous chars: <>&</p>
</div><div class="post">
<h2><a title="it's a link" href="http://cgrand.net/">post #2</a></h2>
<p>dolor ipsum</p>
</div>
</body>
</html>
from enlive.
ok, fixed and merged to upstream: 053884e
could anyone please close the issue? I don't really have rights to do so //cc @cgrand @vemv
from enlive.
Awesome, thank you. Glad to see Enlive active again!
from enlive.
Related Issues (20)
- Automated CSS selector translation to vector form HOT 5
- [org.jsoup/jsoup "1.8.3"] exists HOT 1
- Make JSoup the default for enlive 1.2 HOT 1
- StackOverflowError when parsing certain html HOT 4
- Composable selector/transform in snippet HOT 1
- Simple variable substitution (with example) in meta tag throwing NullPointerException HOT 2
- Less obscure error messages
- first-child
- End tag for <col> violates the specs
- javax.net.ssl.SSLHandshakeException while trying to reach some resources HOT 1
- attribute matching inside at-form HOT 1
- "safe write" "feature" in IntelliJ prevents auto-reloading of namespace depending on changed HTML
- Removing element cleanly HOT 2
- Is this project dead? HOT 1
- Update jsoup dependency to v1.11.3+
- Setting HTTP headers HOT 1
- Broken wiki link in project description
- HTML resource not found
- Any interest in CSS-style selector syntax option? HOT 1
- [BUG] Some tags are loosing part of their content when selected.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enlive.