On Thu, Mar 4, 2010 at 1:45 AM, benhoyt <[email protected]> wrote:
>
> > As a side effect of some improvements I'm doing to templetor, this
> > will be possible soon. Stay tuned!
>
> Cool. Do you mind briefly explaining what these improvements are going
> to be? (It might help me in choosing a template system.)
>
Nothing to do with the syntax. I was trying to fix line number reporting and
in the process I ended up improving the generated Python code with some
optimizations.
Not related to the above fixes, but I'm also trying to see if templetor can
be extended to generate javascript. I'm working on some AJAX heavy stuff
recently and I'm ending up writing a template in Python and another in
Javascript. It'll be cool if both of these can be combined.
I'm not yet sure if this should go with web.py, but I'm trying to do it by
defining a jsdef block in templator which works like def but also generates
javascript function to generate the same html.
Here is an example:
$def with (page)
$jsdef render_authors(authors):
<ul>
$for a in authors:
<li><a href="$a.key">$a.name</a></li>
</ul>
<div id="#authors">
$:render_authors(page.authors)
</div>
<script type="text/javascript">
function update_authors(authors) {
// Above jsdef must have added a render_authors function, use it to
update #authors
\$("#authors").html(render_authors(authors))
}
</script>
--
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en.