[MKDoc-commit] [MKDoc-XML] fix for invalid XML produced when tagging text matching

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Thu Mar 10 15:13:39 GMT 2005


Log Message:
-----------
[MKDoc-XML] fix for invalid XML produced when tagging text matching numeric strings and 0.75 release

Modified Files:
--------------
    MKDoc-XML:
        Changes
        META.yml
    MKDoc-XML/lib/MKDoc:
        XML.pm
    MKDoc-XML/lib/MKDoc/XML:
        Tagger.pm
    MKDoc-XML/t:
        304_MKDoc_XML_Tagger_Numbers.t

-------------- next part --------------
Index: META.yml
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/META.yml,v
retrieving revision 1.3
retrieving revision 1.4
diff -LMETA.yml -LMETA.yml -u -r1.3 -r1.4
--- META.yml
+++ META.yml
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         MKDoc-XML
-version:      0.74
+version:      0.75
 version_from: lib/MKDoc/XML.pm
 installdirs:  site
 requires:
Index: Changes
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/Changes,v
retrieving revision 1.42
retrieving revision 1.43
diff -LChanges -LChanges -u -r1.42 -r1.43
--- Changes
+++ Changes
@@ -1,8 +1,9 @@
 Revision history for MKDoc::XML 
 
-0.75
+0.75 Thu Mar 10 15:12:00 2005
     - Added tests for tagger bugs when matching numbers and double escaping attribute contents
     - bugfix for double-encoding attribute-contents bug
+    - fix for invalid XML produced when tagging text matching numeric strings
 
 0.74 Thu Dec 09 14:00:00 2004
     - Fix for longstanding bug introduced in 0.66 that resulting in MKDoc::XML::Tagger producing invalid XML.
Index: XML.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/lib/MKDoc/XML.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -Llib/MKDoc/XML.pm -Llib/MKDoc/XML.pm -u -r1.22 -r1.23
--- lib/MKDoc/XML.pm
+++ lib/MKDoc/XML.pm
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.74';
+our $VERSION = '0.75';
 
 
 1;
Index: Tagger.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/lib/MKDoc/XML/Tagger.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -Llib/MKDoc/XML/Tagger.pm -Llib/MKDoc/XML/Tagger.pm -u -r1.11 -r1.12
--- lib/MKDoc/XML/Tagger.pm
+++ lib/MKDoc/XML/Tagger.pm
@@ -157,6 +157,9 @@
 	push @{$tags}, $replacement;
 	my $rep = '&(' . @{$tags} . ')';
         $text =~ s/(?<=\p{IsSpace}|\p{IsPunct}|\&)$to_replace(?=\p{IsSpace}|\p{IsPunct}|\&)/$rep/g;
+        # matching placeholders fix Bruno 2005-03-10
+        my $rep_quoted = quotemeta ($rep);
+        $text =~ s/&\($rep_quoted\)/&($to_replace)/g;
     }
    
     # remove the first and last space which we previously inserted for
Index: 304_MKDoc_XML_Tagger_Numbers.t
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/t/304_MKDoc_XML_Tagger_Numbers.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lt/304_MKDoc_XML_Tagger_Numbers.t -Lt/304_MKDoc_XML_Tagger_Numbers.t -u -r1.3 -r1.4
--- t/304_MKDoc_XML_Tagger_Numbers.t
+++ t/304_MKDoc_XML_Tagger_Numbers.t
@@ -15,8 +15,6 @@
     like ($text, qr|<p>stuff 1</p>|);
 }
 
-TODO: {
-  local $TODO = 'Critical: Produces invalid XML';
 {
     my $text = MKDoc::XML::Tagger->process_data (
         "<p>stuff 1</p>",
@@ -29,20 +27,16 @@
     # correct output
     like ($text, qr|<p>stuff <a href=\"/\">1</a></p>|);
 }
-};
 
-TODO: {
-  local $TODO = 'Not critical: Should be tagged, but isn\'t';
 {
     my $text = MKDoc::XML::Tagger->process_data (
-        "<p>stuff &amp(1)</p>",
+        "<p>stuff &amp;(1)</p>",
         { _expr => '&(1)', _tag => 'a', href => '/' }
     );
 
-    like ($text, qr|<p>stuff <a href=\"/\">&amp\(1\)</a></p>|);
+    like ($text, qr|<p>stuff <a href=\"/\">&amp;\(1\)</a></p>|);
 }
 
-};
 1;
 
 __END__


More information about the MKDoc-commit mailing list