On Tue, Oct 13, 2009 at 10:33 AM, Steven Roussey <[email protected]> wrote: > > Imagine this scenario (simplified to illustrate the idea): > > json={ > "header":"header stuff", > "base-url":"https://secret-site-url", > "blog-url":"/coolblog", > "blog-title":"blogishness", > "post":{ > "title":"sample t", > "message":"we have a sample of t", > "author":{ > "name":"joe", > "moderator":true > } > }, > "footer":"footer stuff" > } > > ------ blog.jt -------- > {header} > {blog-title} > > {post|include post.jt} > > {footer} > > ------- post.jt ------- > <a href="{blog-url|AbsUrl}/post/{post-id|urlencode}">{title}</a> > By {author|include author.jt} > {message} > > ------- author.jt ------- > {.section moderator}<b>{.end} > <a href="{blog-url|AbsUrl}/author/{name|urlencoode}">{name}</a> > {.section moderator}</b>{.end} > > > You will notice in the included files, that they receive the data they > need for the post or author, but access other variables that would be
I think you mean they "lose access", but I don't see it. > found via lookup had this example been coded in a single file. There > are several ways to make this work, but I'm curious what was conceived > for this type of thing originally. It has become a blocker I need to > fix ASAP... There was nothing originally conceived -- the context argument to formatters was only added in the last week or so, remember. If include is implemented as a formatter, then it has access to the full context. It can pass that through somehow to an included template. I haven't tried this though. Andy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JSON Template" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/json-template?hl=en -~----------~----~----~----~------~----~------~--~---
