Profilo di agentzhHuman & MachineFotoBlogElenchiAltro ![]() | Guida |
|
09 agosto Template::Declare now (partiallly) supports XUL and custom XML dialectsI've refactored Template::Declare::Tags and introduced the long over-due TagSet feature to TD. HTML tag list and other related info have been moved to HTML::TagSet, and XUL::TagSet is also added. We can now control which tag set to use by the following lines of code: package MyApp::Templates; use Template::Declare::Tags qw/ XUL::TagSet /; use base 'Template::Declare'; template foo => sub { window { attr { ... } groupbox { .... } } }; And it's also possible to specify multiple tag sets: use Template::Declare::Tags qw/ XUL::TagSet HTML::TagSet /; (This example is not very realistic BTW.) By default, Template::Declare::Tags uses HTML::TagSet so that existing code won't break. The user can define their own tag set classes as long as these classes subclass Template::Declare::TagSet and implement the corresponding methods (i.e. get_tag_list, get_alternate_spelling, and can_combine_empty_tags). See the POD in these classes for more info :) Now I'm considering adding the XML namespace support to TD. I'm proposing the following design: package html; use Template::Declare::Tags 'HTML::Tags' => { tag_prefix => 'html:' }; package MyXulApp::Templates; use Template::Declare::Tags 'XUL::Tags'; template foo => sub { groupbox { html::p { 'hello, XML!' } html::table {} } }; And show('foo') will give: <groupbox> <html:p>hello, XML!</html:p> <html:table></html:table> </groupbox> Thoughts? Comments? |
|
|