[MKDoc-commit] [MKDoc-Text-Structured] fixed failure to change " to " bug

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Thu Mar 31 14:24:40 BST 2005


Log Message:
-----------
[MKDoc-Text-Structured] fixed failure to change " to " bug

Modified Files:
--------------
    MKDoc-Text-Structured:
        Changes
        META.yml
    MKDoc-Text-Structured/lib/MKDoc/Text:
        Structured.pm
    MKDoc-Text-Structured/lib/MKDoc/Text/Structured:
        Inline.pm
    MKDoc-Text-Structured/t:
        014_niceties.t
        017_entities_only.t

-------------- next part --------------
Index: META.yml
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/META.yml,v
retrieving revision 1.6
retrieving revision 1.7
diff -LMETA.yml -LMETA.yml -u -r1.6 -r1.7
--- 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-Text-Structured
-version:      0.81
+version:      0.82
 version_from: lib/MKDoc/Text/Structured.pm
 installdirs:  site
 requires:
Index: Changes
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/Changes,v
retrieving revision 1.19
retrieving revision 1.20
diff -LChanges -LChanges -u -r1.19 -r1.20
--- Changes
+++ Changes
@@ -1,5 +1,8 @@
 Revision history for MKDoc::Text::Structured
 
+0.82 Thu Mar 31 13:45:00 2005
+    - fixed failure to change " to " bug
+
 0.81 Wed Mar 30 15:00:00 2005
     - removed defunct email address
     - Documented entity substitution
Index: Structured.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/lib/MKDoc/Text/Structured.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -Llib/MKDoc/Text/Structured.pm -Llib/MKDoc/Text/Structured.pm -u -r1.24 -r1.25
--- lib/MKDoc/Text/Structured.pm
+++ lib/MKDoc/Text/Structured.pm
@@ -26,7 +26,7 @@
 use warnings;
 
 our $Text    = '';
-our $VERSION = 0.81;
+our $VERSION = 0.82;
 
 
 sub process
Index: Inline.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/lib/MKDoc/Text/Structured/Inline.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -Llib/MKDoc/Text/Structured/Inline.pm -Llib/MKDoc/Text/Structured/Inline.pm -u -r1.9 -r1.10
--- lib/MKDoc/Text/Structured/Inline.pm
+++ lib/MKDoc/Text/Structured/Inline.pm
@@ -76,6 +76,7 @@
     $Text   =~ s/&/&/g;
     $Text   =~ s/</&lt;/g;
     $Text   =~ s/>/&gt;/g;
+    $Text   =~ s/"/&quot;/g;
 
     $Text =~ s/(?<=(?:\s|\n))--(?=(?:\s|\n))/\&mdash;/g;                                 # --    becomes em-dash 
     $Text =~ s/(?<=(?:\s|\n))-(?=(?:\s|\n))/\&ndash;/g;                                  # -     becomes en-dash
@@ -144,6 +145,8 @@
     $Text = join '', map {
 	my $stuff = $_;
 	$stuff = " $stuff ";
+        $stuff =~ s/"/<QUOT>/g;
+        $stuff =~ s/&quot;/"/g;
 	while ($stuff =~ s/
 (?<=(?:\s|\n))                            # must start with space or carriage return
 \"                                        # double quote 
@@ -154,6 +157,8 @@
 	
 	$stuff =~ s/^ //;
 	$stuff =~ s/ $//;
+        $stuff =~ s/"/&quot;/g;
+        $stuff =~ s/<QUOT>/"/g;
 	$stuff;
     } _tokenize ($Text);
 }
Index: 017_entities_only.t
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/t/017_entities_only.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lt/017_entities_only.t -Lt/017_entities_only.t -u -r1.1 -r1.2
--- t/017_entities_only.t
+++ t/017_entities_only.t
@@ -6,7 +6,10 @@
 
 my $text = undef;
 
-$text = MKDoc::Text::Structured::Inline::process_entities_only ("My (c) symbol shouldn't be *bold* -- or http://example.com/ 'linked'");
-is ($text, 'My &copy; symbol shouldn\'t be *bold* &mdash; or http://example.com/ &lsquo;linked&rsquo;');
+$text = MKDoc::Text::Structured::Inline::process_entities_only ("My (c) \" symbol \"shouldn't\" be *bold* -- or http://example.com/ 'linked'");
+is ($text, 'My &copy; &quot; symbol &ldquo;shouldn\'t&rdquo; be *bold* &mdash; or http://example.com/ &lsquo;linked&rsquo;');
+
+$text = MKDoc::Text::Structured::Inline::process_entities_only ('Stuff with " & < > in it');
+is ($text, 'Stuff with &quot; &amp; &lt; &gt; in it');
 
 __END__
Index: 014_niceties.t
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/t/014_niceties.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lt/014_niceties.t -Lt/014_niceties.t -u -r1.5 -r1.6
--- t/014_niceties.t
+++ t/014_niceties.t
@@ -1,7 +1,7 @@
 use warnings;
 use strict;
 use Test::More 'no_plan';
-use lib qw (lib ../lib);
+use lib ('lib', '../lib');
 use MKDoc::Text::Structured;
 
 my $text = undef;
@@ -15,10 +15,13 @@
 
 
 $text = MKDoc::Text::Structured::process ('"let"s see if simple "" smart quotes work"');
-is ($text, '<p>&ldquo;let"s see if simple "" smart quotes work&rdquo;</p>');
+is ($text, '<p>&ldquo;let&quot;s see if simple &quot;&quot; smart quotes work&rdquo;</p>');
 
 $text = MKDoc::Text::Structured::process ('"" """ "" """"');
-is ($text, '<p>"" """ "" """"</p>');
+is ($text, '<p>&quot;&quot; &quot;&quot;&quot; &quot;&quot; &quot;&quot;&quot;&quot;</p>');
+
+$text = MKDoc::Text::Structured::process ('"<QUOT>"');
+is ($text, '<p>&ldquo;&lt;QUOT&gt;&rdquo;</p>');
 
 $text = MKDoc::Text::Structured::process ("This is a test: http://www.google.com/");
 is ($text, '<p>This is a test: <a href="http://www.google.com/">http://www.google.com/</a></p>');
@@ -44,6 +47,15 @@
 $text = MKDoc::Text::Structured::process ("ACLU(American Civil Liberties Union)");
 is ($text, '<p><abbr title="American Civil Liberties Union">ACLU</abbr></p>');
 
+$text = MKDoc::Text::Structured::process ('FART(Fat Australian "Red Tigers)');
+is ($text, '<p><abbr title="Fat Australian &quot;Red Tigers">FART</abbr></p>');
+
+$text = MKDoc::Text::Structured::process ('FART(Fat Australian "Red" Tigers)');
+is ($text, '<p><abbr title="Fat Australian &ldquo;Red&rdquo; Tigers">FART</abbr></p>');
+
+$text = MKDoc::Text::Structured::process ('FART(Fat Australian &<>Red Tigers)');
+is ($text, '<p><abbr title="Fat Australian &amp;&lt;&gt;Red Tigers">FART</abbr></p>');
+
 $text = MKDoc::Text::Structured::process ("ACLU (American Civil Liberties Union)");
 is ($text, '<p><abbr title="American Civil Liberties Union">ACLU</abbr> (American Civil Liberties Union)</p>');
 


More information about the MKDoc-commit mailing list