[MKDoc-commit] [MKDoc-Text-Structured] "=====---~>" shouldn't make previous line into

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Tue Dec 13 13:20:08 GMT 2005


Log Message:
-----------
[MKDoc-Text-Structured] "=====---~>" shouldn't make previous line into <h2>

Modified Files:
--------------
    MKDoc-Text-Structured:
        Changes
        MANIFEST
        META.yml
    MKDoc-Text-Structured/lib/MKDoc/Text:
        Structured.pm
    MKDoc-Text-Structured/lib/MKDoc/Text/Structured:
        Block.pm

Added Files:
-----------
    MKDoc-Text-Structured/t:
        023_headline_exact.t

-------------- next part --------------
Index: MANIFEST
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/MANIFEST,v
retrieving revision 1.8
retrieving revision 1.9
diff -LMANIFEST -LMANIFEST -u -r1.8 -r1.9
--- MANIFEST
+++ MANIFEST
@@ -41,3 +41,4 @@
 t/020_mailto.t
 t/021_smilies.t
 t/022_nofollow.t
+t/023_headline_exact.t
Index: META.yml
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/META.yml,v
retrieving revision 1.9
retrieving revision 1.10
diff -LMETA.yml -LMETA.yml -u -r1.9 -r1.10
--- 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.83
+version:      0.84
 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.29
retrieving revision 1.30
diff -LChanges -LChanges -u -r1.29 -r1.30
--- Changes
+++ Changes
@@ -1,5 +1,8 @@
 Revision history for MKDoc::Text::Structured
 
+0.84
+    - Fix bug where "========---~>" made previous line into <h2>
+
 0.83 Fri Aug 19 17:15:00 2005
     - fix for <pre> indenting bug when first line is more indented than second
     - method to insert spaces into long words
Index: Structured.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/lib/MKDoc/Text/Structured.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -Llib/MKDoc/Text/Structured.pm -Llib/MKDoc/Text/Structured.pm -u -r1.30 -r1.31
--- lib/MKDoc/Text/Structured.pm
+++ lib/MKDoc/Text/Structured.pm
@@ -26,7 +26,7 @@
 use warnings;
 
 our $Text    = '';
-our $VERSION = 0.83;
+our $VERSION = 0.84;
 
 
 sub process
Index: Block.pm
===================================================================
RCS file: /var/spool/cvs/MKDoc-Text-Structured/lib/MKDoc/Text/Structured/Block.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -Llib/MKDoc/Text/Structured/Block.pm -Llib/MKDoc/Text/Structured/Block.pm -u -r1.1 -r1.2
--- lib/MKDoc/Text/Structured/Block.pm
+++ lib/MKDoc/Text/Structured/Block.pm
@@ -36,8 +36,8 @@
     # Heading 1
     # =========
     @lines > 1          and
-    $lines[0]  =~ /^==/ and
-    $lines[-1] =~ /^==/ and do {
+    $lines[0]  =~ /^==[\s=]*$/ and
+    $lines[-1] =~ /^==[\s=]*$/ and do {
         shift (@lines);
         pop (@lines);
         $self->{lines} = \@lines;
@@ -48,7 +48,7 @@
     # Heading 2
     # =========
     @lines > 1 and
-    $lines[-1] =~ /^==/ and do {
+    $lines[-1] =~ /^==[\s=]*$/ and do {
         pop (@lines);
         $self->{lines} = \@lines;
         bless $self, 'MKDoc::Text::Structured::H2';
@@ -58,7 +58,7 @@
     # Heading 3 
     # --------- 
     @lines > 1 and
-    $lines[-1] =~ /^--/ and do {
+    $lines[-1] =~ /^--[\s-]*$/ and do {
         pop (@lines);
         $self->{lines} = \@lines;
         bless $self, 'MKDoc::Text::Structured::H3';
--- /dev/null
+++ t/023_headline_exact.t
@@ -0,0 +1,42 @@
+use warnings;
+use strict;
+use Test::More 'no_plan';
+use lib qw (lib ../lib);
+use MKDoc::Text::Structured;
+
+my $text = <<EOF;
+==========~>
+Headline A
+==========~>
+
+Headline B
+==========~>
+
+Headline C
+----------~>
+
+=========   
+Headline D
+=========  
+
+Headline E
+==========   
+
+Headline F
+--   
+
+EOF
+
+my $res = MKDoc::Text::Structured::process ($text);
+
+unlike ($res, qr#<h1>Headline A</h1>#);
+unlike ($res, qr#<h2>Headline B</h2>#);
+unlike ($res, qr#<h3>Headline C</h3>#);
+
+like ($res, qr#<h1>Headline D</h1>#);
+like ($res, qr#<h2>Headline E</h2>#);
+like ($res, qr#<h3>Headline F</h3>#);
+
+1;
+
+__END__


More information about the MKDoc-commit mailing list