Re: remove HTML comments from output

2011-03-11 Thread Howard Lewis Ship
On Fri, Mar 11, 2011 at 3:15 AM, stephanos2k wrote: > Thanks to you two - I think the TemplateParser option does everything I need > now. I'm quite amazed how simply Tapestry can be customized. Thanks. That's an important message, but a hard one to get out. > > -- > View this message in context:

Re: remove HTML comments from output

2011-03-11 Thread stephanos2k
Thanks to you two - I think the TemplateParser option does everything I need now. I'm quite amazed how simply Tapestry can be customized. -- View this message in context: http://tapestry.1045711.n5.nabble.com/remove-HTML-comments-from-output-tp3415110p3424881.html Sent from the Tapestry - User ma

Re: remove HTML comments from output

2011-03-10 Thread Howard Lewis Ship
... and I'd tend towards a modified version of what he's already done, which is to strip out the TemplateTokens as they are parsed by the TemplateParser. However, what he's done could be improved just a bit. public TemplateParser decorateTemplateParser(final TemplateParser delegate) { return

Re: remove HTML comments from output

2011-03-10 Thread Robert Zeigler
You could probably do this, if you felt so inclined. You can't override SaxTemplateParser directly. Instead, you would override TemplateParser (contributed by InternalModule), and use that to instantiate your custom/overridden SaxTemplateParser. One clarification: template /parsing/ is different

Re: remove HTML comments from output

2011-03-10 Thread Robert Zeigler
MarkupRendererFilter: renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { renderer.renderMarkup(writer);//allow the rest of the filters to work. Document doc = writer.getDocument(); //now you can manipulate the dom via the doc variable. }

Re: remove HTML comments from output

2011-03-10 Thread stephanos2k
Cool - thanks for the info! I just implemented it, works like a charm. In case anyone is interested in this - here is my code (Scala): # AppModule def decorateTemplateParser(parser: TemplateParser) = new TemplateParser() { import scala.collection.JavaConversions._

Re: remove HTML comments from output

2011-03-10 Thread Howard Lewis Ship
You could decorate the TemplateParser service and convert its output to drop the CommentToken objects inside the returned ComponentTemplate object (that is, return a new ComponentTemplate that filters its output somewhat). On Thu, Mar 10, 2011 at 2:39 AM, stephanos2k wrote: > Would it make more

Re: remove HTML comments from output

2011-03-10 Thread stephanos2k
Would it make more sense (performance-wise) to remove the HTML comments in the 'SaxTemplateParser'? I remembered that there was an option in Tapestry to compress whitespaces from templates. I dug around the Tapestry source a bit and found the 'SaxTemplateParser' which apparently parses each templa

Re: remove HTML comments from output

2011-03-10 Thread stephanos2k
That sounds interesting. #1: Is there any 'documentation' to get started with the MarkupRendererFilter? I can't see where exactly I can manipulate the DOM in [renderMarkup(MarkupWriter writer, MarkupRenderer renderer)]. #2: And do you think it's the fastest method? - since, if I understand corr

Re: remove HTML comments from output

2011-03-09 Thread Cezary Biernacki
Hi, you can use .. to mark parts of template that should not be rendered http://tapestry.apache.org/component-templates.html#ComponentTemplates-%3Ct%3Aremove%3E If you really need to remove comments, you can contribute a MarkupRendererFilter to MarkupRenderer and just remove all (or some) comment