[Developers] mjt 0.5 is released
Nick Thompson
nix at metaweb.com
Wed Jun 27 21:56:06 UTC 2007
Mjt 0.5 has been released: for more info see http://mjtemplate.org/
This release has plenty of new features and examples:
mjt.else and mjt.elif attributes
when combined with mjt.if, these attributes eliminate many
cumbersome uses of mjt.choose.
mjt.on* event handlers
Mjt provides handler attributes like mjt.onclick,
mjt.onsubmit, etc. Unlike the usual DOM event handlers,
the event body is compiled within the current lexical scope.
mjt.for creates a new variable scope
This is done by wrapping the body in a javascript function() {...}
declaration. This results in the variable capture semantics that most
people expect when writing event handlers.
mjt.run() does the right thing without arguments
If mjt.run() has no arguments, it
will implicitly treat the <body> element as a template, compile it,
and replace it. This removes the tedious <div id="top">...</div>
boilerplate from every mjt page.
mjt.run() has several other arguments that allow you to run
templates that were declared previously, rather than compiling
and expanding in-place. This allows more dynamic apps.
mjt.attrs lets you dynamically add attributes to the generated
html using a Javascript expression.
examples are Valid XHTML + Mjt
The examples now validate against mjt.rnc and xhtml.rnc, using
James Clark's nxml-mode.
experimental: support for including mjt using an inline <script> tag
mjtinline.js is a thin wrapper script
around mjt.js that lets you include Mjt in your pages, even if you
can't change the <head> or <body> tags. Bloggers may be interested
in this one. See the inline script example.
experimental: autosuggest menus
There is an implementation of autosuggest pop-up menus using Mjt
and jQuery that you can play with. The UI flow still has lots of
rough edges. There is a type suggestion example for Freebase
as a demonstration. Still needs some porting to work on IE6.
enjoy!
nick
More information about the Developers
mailing list