[stringtemplate-interest] Formal parameters in web templates
Jonathan Buhacoff
jonathan at buhacoff.net
Tue Oct 27 08:12:48 PDT 2009
You could use something similar to javadoc... put your formal
arguments inside template comments $! ... !$ at the beginning of each
template, then create a separate tool to read those and give you
editor hints.
I use one-template-per-file like you for web sites, instead of the
group syntax, so I would also appreciate something like this. I use
Eclipse so an Eclipse plugin would be sweet.
Does anyone on the list have experience writing these? Such a plugin
would need settings to allow the user to specify the location of
multiple template folders and template groups, analogous to source
folders & jar files on a class path.
You could also write an interface file (http://www.antlr.org/wiki/display/ST/ST+condensed+--+File+syntax
) but I think for what you're doing that will be cumbersome to maintain.
--
Jonathan Buhacoff
jonathan at buhacoff.net
--
On Oct 27, 2009, at 7:02 AM, Ran Tavory wrote:
> Thomas - am I asking for template reflection?
> Not necessarily. I'd actually prefer if the template could declare
> its formal parameters at the beginning so that someone reading it
> would know what it needs without having to dig in.
>
> On Tue, Oct 27, 2009 at 3:58 PM, Thomas Jackson <thomas.jackson.iii at gmail.com
> > wrote:
> Are you asking for Template Reflection to see possible the
> attributes that need setting for that template?
>
> A newbe question: Is it possible to define the list of formal
> parameters in a template where my use case would be for a web page?
>
> For example, in this template:
>
> layout.st <http://layout.st>
>
> <html>
> <head>
> <title>$title$</title>
> <body>
> $banner()$
> <hr>
> $body()$
> </body>
> </html>
>
> I'd like to say that *$title$* is a required parameter. Would even
> be better if types can be enforced, such as String, Number, Date,
> List of x etc, but even without static typing, simply listing the
> formal arguments the template expects would be great.
> Thanks!
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091027/951b38b7/attachment-0001.html
More information about the stringtemplate-interest
mailing list