On Jun 27, 3:16 am, Christophe Grand christo...@cgrand.net wrote:
Indeed. Fixed.
user= (html-resource (java.io.StringReader. !-- o noes a comment
--htmlheadtitlet/title/headbodyh1h/h1/body/html))
({:type :comment, :data o noes a comment } {:tag :html, :attrs nil,
:content [{:tag :head,
On Jul 1, 3:45 pm, cody c...@koeninger.org wrote:
The use case for this is inserting sub-templates, e.g. site-wide
common sidebars, footer, etc. Or do you see an alternate way to
accomplish that goal?
Eh, looks like I need to read earlier in the thread, apologies for the
noise, and thanks
On Wed, Jul 1, 2009 at 11:42 PM, cody c...@koeninger.org wrote:
On Jul 1, 3:45 pm, cody c...@koeninger.org wrote:
The use case for this is inserting sub-templates, e.g. site-wide
common sidebars, footer, etc. Or do you see an alternate way to
accomplish that goal?
Eh, looks like I
On May 6, 12:36 am, Christophe Grand christo...@cgrand.net wrote:
Hello Ryan,
rzeze...@gmail.com a écrit : Either I've missed something, orEnlive*appears*
to have problems
handling comment tags.
Indeed. I pushed a fix, please tell me whether it works for you now.
Thanks for the
Hi Cody!
On Sat, Jun 27, 2009 at 8:47 AM, cody c...@koeninger.org wrote:
Maybe unrelated, but
=(html-resource (java.io.StringReader. !-- o noes a comment --
htmlheadtitlet/title/headbodyh1h/h1/body/html))
({:type :comment, :data o noes a comment })
Not the result I would expect.
On May 6, 1:36 am, Christophe Grand christo...@cgrand.net wrote:
Hello Ryan,
rzeze...@gmail.com a écrit : Either I've missed something, orEnlive*appears*
to have problems
handling comment tags.
Indeed. I pushed a fix, please tell me whether it works for you now.
Thanks for the
Seems to be working great now.
On Wed, May 6, 2009 at 1:36 AM, Christophe Grand christo...@cgrand.netwrote:
Hello Ryan,
rzeze...@gmail.com a écrit :
Either I've missed something, or Enlive *appears* to have problems
handling comment tags.
Indeed. I pushed a fix, please tell me whether
Either I've missed something, or Enlive *appears* to have problems
handling comment tags.
I was using Enlive against an already existing HTML file and kept
getting the following exception (please note it is HTML 4.01 Strict
and passed validation):
java.lang.RuntimeException:
Hello Ryan,
rzeze...@gmail.com a écrit :
Either I've missed something, or Enlive *appears* to have problems
handling comment tags.
Indeed. I pushed a fix, please tell me whether it works for you now.
Thanks for the report.
Christophe
--
Professional: http://cgrand.net/ (fr)
On Clojure:
select, snippet, at and template are macro sugar. If you _really_ want
to use first-class selectors then you'll have to deal directly with
states machines and use at*, select* and snippet* (I'm going to improve
their usability).
While selectors aren't first class, they can be parametrized (as
Updating to reflect last changes:
(def snipgets
(let [divs (select (html-resource widget.html)
[[:div (attr? :tiptree:widget)]])]
(into {}
(for [div divs]
[(- div :attrs :tiptree:widget)
(snippet div [root]
[widget]
[:div.value]
Wow, thanks for the guidance, Enlive is improving at a rapid clip! ;)
On Friday, April 17, 2009, Christophe Grand christo...@cgrand.net wrote:
Updating to reflect last changes:
(def snipgets
(let [divs (select (html-resource widget.html)
[[:div (attr? :tiptree:widget)]])]
Tom,
The redesign is nearly over (at least from a user standpoint), you may
want to check it http://github.com/cgrand/enlive/tree/right
Christophe
Tom Hickey a écrit :
Hi Christophe,
I keep running into the same problem with elements getting replaced.
I'm trying to set the content of an
Because predicates in selectors no longer need to be quoted it seems you
can't use Enlive selectors in a first class way with snippets:
(let [aselector [[:div (attr= :tiptree:widget widgetA)]]]
((snippet widget.html aselector
[some-map]
[:div.value] (content foo)) {}))
I believe this
On second thought, this is actually not that critical for what I'm trying to
accomplish, and I'm not sure yet if I'll ever use such a feature. Macros
that define snippets will probably suffice.
(deftemplate my-app6 app2.html
[widgets]
[[:div (attr? :tiptree:replace)]]
(fn [node]
(let
David Nolen a écrit :
Sorry to bombard but I couldn't get attr? or attr= to work inside the
selector:
(deftemplate my-app4 app.html
[widgets]
[:div '(attr? :tiptree:replace)] (content bar))
(apply str (my-app4 {}))
(deftemplate my-app4 app.html
[widgets]
[[:div '(attr?
David Nolen a écrit :
One early thought, would you like me to extend the number of examples?
I'm really getting into the nitty gritty of what's possible with
Enlive and it would be nice to have a relatively informative list of
possibilities distributed with the library vs. the single
Hello David,
David Nolen a écrit :
Considering the above, I'm left wondering if it's possible to further
eliminate these redundancies and make templates more reusable. I'm not
sure if this is what you had in mind for Enlive, but allowing
templates to be created without references to files
I pushed do-, attr=, attr? and snippets values as source to github
http://github.com/cgrand/enlive/commits/right
Christophe Grand a écrit :
Hello David,
David Nolen a écrit :
Considering the above, I'm left wondering if it's possible to further
eliminate these redundancies and make
Great! I will play around with the new features and returns with some more
informed feedback ;)
On Tue, Apr 14, 2009 at 9:58 AM, Christophe Grand christo...@cgrand.netwrote:
Hello David,
David Nolen a écrit :
Considering the above, I'm left wondering if it's possible to further
eliminate
One early thought, would you like me to extend the number of examples? I'm
really getting into the nitty gritty of what's possible with Enlive and it
would be nice to have a relatively informative list of possibilities
distributed with the library vs. the single example that's in there right
now
I'm just starting out on Enlive - any examples added would be welcome.
I'll also accumulate some documentation as I go through the learning
curve.
Thanks, Adrian.
On Wed, Apr 15, 2009 at 5:05 AM, David Nolen dnolen.li...@gmail.com wrote:
One early thought, would you like me to extend the
Sorry to bombard but I couldn't get attr? or attr= to work inside the
selector:
(deftemplate my-app4 app.html
[widgets]
[:div '(attr? :tiptree:replace)] (content bar))
(apply str (my-app4 {}))
(deftemplate my-app4 app.html
[widgets]
[[:div '(attr? :tiptree:replace)]] (content bar))
(apply
This is great. I had thought that supporting some kind of partial template
thing would be interesting, but that's actually just my poor logic at work
;)
It seems like with the new version of Enlive I could do something like this:
(deftemplate pageA-template path
[]
[[:div (attr?
Real quick thought:
(deftemplate-generator template-generator
[args]
rule-vector transform-fn)
Would produce a template generator.
(def template-name (template-generator path-to-xml-or-file-or-xml-string))
Would produce a real template.
(apply str (template-name arg1 arg2 arg3))
Hi Christophe,
I keep running into the same problem with elements getting replaced.
I'm trying to set the content of an element with raw html (from a
snippet) and unable to avoid both 1) the html getting escaped and 2)
the element getting replaced. I can avoid one or the other, via
escaped or
Hi Tom,
I'm sorry for this misfeature and, rejoice, it's gone from the ongoing
redesign, there's now an explicit 'content function.
The tildes are gone too!
Christophe
Tom Hickey a écrit :
Hi Christophe,
I keep running into the same problem with elements getting replaced.
I'm trying to
Phil Hagelberg a écrit :
But I did notice you have the use test-is line commented out in the
implementation; it seems a bit unfortunate to have to uncomment that to
run the tests and hope you remember to re-comment it before you commit.
The last commit was during the transition to
Hi Phil!
Phil Hagelberg a écrit :
I'm using the Enlive library, and so far I've been pretty impressed. The
way it separates templates out into their own files and doesn't allow
any logic to get mixed up with them is great.
Thanks for the kind words.
One thing I noticed is that its
Phil Hagelberg a écrit :
From what I can tell the difference seems to be that it goes inside the
node if it's a string, and it replaces the node if it's a function call,
even if the function call results in a string.
This behaviour seems really strange. I feel like maybe there's some
logic
Christophe Grand christo...@cgrand.net writes:
I'm not quite happy with this behavior: I wanted to preserve the
brevity of setting content from a parameter without resorting to (text
my-parameter) but it makes things too irregular. This feature will
certainly go away as I'm planning a
Phil Hagelberg a écrit :
I notice you use with-test to mix your tests in together with your
implementation. This seems to be less common than storing the tests in
their own file; I'm wondering if you are happy with this approach? One
advantage of keeping things in their own file is that it's
Christophe Grand christo...@cgrand.net writes:
I see two advantages to using with-test:
* documentation/usage examples as you pointed out,
Actually I meant that it's nicer for documentation to have the tests in
a separate file since when you're trying to learn how to use the library
I'm using the Enlive library, and so far I've been pretty impressed. The
way it separates templates out into their own files and doesn't allow
any logic to get mixed up with them is great.
One thing I noticed is that its templates escape all strings passed to
them. In my case I have some
Hi Phil,
Regarding your first question, you can use (net.cgrand.enlive-html/
escaped your-string) to skip the escaping of your strings.
Cheers,
Tom
On Mar 18, 3:47 pm, Phil Hagelberg p...@hagelb.org wrote:
I'm using the Enlive library, and so far I've been pretty impressed. The
way it
Tom Hickey thic...@gmail.com writes:
Regarding your first question, you can use (net.cgrand.enlive-html/
escaped your-string) to skip the escaping of your strings.
Thanks, that's helpful.
I've also noticed one more oddity. Consider this snippet:
(deftemplate index foo/bar/template.html
36 matches
Mail list logo