[stringtemplate-interest] Renderer "modes"

Sean St. Quentin sean.stquentin at gmail.com
Mon Jun 19 20:06:13 PDT 2006


On 20/06/06, Kunle Odutola <Kunle_Odutola at hotmail.com> wrote:
>
> Hi Sean,
>
> > Without knowing of an easy way to fix this (by easy I mean not having
> two
> > arrays of preformatted information being sent to the view, which seems
> kinda
> > wrong), I was thinking about having rendering modes for an
> > AttributeRenderer.
>
> Formatter ojects are currently the prescribed way. See the types in the
> "Antlr.StringTemplate.Utils" namespace. You wrap each entry in your array.


Hey Kunle,
Yeah, I considered that option, but it seems to me a little awkward.

For instance, formatter/renderer combination makes this easy:

$people:{
<h2>$it.Name$</h2>

$it.Relations:{<a onclick="registerRelation('$it.Value;
format="js"$');">$it.Value$</a> }$

}$

Without using formatters on renderers, it would be possible, but the
controller would be overly complex with several wrapper classes.



> No. Am I right ti suspect you already have a patch?  ;-)


Haha, thats not like me at all :) I actually started just to see how it
would work but didn't get very far into it - problem is that I dont know
ANTLR (yet). Perhaps I'll dedicate some time over the weekend which will
make the girlfriend happy :)


> Perhaps. I wonder if formalizing the concept of Formatters would be a
> better
> approach. Formatters expose arbitrary properties that ST templates can
> already access directly. All that is needed is a way to compose a renderer
> and a formatter before registering with ST. This would remove the
> formatter-per-attribute association as well.


Simply combining the concepts (i.e. renderers exposing formatter-like
> properties in addition to ToString) seems a little brittle. Can't
> articulate
> why it feels brittle yet.


Combining the concepts seems like a logical step to me. Renderers convert
information into an easily readable format and output a string, they're
already formatters that are hardcoded to a single format.

Using formatters to format information before its sent to the view implies
that the controller knows exactly what the view is going to do with the
data... does that blur the lines in MVCR?

Thanks,
Sean.

Kunle
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060620/1b013640/attachment.html


More information about the stringtemplate-interest mailing list