texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/tp Texinfo/Convert/Paragraph.pm t/parag...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/Paragraph.pm t/parag...
Date: Sat, 01 Jan 2011 16:42:05 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/01/01 16:42:05

Modified files:
        tp/Texinfo/Convert: Paragraph.pm 
        tp/t           : paragraph.t 

Log message:
        Reset end of line if an end of line was forced but followed by text.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Paragraph.pm?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/paragraph.t?cvsroot=texinfo&r1=1.12&r2=1.13

Patches:
Index: Texinfo/Convert/Paragraph.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Paragraph.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Texinfo/Convert/Paragraph.pm        4 Dec 2010 12:11:11 -0000       1.10
+++ Texinfo/Convert/Paragraph.pm        1 Jan 2011 16:42:05 -0000       1.11
@@ -254,12 +254,14 @@
       my $added_word = $1;
       $result .= $paragraph->add_next($added_word);
       # now check if it is considered as an end of sentence
-      if (defined($paragraph->{'end_sentence'}) and 
-          $added_word =~ /^[$after_punctuation_characters]*$/) {
+      if (defined($paragraph->{'end_sentence'})
+          and $added_word =~ /^[$after_punctuation_characters]*$/) {
         # do nothing in the case of a continuation of 
after_punctuation_characters
       } elsif ($paragraph->{'word'} =~ 
/[$end_sentence_character][$after_punctuation_characters]*$/
            and $paragraph->{'word'} !~ 
/[[:upper:]][$end_sentence_character][$after_punctuation_characters]*$/) {
         $paragraph->{'end_sentence'} = 1;
+      } else {
+        delete $paragraph->{'end_sentence'};
       }
     }
   }

Index: t/paragraph.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/paragraph.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/paragraph.t       8 Dec 2010 22:47:33 -0000       1.12
+++ t/paragraph.t       1 Jan 2011 16:42:05 -0000       1.13
@@ -9,7 +9,7 @@
 
 #use Test;
 use Test::More;
-BEGIN { plan tests => 105 };
+BEGIN { plan tests => 106 };
 use lib '../texi2html/lib/Unicode-EastAsianWidth/lib/';
 #use lib '../texi2html/lib/libintl-perl/lib/';
 use Texinfo::Convert::Paragraph;
@@ -173,6 +173,14 @@
 
 $para = Texinfo::Convert::Paragraph->new();
 $result = '';
+$result .= $para->add_text('aa');
+$result .= $para->add_next('.', undef, 1);
+$result .= $para->add_text('b c');
+$result .= $para->end();
+is ($result, "aa.b c\n", 'force end sentence followed by text');
+
+$para = Texinfo::Convert::Paragraph->new();
+$result = '';
 $result .= $para->add_text('aA');
 $result .= $para->add_text('.');
 $result .= $para->add_text(' after');



reply via email to

[Prev in Thread] Current Thread [Next in Thread]