[MKDoc-commit] [MKDoc-XML] fix for double-encoding
attribute-contents bug
bruno at mkdoc.demon.co.uk
bruno at mkdoc.demon.co.uk
Thu Mar 10 13:02:33 GMT 2005
Log Message:
-----------
[MKDoc-XML] fix for double-encoding attribute-contents bug
Modified Files:
--------------
MKDoc-XML:
Changes
MKDoc-XML/lib/MKDoc/XML:
Tagger.pm
MKDoc-XML/t:
305_MKDoc_XML_tagger_ampersand.t
-------------- next part --------------
Index: Changes
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/Changes,v
retrieving revision 1.41
retrieving revision 1.42
diff -LChanges -LChanges -u -r1.41 -r1.42
--- Changes
+++ Changes
@@ -2,6 +2,7 @@
0.75
- Added tests for tagger bugs when matching numbers and double escaping attribute contents
+ - bugfix for double-encoding attribute-contents bug
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: Tagger.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/lib/MKDoc/XML/Tagger.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -Llib/MKDoc/XML/Tagger.pm -Llib/MKDoc/XML/Tagger.pm -u -r1.10 -r1.11
--- lib/MKDoc/XML/Tagger.pm
+++ lib/MKDoc/XML/Tagger.pm
@@ -236,10 +236,6 @@
my $attr_str = join ' ', map { $_ . '=' . do {
my $val = $attr->{$_};
- $val =~ s/\&/&/g;
- $val =~ s/\</</g;
- $val =~ s/\>/>/g;
- $val =~ s/\"/"/g;
"\"$val\"";
} } keys %{$attr};
Index: 305_MKDoc_XML_tagger_ampersand.t
===================================================================
RCS file: /var/spool/cvs/MKDoc-XML/t/305_MKDoc_XML_tagger_ampersand.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lt/305_MKDoc_XML_tagger_ampersand.t -Lt/305_MKDoc_XML_tagger_ampersand.t -u -r1.1 -r1.2
--- t/305_MKDoc_XML_tagger_ampersand.t
+++ t/305_MKDoc_XML_tagger_ampersand.t
@@ -6,24 +6,31 @@
use MKDoc::XML::Tagger::Preserve;
use MKDoc::XML::Tagger;
-TODO: {
- local $TODO = 'Ampersand double-escaped';
+{
my $text = MKDoc::XML::Tagger->process_data (
"<p>stuff</p>",
{ _expr => 'stuff', _tag => 'a', href => 'http://example.com/foo.cgi?a=b&c=d' }
);
- like ($text, qr|<p><a href="http://example\.com/foo\.cgi\?a=b&c=d">stuff</a></p>|);
+ like ($text, qr|<p><a href="http://example\.com/foo\.cgi\?a=b&c=d">stuff</a></p>|, '& double escaped');
};
-TODO: {
- local $TODO = 'Angle brackets double-escaped';
+{
my $text = MKDoc::XML::Tagger->process_data (
"<p>stuff</p>",
{ _expr => 'stuff', _tag => 'foo', bar => '<zzz>' }
);
- like ($text, qr|<p><foo bar="<zzz>">stuff</foo></p>|);
+ like ($text, qr|<p><foo bar="<zzz>">stuff</foo></p>|, '<> double escaped');
+};
+
+{
+ my $text = MKDoc::XML::Tagger->process_data (
+ "<p>stuff</p>",
+ { _expr => 'stuff', _tag => 'foo', bar => '"hello world"' }
+ );
+
+ like ($text, qr|<p><foo bar=""hello world"">stuff</foo></p>|, '" double escaped');
};
1;
More information about the MKDoc-commit
mailing list