[Nitro] [PATCH] Nitro Transformer

Dimitri Aivaliotis aglarond at gmail.com
Mon Apr 17 12:07:24 EDT 2006


Hi All,

I've made a new type of in-Controller compiler.  It will take an XHTML
template, and "transform" any element within it.  So, you can take any
standard XHTML file (layout), apply the transformation (code), and get
a true separation of layout and code within Nitro.  An example usage
is given in the in-file documentation.  I've used it to place content
(from a separate text file) into a certain "div", while changing the
"class" of an "a"-tag.

Some possible improvements:
- tie it into the Nitro compiler pipeline
- bind it into Nitro's caching mechanism
- get the "base" and "action" variables automatically

Currently, a just-transformed template will not be displayed to the
browser.  A walk of all transform-enabled URIs needs to be done first,
and then either all templates recompiled, or Nitro restarted in order
to serve up the transformed templates.  Let me know if you have a
solution to this.

Hope this helps someone else to solve the same kinds of problems I've
tried to solve.  Comments welcome!

- Dimitri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nitro-transformer.zip
Type: application/zip
Size: 15554 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060417/38bbcc84/attachment.zip 


More information about the Nitro-general mailing list