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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Dec 6 01:03:19 EST 2006


Author: jesse
Date: Wed Dec  6 01:03:18 2006
New Revision: 2336

Removed:
   Template-Declare/mycode
   Template-Declare/pl
Modified:
   Template-Declare/lib/Template/Declare/Tags.pm

Log:
t/trivial was failing tests because meta elements were being expanded to container nodes. which they are not.

Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Wed Dec  6 01:03:18 2006
@@ -103,6 +103,8 @@
         map { qq{ $_="} . ( $ATTRIBUTES{$_} || '' ) . qq{"} }
           keys %ATTRIBUTES );
 
+    my $had_content = 0;
+
     {
         no warnings qw( uninitialized redefine once );
 
@@ -136,21 +138,29 @@
 
         my $last = $code->();
 
-        $buf .= '>';
-        $buf .= $BUFFER;
 
-# We concatenate "" to force scalarization when $last or $BUFFER is solely a Jifty::Web::Link
-        $buf .= $last unless length($BUFFER);    # HACK WRONG;
+        if (length($BUFFER)) {
+
+            # We concatenate to force scalarization when $last or $BUFFER is solely a Jifty::Web::Link
+            $buf .= '>' . $BUFFER;
+            $had_content = 1;
+        } elsif (length $last) {
+            $buf .= '>'. $last;
+            $had_content = 1;
+        } else {
+            $had_content = 0;
+        }
+
     }
 
     # default to <tag/> rather than <tag></tag> if there's no content
-    if ($buf) {
+    if ($had_content) {
         $BUFFER .= $buf;
         $BUFFER .= "\n" . ( " " x $DEPTH ) if ( $buf =~ /\n/ );
         $BUFFER .= "</$tag>";
     }
     else {
-        $BUFFER .= "/>";
+        $BUFFER .= $buf." />";
     }
     return '';
 }


More information about the Jifty-commit mailing list