On 7/28/06, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>Hi all, > >one question just came to my mind... When using HTML templates in conjunction >with view composition, I want to use HTML templates from my HTML designers and >exclude all the redundant stuff. Only the portion of the page containing my body >content (or footer panel or whatever) should be added to the component tree. >Today I have to add a jsfid="void" to EACH of the HTML tags of the original HTML >template to exclude it from the component tree. To exclude whiole blocks there >is the possiblity o use jsfid="void" plus allowBody="false", but this only >works, if there's no real jsf component nested. > >I'm thinking of something different - maybe some special HTML comment as marker >to exclude/include portions of the template: > ><!-- ### clay:remove ### --> ><html .... > this is the basic layout to be removed when converting to an include >... > ><div class="content"> ><!-- ### /clay:remove ### --> ><!-- > this is the body content to be placed > in the basic layout HTML template defined elsewhere >--> > <form> > <input type="text" value="#{contentBean.inputText}"/> > <input type="submit" action="#{contentBean.doSubmit}"/> > </form> ><!-- ### clay:remove ### --> ></div> > > this is the basic layout to be removed when converting to an include >... ></html> ><!-- ### /clay:remove ### --> > > >In Facelets' HTML templates this is done in a reverse fashion. Everthing outside >special HTML-Tags is removed from the resulting component subtree: > ><html xmlns:ui="some facelets uri" ...> > this is the basic layout to be removed when converting to an include >... > ><div class="content"> > ><ui:composite ...> ><!-- everything outside this tag is stripped --> > <form jsfc="h:form"> > <input jsfc="h:inputText" type="text" value="#{contentBean.inputText}"/> > <input jsfc="h:commandButton" type="submit" action="#{contentBean.doSubmit}"/> > </form> ></ui:composite> > ></div> > > this is the basic layout to be removed when converting to an include >... ></html> > >What do you think? Is this more a topic for the developer list? >I like this idea. Please create a JIRA issue on it so we don't loose track.
This is a good idea. I was running into the same problem with jsfid=void. In portlets I don't want to include header information. But I need the ability to void disconnected elements. <span jsfid="void"> <html> <head>...</head> </span> ...the content <span jsfid="void> </html> </span> doesn't work obviously because <span> can't close until </html> does. Using comments instead would make this possible.
The simplest way to handle this would be to dice up the document before parsing. The problem with that approach would be that the line numbers and offsets wouldn't match if an exception was found in parsing. However, we might be able to scan the document and record the offsets of the remove areas. The document parsing has two steps. The first tokenizes based on sharp pointy things (<>). The next step builds structure from the tokens. We might be able to tell the parser to ignore tokens within removed areas and we would still have the original line numbers and offsets to report. >Cheers, > >René Gary
