Further to my posts about converting from our proprietary templating system, I'm now working on a RewriteHTML plugin for TT.
The filter will allow HTML rewrite handlers to be installed, and then convert HTML into TT code calling the appropriate rewrite handler. That TT code can then be evaltt'ed. For instance, after installing 'input' and 'textarea' HTML rewrite handlers, the RewriteHTML.rewrite filter turns <form action="whatever.tt2"> Name: <input name="name" type="text" tied="myvar"><br> Notes: <textarea name="notes" cols="60" rows="15">(Insert Notes Here)</textarea> </form> ... into <form action="whatever.tt2"> Name: [% RewriteHTML.rewrite_input(name=>"name", type=>"text", tied=>"myvar") %]<br> Notes: [% FILTER RewriteHTML.rewrite_textarea(name=>"notes", rows=>"15", cols=>"60") %](Insert Notes Here)[% END %] </form> ... and some "sticky" rewrite handlers populate the inputs with values from template variables. We've already got a full set of rewrite handlers from our own template system which do this and more, and which shouldn't be hard to port. Am I duplicating someone's existing work here? And if not, would it be a useful plugin to make publicly available? Many thanks, Simon McGregor
