[MKDoc-commit] [Petal] $Petal::CodeGenerator::PI_RE should be applied newline

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Thu Sep 15 15:05:45 BST 2005


Log Message:
-----------
[Petal] $Petal::CodeGenerator::PI_RE should be applied newline insensitively

Modified Files:
--------------
    Petal:
        Changes
    Petal/lib/Petal:
        CodeGenerator.pm
    Petal/lib/Petal/Canonicalizer:
        XHTML.pm
        XML.pm

Added Files:
-----------
    Petal/t:
        091_attribute-newline.t
    Petal/t/data:
        attribute-newline.xml

-------------- next part --------------
Index: Changes
===================================================================
RCS file: /var/spool/cvs/Petal/Changes,v
retrieving revision 1.139
retrieving revision 1.140
diff -LChanges -LChanges -u -r1.139 -r1.140
--- Changes
+++ Changes
@@ -1,5 +1,8 @@
 Revision history for Petal.
 
+2.18
+    - $Petal::CodeGenerator::PI_RE should be applied newline insensitively
+
 2.17 Wed Sep  7 15:30:00 2005
     - test 041 check that   becomes chr(160) not chr(194) (William McKee)
     - Petal::Canonicalizer::XML Fix bug where \-escaped semicolons were not recognised (William McKee)
Index: CodeGenerator.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal/CodeGenerator.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -Llib/Petal/CodeGenerator.pm -Llib/Petal/CodeGenerator.pm -u -r1.46 -r1.47
--- lib/Petal/CodeGenerator.pm
+++ lib/Petal/CodeGenerator.pm
@@ -162,9 +162,9 @@
 
     foreach $token (@{$tokens})
     {
-        if ($token =~ /$PI_RE/)
+        if ($token =~ /$PI_RE/s)
         {
-	    ($token_name) = $token =~ /$PI_RE/;
+	    ($token_name) = $token =~ /$PI_RE/s;
 	    my @atts1 = $token =~ /(\S+)\=\"(.*?)\"/gos;
 	    my @atts2 = $token =~ /(\S+)\=\'(.*?)\'/gos;
 	    %token_hash = (@atts1, @atts2); 
Index: XHTML.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal/Canonicalizer/XHTML.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -Llib/Petal/Canonicalizer/XHTML.pm -Llib/Petal/Canonicalizer/XHTML.pm -u -r1.24 -r1.25
--- lib/Petal/Canonicalizer/XHTML.pm
+++ lib/Petal/Canonicalizer/XHTML.pm
@@ -121,7 +121,7 @@
 	    {
 		my $tokens = Petal::CodeGenerator->_tokenize (\$value);
 		my @res = map {
-		    ($_ =~ /$Petal::CodeGenerator::PI_RE/) ?
+		    ($_ =~ /$Petal::CodeGenerator::PI_RE/s) ?
 		        $_ :
 			do {
 			    $_ =~ s/\&/&/g;
Index: XML.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal/Canonicalizer/XML.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -Llib/Petal/Canonicalizer/XML.pm -Llib/Petal/Canonicalizer/XML.pm -u -r1.36 -r1.37
--- lib/Petal/Canonicalizer/XML.pm
+++ lib/Petal/Canonicalizer/XML.pm
@@ -201,7 +201,7 @@
 	    {
 		my $tokens = Petal::CodeGenerator->_tokenize (\$value);
 		my @res = map {
-		    ($_ =~ /$Petal::CodeGenerator::PI_RE/) ?
+		    ($_ =~ /$Petal::CodeGenerator::PI_RE/s) ?
 		        $_ :
 			do {
 			    $_ =~ s/\&/&/g;
--- /dev/null
+++ t/091_attribute-newline.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib ('lib');
+use Test::More 'no_plan';
+use Petal;
+
+$Petal::BASE_DIR     = './t/data/';
+$Petal::DISK_CACHE   = 0;
+$Petal::MEMORY_CACHE = 0;
+$Petal::TAINT        = 1;
+
+my $string = Petal->new ('attribute-newline.xml')->process ();
+like ($string, '/>apple</', '');
+like ($string, '/>orange</', '');
+like ($string, '/>plum</', '');
+like ($string, '/>pear</', '');
+like ($string, '/>ay bee cee</', '');
+like ($string, '/>ex why zed</', '');
+
--- /dev/null
+++ t/data/attribute-newline.xml
@@ -0,0 +1,41 @@
+<stuff xmlns:petal="http://purl.org/petal/1.0/">
+
+<div petal:define="foo
+string: apple">$foo</div>
+<div petal:define="bar string: orange">$bar</div>
+
+<div petal:content="string:
+plum">xxx</div>
+<div petal:content="string: pear">xxx</div>
+
+<div petal:define="
+         a string: ay;
+         b string: bee;
+         c string: cee;
+      "><span petal:replace="a" /> <span petal:replace="b" /> <span petal:replace="c" /></div>
+
+<div petal:define="
+         x
+         string: ex;
+         y string:
+         why;
+         z string: zed;
+      "><span petal:replace="x" /> <span petal:replace="y" /> <span petal:replace="z" /></div>
+
+<div petal:define="g string: foo &amp; bar"><span petal:replace="g" /></div>
+<div petal:define="
+g
+string:
+foo
+&amp;
+bar
+"><span
+petal:replace="
+g
+" /></div>
+
+<link rel="css.css" media="screen &" />
+<link rel="css.css" media="screen
+&" />
+
+</stuff>


More information about the MKDoc-commit mailing list