Re: new work on HTML::Template
Mathew Robertson <[email protected]> Fri, 8 Apr 2011 03:29:37 +1000
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <[email protected]> |
--===============9115641869815293041== Content-Type: multipart/alternative; boundary=0016368340c2247f8204a0577475 --0016368340c2247f8204a0577475 Content-Type: text/plain; charset=ISO-8859-1 Its interesting that thread of discussion has been raised.... I have been using H::T for years - as a result, I have added most of these features to my own instance. Just this week I finished testing a new H::T::Bundle module which I was going to upload to CPAN, Features in my instance: - some bugs fixed - support for "die_on_unset_params" which causes the output() to die if the programmer hasn't called param(somevar =>...) when 'somevar' exists in the template - big performance enhancement in the output() phase - recursive templates (at a performance hit) - output() by reference - TMPL_ELSIF - TMPL_REQUIRE - like TMPL_INCLUDE but only once ala Perl 'require'. - support for simple perl-array based loops - the ability to sub-class and so hook-in to create new TMPL_xxx semantics - dynamic loading of ESCAPE modules - 'includes_debug' which matches the other debug modes. - profiling support - preliminary support for objects, aka some_obj.some_attr, without having to do this yourself - support for "intrinsic_vars" such as '__type__' and '__filename__' - '__even__' and '__outer__' (TMPL_UNLESS __odd__ just seems wrong...) - updated the docs - updated some of the test cases. - utf8 safe TODO: - support for automatic length param on loops - more test cases for objects, as I'm not 100% sure I got everything. - TMPL_LOOP support for non-hash rows. - more test cases which covers the use-cases for reftype() Via the H::T::Bundle sub-class I added: - TMPL_SET - support for pre-written filters (about a dozen so far) - <% somevar %> implemented as a filter - sane H::T defaults, as I think global_vars and loop_context_vars should be the default - Environmental variables in templates A note regarding the "format" option - this could be implemented in a sub-class using a new keyword, as in <TMPL_STRING var format=blah"> and/or <TMPL_PRECISION var precision=blah>. ie: extending TMPL_VAR is possible, but given the hug number of possibilities, it might be easier to do something similar to <TMPL_CATGETS var> which is a implementation of the gnus catgets() call, but from within templates (or just use a real translation engine either via preprocessing or real-time ). Thoughts? cheers, Mathew Robertson --0016368340c2247f8204a0577475 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Its interesting that thread of discussion has been raised.... =A0I have bee= n using H::T for years - as a result, I have added most of these features t= o my own instance. =A0Just this week I finished testing a new H::T::Bundle = module which I was going to upload to CPAN,=A0<div> <br></div><div>Features in my instance:</div><div>- some bugs fixed</div><d= iv>- support for "die_on_unset_params" which causes the output() = to die if the programmer hasn't called param(somevar =3D>...) when &= #39;somevar' exists in the template</div> <div>- big performance enhancement in the output() phase</div><div>- recurs= ive templates (at a performance hit)</div><div>- output() by reference</div= ><div>- TMPL_ELSIF</div><div>- TMPL_REQUIRE - like TMPL_INCLUDE but only on= ce ala Perl 'require'.</div> <div>- support for simple perl-array based loops</div><div>- the ability to= sub-class and so hook-in to create new TMPL_xxx semantics</div><div>- dyna= mic loading of ESCAPE modules</div><div>- 'includes_debug' which ma= tches the other debug modes.</div> <div>- profiling support</div> <div>- preliminary support for objects, aka some_obj.some_attr, without hav= ing to do this yourself</div><div>- support for "intrinsic_vars" = such as '__type__' and '__filename__'</div><div>- '__ev= en__' and '__outer__' =A0(TMPL_UNLESS __odd__ just seems wrong.= ..)</div> <div>- updated the docs</div><div>- updated some of the test cases.</div><d= iv>- utf8 safe</div><div><br></div><div>TODO:</div><div>- support for autom= atic length param on loops</div><div>- more test cases for objects, as I= 9;m not 100% sure I got everything.</div> <div>- TMPL_LOOP support for non-hash rows.</div><div>- more test cases whi= ch covers the use-cases for reftype()</div><div><br></div><div>Via the H::T= ::Bundle sub-class I added:</div><div>- TMPL_SET</div><div>- support for pr= e-written filters (about a dozen so far)=A0</div> <div><div>- <% somevar %> implemented as a filter</div></div><div>- s= ane H::T defaults, as I think global_vars and loop_context_vars should be t= he default</div><div>- Environmental variables in templates</div><div> <br> </div><div><br></div><div><br></div><div>A note regarding the "format&= quot; option - this could be implemented in a sub-class using a new keyword= , as in <TMPL_STRING var format=3Dblah"> =A0and/or <TMPL_PREC= ISION var precision=3Dblah>. =A0ie: extending TMPL_VAR is possible, but = given the hug number of=A0possibilities,=A0=A0it might be easier to do some= thing similar to <TMPL_CATGETS var> which is a implementation of the = gnus catgets() call, but from within templates (or just use a real translat= ion engine either via preprocessing or real-time ).</div> <div><br></div><div><br></div><div>Thoughts?</div><div><br></div><div><br><= /div><div>cheers,</div><div>Mathew Robertson</div> --0016368340c2247f8204a0577475-- --===============9115641869815293041== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev --===============9115641869815293041== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Html-template-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/html-template-users --===============9115641869815293041==--