[MKDoc-commit] [MKDoc-Text-Structured] Added support for substituting entities without

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Wed Mar 30 15:06:22 BST 2005


Log Message:
-----------
[MKDoc-Text-Structured] Added support for substituting entities without tagging

Modified Files:
--------------
    MKDoc-Text-Structured:
        Changes
        MANIFEST
    MKDoc-Text-Structured/lib/MKDoc/Text/Structured:
        Inline.pm

Added Files:
-----------
    MKDoc-Text-Structured/t:
        017_entities_only.t

-------------- next part --------------
Index: MANIFEST
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/MANIFEST,v
retrieving revision 1.3
retrieving revision 1.4
diff -LMANIFEST -LMANIFEST -u -r1.3 -r1.4
--- MANIFEST
+++ MANIFEST
@@ -34,3 +34,4 @@
 t/014_niceties.t
 t/015_becky_marketeese.t
 t/016_uri.t
+t/017_entities_only.t
Index: Changes
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/Changes,v
retrieving revision 1.18
retrieving revision 1.19
diff -LChanges -LChanges -u -r1.18 -r1.19
--- Changes
+++ Changes
@@ -1,9 +1,10 @@
 Revision history for MKDoc::Text::Structured
 
-0.81
+0.81 Wed Mar 30 15:00:00 2005
     - removed defunct email address
     - Documented entity substitution
     - Test and fix for URI surrounded by <> bug
+    - Added support for substituting entities without tagging
 
 0.8 Thu Jul 22 17:51:30 2004
     - Fixed Bruno's broken trailing spaces patch ;-)
Index: Inline.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/lib/MKDoc/Text/Structured/Inline.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -Llib/MKDoc/Text/Structured/Inline.pm -Llib/MKDoc/Text/Structured/Inline.pm -u -r1.8 -r1.9
--- lib/MKDoc/Text/Structured/Inline.pm
+++ lib/MKDoc/Text/Structured/Inline.pm
@@ -39,6 +39,37 @@
     return $Text;
 }
 
+=pod
+
+=head2 Processing text without adding tags
+
+Example:
+
+  $title = "My (c) symbol shouldn't be *bold* -- or http://example.com/ 'linked'";
+  $title = MKDoc::Text::Structured::Inline::process_entities_only ($text);
+
+$title is now:
+
+  My &copy; symbol shouldn't be *bold* &mdash; or http://example.com/ &lsquo;linked&rsquo;
+
+=cut
+
+sub process_entities_only
+{
+    local $Text;
+    $Text = shift;
+    $Text = " $Text ";
+    $Text =~ s/\n/ /gsm;
+
+    _make_entities();
+    _make_simplequotes();
+    _make_doublequotes();
+    
+    $Text =~ s/^ //;
+    $Text =~ s/ $//;
+    return $Text;
+}
+
 
 sub _make_entities
 {
--- /dev/null
+++ t/017_entities_only.t
@@ -0,0 +1,12 @@
+use warnings;
+use strict;
+use Test::More 'no_plan';
+use lib ('lib', '../lib');
+use MKDoc::Text::Structured;
+
+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;');
+
+__END__


More information about the MKDoc-commit mailing list