[jifty-devel] Template::Declare now (partiallly) supports XUL and custom XML dialects

Jesse Vincent jesse at bestpractical.com
Thu Aug 9 11:34:19 EDT 2007


>
> 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?

That feels pretty natural.  Thought the pragma package definition  
kind of scares me and "HTML::Tags" there feels like it's a full  
package specification, when I suspect it's actually a fragment of  
one. Given that, is there a reason to include the "::Tags"?


Instead of:

> package html;
>     use Template::Declare::Tags 'HTML::Tags' => { tag_prefix =>  
> 'html:' };

...

	html::p { 'hello!'}



What about:


use Template::Declare::Tags 'HTML' => { namespace => 'html' }; #  
behind the scenes creates the html:: pseudopackage and imports  
Template::Declare::TagSet::HTML into it

	html::p{ 'hello' };


-j




-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070809/57966131/PGP.pgp


More information about the jifty-devel mailing list