"Damien Clark" <[EMAIL PROTECTED]> wrote: > I would like to extend HTML::Template to allow the user to implement > their own arbitrary escape functionality. [...] I am proposing the > following changes to the HTML::Template API and template format: > > . Extend the syntax for <tmpl_var escape=(JS,HTML,URL,NONE,1,0)> to > include user provided attribute values. Examples are probably more > clear: <tmpl_var name=¹bla¹ escape=php> or in my case <tmpl_var > name=¹bla2¹ escape=sql>. > > . The constructor to take the option ³escape² with the value being a > hashref. The keys will be the escape names gives in the templates > (e.g. php or sql) and the value a reference to a subroutine that is > provided by the user to escape any special meanings to the syntax used > in that context.
Very nice work, Damien! +1 on the inclusion of this oft-requested feature! I started to write the same patch a few years ago, thinking "this should be easy," but stumbled when I realized just how easy it wasn't :-) Shortly thereafter Sam accepted Craig Manley's patch that added escape=JS (to the list of hard-coded escapes) and my immediate need for user-defined escaping went away. But there have still been many times that I wished could "bolt on" a new escape=rot13 or something. We can filter the template with our own arbitrary code, so it would be great to have the capability to also filter the data. -dave PS: kudos too, for including tests! ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users