Hi Christophe,

I am trying out Enlive and had some questions regarding it's feature
set and your future plans in terms of functionality.

1) Component Templates
I was wondering if you had any plans to support component templates?
I.e., templates that represent just a portion of a page (via an html
snippet).

For example, let's say I have a page where the right column may
conditionally show either a list of companies or a list of news
articles. I would like to have a company-template defined using a file
that contains just the snippet of html used to display one company
(same for news articles). Now, I know that I could just include both
the company and news snippets in the main template, but for any larger
site with numerous different types of data to display, that gets
unwieldy.

I tried to figure out how to do this myself, but TagSoup always wraps
the snippets in <html> and <body> tags. If I don't pass startparse-
tagsoup to xml/parse, I am able to get the results I am looking for.
(Note: I also tried to use the root-bogons feature in tagsoup, as that
sounded like it should accomplish this, but to no avail.)

Is tagsoup always necessary, or could this perhaps be optional?


2) Setting content vs. removing elements
How do you specify whether you want to set the content of an element
versus replacing/removing the element? Take for example these
modifications to the :div.no-msg portion of your example:

[:div.no-msg] (when true "fred") ; this will replace the div element
with the string "fred", versus:
[:div.no-msg] "fred" ; which will set the divs content to "fred"

Is it true that if any code other then a string or parameter is used
it will always replace the element?


3) Selectors
Do you support descendent selectors? What about grouping selectors? If
so, how would I write the equivalent for the following css selectors:
#currentEvents .post {}
.company, .person {}

(I believe the first on would be [:#currentEvents :.post] but I can't
quite tell if that's correct.)

Do you have any plans to support additional selectors (e.g. child,
sibling, universal, attribute and/or ppseudo-class selectors)?


4) Attributes
Do you have any plans to support setting attributes on elements?


5) Escaping HTML
Is there any way to control when HTML is escaped or not? For instance,
if I had the following function and template:
(defn get-link [] "<a href=\"http://www.google.com/\";>google</a>")
(deftemplate links-template "net/cgrand/enlive_html/example.html" [a]
  [:h1] a
        [:.post] (get-link))

(let [my-link (get-link)]
        (links-template my-link))

The link is escaped in the h1, but not in the .post (or, more
specifically, when .post is replaced). Is the only way for me to
control whether html is escaped or not to always call a function and
escape it myself if desired?


Thanks in advance for your help. I hope my questions are clear. Please
don't take them as criticism, I'm just trying to get a better handle
on how Enlive works.

Cheers,
Tom Hickey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to