On Sun, 10 Nov 2013 08:42:58 -0200, Ben Titmarsh
<ben.titma...@hotmail.co.uk> wrote:
I operate a kind of forum and I'd like to give me users to ability to
specify something like this when tying up a post:
[CARD]Gamble[/CARD]
The
text will be saved in this format in the DB. When it comes time to
render it, I would like to scan the String and replace all instance of
[CARD]*[CARD] with a render of another component (<t:cardRenderer
name="Gamble"/>).
The most naive solution would be to
replicate the logic in the CardRenderer component which is currently
being used elsewhere into a new post processor component but ideally I
would like to avoid this and have all of the rendering handled by the
template.
Any thoughts on an approach?
I think the current approach is to find some template engine that does
what you want and have the CardRenderer use it to transform the stored
text into the HTML you want before passing it to OutputRaw. In other
words, this isn't much Tapestry itself: the core of your problem is
elsewhere, converting user-typed stuff into what you want.
You can try to scan the output of a component using a mixin with an
afterRender(MarkupWriter writer) component, but I think it would be way
more complicated than having something else (probably a service) do the
transformations you want before rendering it through Tapestry. So my final
suggestion is for you to have the CardRenderer component logic moved to a
service.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org