I think StringTemplate&#39;s support of group interfaces is what you are looking for.  Take a look here: <a href="http://www.antlr.org/wiki/display/ST/Group+Files#GroupFiles-Supergroupsandinterfaces">http://www.antlr.org/wiki/display/ST/Group+Files#GroupFiles-Supergroupsandinterfaces</a>.<br>
<br><div class="gmail_quote">On Tue, Oct 27, 2009 at 8:39 AM, Ran Tavory <span dir="ltr">&lt;<a href="mailto:rantav@gmail.com">rantav@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr"><div>Hi Jim, thanks for the reply, but...</div>As a web designer, if I have two templates, one of them is <a href="http://layout.st" target="_blank">layout.st</a> and the other is <a href="http://page.st" target="_blank">page.st</a>.<div class="im">
<div><br>
</div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><div><a href="http://layout.st/" style="color:rgb(237, 28, 36)" target="_blank">layout.st</a></div>
<div><span style="font-family:Courier, arial, sans-serif;font-size:12px;line-height:13px"><pre style="white-space:pre-wrap;word-wrap:break-word;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:5px;margin-left:15px;margin-bottom:5px;margin-right:5px;text-align:left">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;$title$&lt;/title&gt;
&lt;body&gt;
$banner()$
&lt;hr&gt;
$body()$
&lt;/body&gt;
&lt;/html&gt;</pre><pre style="white-space:pre-wrap;word-wrap:break-word;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:5px;margin-left:15px;margin-bottom:5px;margin-right:5px;text-align:left">
<br></pre></span></div></span></div></div><div><a href="http://page.st" target="_blank">page.st</a>:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><span style="font-family:Courier, arial, sans-serif;font-size:12px;border-collapse:collapse;line-height:13px"><pre style="white-space:pre-wrap;word-wrap:break-word;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:5px;margin-left:15px;margin-bottom:5px;margin-right:5px;text-align:left">
$layout(title=&quot;My Title&quot;)$</pre></span></blockquote><div><br></div><div>How can I tell what&#39;s expected by <a href="http://layout.st" target="_blank">layout.st</a>? Of course, I can always document that, but it&#39;d be nicer if there was a formal way to do it (tools could also use it to hint users). </div>

<div>I&#39;m not sure I understand why you say this should be a function of the model or of the controller.  I don&#39;t view this is a &quot;pull&quot; by the view, rather as &quot;what can be pushed&quot; to the view.</div>

<div>At runtime, the view can always complain if some attributes are missing, but what would even be nicer is if even before runtime, while editing the files, I&#39;d be able to tell whether something&#39;s missing or not.</div>

<div><br></div><div>Thanks!</div><div><br></div><div><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Oct 27, 2009 at 3:13 PM, Jim Idle <span dir="ltr">&lt;<a href="mailto:jimi@temporal-wave.com" target="_blank">jimi@temporal-wave.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">










<div lang="EN-US" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">That is a function of the model (or possibly controller I
suppose), not the view. The view just renders what it is given and can tell if
some attributes are not present but that is about it. To enforce what you want,
you need to implement some method in your model that is called to populate the
view. The controller or model can then enforce what you are asking. In other words,
do not crate the template directly, but via an external method that requires
parameters , enforces types and throws requisite exceptions.</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Jim</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">

<div>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">

<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt">
<a href="mailto:stringtemplate-interest-bounces@antlr.org" target="_blank">stringtemplate-interest-bounces@antlr.org</a>
[mailto:<a href="mailto:stringtemplate-interest-bounces@antlr.org" target="_blank">stringtemplate-interest-bounces@antlr.org</a>] <b>On Behalf Of </b>Ran
Tavory<br>
<b>Sent:</b> Monday, October 26, 2009 10:46 PM<br>
<b>To:</b> <a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br>
<b>Subject:</b> [stringtemplate-interest] Formal parameters in web templates</span></p>

</div>

</div><div><div></div><div>

<p class="MsoNormal"> </p>

<div>

<p class="MsoNormal">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?</p>

<div>

<p class="MsoNormal"> </p>

</div>

<div>

<p class="MsoNormal">For example, in this template:</p>

</div>

<div>

<p class="MsoNormal"> </p>

</div>

<div>

<p class="MsoNormal"><a href="http://layout.st" target="_blank">layout.st</a></p>

</div>

<div><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt"> </pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;html&gt;</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">
&lt;head&gt;</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;title&gt;$title$&lt;/title&gt;</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;body&gt;</pre>

<pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">$banner()$</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;hr&gt;</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">
$body()$</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;/body&gt;</pre><pre style="margin-right:3.75pt;margin-bottom:3.75pt;margin-left:11.25pt">&lt;/html&gt;</pre>

<p class="MsoNormal"><span><br>
<span>I&#39;d like to say that <b>$title$</b> 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.</span></span></p>

</div>

<div>

<p class="MsoNormal"><span>Thanks!</span></p>

</div>

</div>

</div></div></div>

</div>

</div>



<br></div></div>_______________________________________________<br>
stringtemplate-interest mailing list<br>
<a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br>
<a href="http://www.antlr.org/mailman/listinfo/stringtemplate-interest" target="_blank">http://www.antlr.org/mailman/listinfo/stringtemplate-interest</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
stringtemplate-interest mailing list<br>
<a href="mailto:stringtemplate-interest@antlr.org">stringtemplate-interest@antlr.org</a><br>
<a href="http://www.antlr.org/mailman/listinfo/stringtemplate-interest" target="_blank">http://www.antlr.org/mailman/listinfo/stringtemplate-interest</a><br>
<br></blockquote></div><br>