[Jifty-commit] r3271 - in Template-Declare: lib/Template/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun May 20 16:28:52 EDT 2007


Author: jesse
Date: Sun May 20 16:28:52 2007
New Revision: 3271

Modified:
   Template-Declare/   (props changed)
   Template-Declare/lib/Template/Declare/Tags.pm

Log:
 r56995 at 232:  jesse | 2007-05-20 16:28:32 -0400
 * Tag nesting cleanups. Now don't introduce extra whitespace (newlines and spaces) at the ends of a tag


Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Sun May 20 16:28:52 2007
@@ -14,7 +14,7 @@
 
 our %ATTRIBUTES       = ();
 our %ELEMENT_ID_CACHE = ();
-our $DEPTH            = 0;
+our $TAG_NEST_DEPTH            = 0;
 
 =head1 NAME
 
@@ -322,7 +322,7 @@
     my $tag = $subroutine;
     $tag =~ s/^.*\:\://;
 
-    my $buf = "\n" . ( " " x $DEPTH ) . "<$tag"
+    my $buf = "\n" . ( " " x $TAG_NEST_DEPTH ) . "<$tag"
         . join( '',
         map { qq{ $_="} . ( $ATTRIBUTES{$_} || '' ) . qq{"} }
             sort keys %ATTRIBUTES );
@@ -355,7 +355,7 @@
             wantarray ? () : '';
         };
 
-        local $DEPTH = $DEPTH + 1;
+        local $TAG_NEST_DEPTH = $TAG_NEST_DEPTH + 1;
         %ATTRIBUTES = ();
         Template::Declare->new_buffer_frame;
         my $last = join '', map { ref($_) ? $_ : _escape_html($_) } $code->();
@@ -377,7 +377,7 @@
     }
 
     if ($had_content) {
-        $buf .= "\n" . ( " " x $DEPTH ) if ( $buf =~ /\n/ );
+        $buf .= "\n" . ( " " x $TAG_NEST_DEPTH ) if ( $buf =~ /\>$/ );
         $buf .= "</$tag>";
     } elsif ( $tag
         =~ m{\A(?: base | meta | link | hr | br | param | img | area | input | col )\z}x
@@ -457,6 +457,9 @@
     my $template        = shift;
     my $INSIDE_TEMPLATE = shift;
 
+
+
+
     my $callable =
         ( ref($template) && $template->isa('Template::Declare::Tag') )
         ? $template


More information about the Jifty-commit mailing list