Sorry, that should have been:

<l mytitle="Hello">mystring:example</l>

which in turn would effectively call

<lang:en:mystring:example  mytitle="Hello"/>

if the current language was English.

In reality I would use callTemplate within the "l" splice to return the result 
I think.

Cheers,
Kevin

--- On Mon, 6/28/10, Kevin Jardine <[email protected]> wrote:

> From: Kevin Jardine <[email protected]>
> Subject: Adding templates to Heist in code
> To: [email protected]
> Date: Monday, June 28, 2010, 12:13 PM
> I would like to add a list of nodes
> to a template state.
> 
> Specifically, I have a set of language strings that *may*
> contain embedded nodes. This is for creating multilingual
> sites.
> 
> The file format being parsed is of the format:
> 
> <lang id="en">
> <s set="mystring">
> <t id="title">This is an example title</t>
> <t id="example">This is an example string with an
> embedded <mytitle /></t>
> ...
> many more string definitions would go here
> ...
> </s>
> </lang>
> 
> The idea is that parsing this file using renderTemplate
> calls a splice function that generates templates of the name
> "lang:en:mystring:example".
> 
> These templates should be saved in the template state and
> then be used during a following renderTemplate that renders
> a page shell.
> 
> The page shell or subsequently called splices would contain
> nodes of the form:
> 
> <l mytitle="Hello">mystring:template</l> which
> would look up the current language and return the
> appropriate template node, eg.
> <lang:en:mystring:example  mytitle="Hello"/>
> 
> which would return the previously defined template. I would
> introduce a few optimisations, but that is the basic idea.
> 
> So in essence, I am writing a splice function that has the
> side effect of generating new templates that are used later
> on.
> 
> I am abstracting the new template by using code like this
> (for the "t" tag):
> 
> ts <- getTS
> stopRecursion
> input <- getParamNode
> let mynodes = getChildren input
> putTS $ addTemplateFunction "lang:en:mystring:example"
> mynodes
> 
> The addTemplate function appears to be ideal for
> addTemplateFunction, except that it takes an internal
> template instead of a list of nodes.
> 
> I notice that there is a toInternalTemplate function but it
> is not public and it is not clear to me how the docType
> parameter works there in any case.
> 
> Is there a more straightforward way to do this?
> 
> Basically I am trying to define a large number of templates
> within one file rather than using the default Heist approach
> of one template per file, which is inefficient for defining
> language strings.
> 
> 
>       
> 


      
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to