shale-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@comcast.net (Gary VanMatre)
Subject Re: Easier way to exclude content from the HTML template?
Date Fri, 28 Jul 2006 16:36:40 GMT
>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.


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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message