[Jifty-commit] r2305 - Template-Declare/lib/Template/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Dec 3 10:57:34 EST 2006


Author: audreyt
Date: Sun Dec  3 10:57:34 2006
New Revision: 2305

Modified:
   Template-Declare/lib/Template/Declare/Tags.pm

Log:
* Template::Declare::Tags - Encode HTML attributes with underscores:

    # Single underscore: http_equiv ====> http-equiv
    meta {{ http_equiv is "Refresh", content is "0; $url" }};

    # Double underscore: xml__lang ====> xml:lang
    body {{ xml__lang is 'x-lojban' }};


Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Sun Dec  3 10:57:34 2006
@@ -115,6 +115,10 @@
 
             my $field = our $AUTOLOAD;
             $field =~ s/.*:://;
+
+            $field =~ s/__/:/g;     # xml__lang  is 'foo' ====> xml:lang="foo"
+            $field =~ s/_/-/g;      # http_equiv is 'bar' ====> http-equiv="bar"
+
             my $val = "@_";
 
             use bytes;


More information about the Jifty-commit mailing list