[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5288] * tp/Texinfo/Convert/Line.pm, Texinfo/Convert/Paragraph.p
From: |
Patrice Dumas |
Subject: |
[5288] * tp/Texinfo/Convert/Line.pm, Texinfo/Convert/Paragraph.pm: |
Date: |
Fri, 09 Aug 2013 23:27:25 +0000 |
Revision: 5288
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5288
Author: pertusus
Date: 2013-08-09 23:27:23 +0000 (Fri, 09 Aug 2013)
Log Message:
-----------
* tp/Texinfo/Convert/Line.pm, Texinfo/Convert/Paragraph.pm:
Do not break words at non-breaking spaces.
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/Line.pm
trunk/tp/Texinfo/Convert/Paragraph.pm
trunk/tp/t/results/plaintext_tests/all_spaces/res_plaintext/all_spaces.txt
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-08-09 22:22:19 UTC (rev 5287)
+++ trunk/ChangeLog 2013-08-09 23:27:23 UTC (rev 5288)
@@ -2,6 +2,7 @@
* tp/Texinfo/Convert/Line.pm, Texinfo/Convert/Paragraph.pm: preserve
spaces coming from the document.
+ Do not break words at non-breaking spaces.
2013-08-09 Patrice Dumas <address@hidden>
Modified: trunk/tp/Texinfo/Convert/Line.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Line.pm 2013-08-09 22:22:19 UTC (rev 5287)
+++ trunk/tp/Texinfo/Convert/Line.pm 2013-08-09 23:27:23 UTC (rev 5288)
@@ -280,8 +280,9 @@
$word = $line->{'word'} if (defined($line->{'word'}));
print STDERR "s `$line->{'space'}', w `$word'\n";
}
- if ($text =~ s/^([^\S\n]+)//) {
- $underlying_text =~ s/^([^\S\n]+)//;
+ # \x{202f}\x{00a0} are non breaking spaces
+ if ($text =~ s/^([^\S\x{202f}\x{00a0}\n]+)//) {
+ $underlying_text =~ s/^([^\S\x{202f}\x{00a0}\n]+)//;
my $spaces = $1;
print STDERR "SPACES.L\n" if ($line->{'DEBUG'});
if ($line->{'protect_spaces'}) {
@@ -313,9 +314,9 @@
}
}
}
- } elsif ($text =~ s/^([^\s\p{InFullwidth}]+)//) {
+ } elsif ($text =~ s/^(([^\s\p{InFullwidth}]|[\x{202f}\x{00a0}])+)//) {
my $added_word = $1;
- $underlying_text =~ s/^([^\s\p{InFullwidth}]+)//;
+ $underlying_text =~ s/^(([^\s\p{InFullwidth}]|[\x{202f}\x{00a0}])+)//;
my $underlying_added_word = $1;
$result .= $line->_add_next($added_word, $underlying_added_word);
Modified: trunk/tp/Texinfo/Convert/Paragraph.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Paragraph.pm 2013-08-09 22:22:19 UTC (rev
5287)
+++ trunk/tp/Texinfo/Convert/Paragraph.pm 2013-08-09 23:27:23 UTC (rev
5288)
@@ -328,9 +328,10 @@
$word = $paragraph->{'word'} if (defined($paragraph->{'word'}));
print STDERR "p ($paragraph->{'counter'}+$paragraph->{'word_counter'}) s
`$paragraph->{'space'}', w `$word'\n";
}
- if ($text =~ s/^(\s+)//) {
+ # \x{202f}\x{00a0} are non breaking spaces
+ if ($text =~ s/^([^\S\x{202f}\x{00a0}]+)//) {
my $spaces = $1;
- $underlying_text =~ s/^(\s+)//;
+ $underlying_text =~ s/^([^\S\x{202f}\x{00a0}]+)//;
print STDERR "SPACES($paragraph->{'counter'}) `$spaces'\n" if
($paragraph->{'DEBUG'});
#my $added_word = $paragraph->{'word'};
if ($paragraph->{'protect_spaces'}) {
@@ -421,9 +422,9 @@
$result .= $paragraph->_add_pending_word();
delete $paragraph->{'end_sentence'};
$paragraph->{'space'} = '';
- } elsif ($text =~ s/^([^\s\p{InFullwidth}]+)//) {
+ } elsif ($text =~ s/^(([^\s\p{InFullwidth}]|[\x{202f}\x{00a0}])+)//) {
my $added_word = $1;
- $underlying_text =~ s/^([^\s\p{InFullwidth}]+)//;
+ $underlying_text =~ s/^(([^\s\p{InFullwidth}]|[\x{202f}\x{00a0}])+)//;
my $underlying_added_word = $1;
$result .= $paragraph->_add_next($added_word, $underlying_added_word);
Modified:
trunk/tp/t/results/plaintext_tests/all_spaces/res_plaintext/all_spaces.txt
===================================================================
--- trunk/tp/t/results/plaintext_tests/all_spaces/res_plaintext/all_spaces.txt
2013-08-09 22:22:19 UTC (rev 5287)
+++ trunk/tp/t/results/plaintext_tests/all_spaces/res_plaintext/all_spaces.txt
2013-08-09 23:27:23 UTC (rev 5288)
@@ -10,7 +10,6 @@
| PUNCTUATION SPACE: | |
NO-BREAK SPACE:
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-bbbbbbbbbbbbbbbbbbbbb NARROW NO-BREAK SPACE:
-ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-dddddddddddddddddddd
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbb
+NARROW NO-BREAK SPACE:
+ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc dddddddddddddddddddd
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5288] * tp/Texinfo/Convert/Line.pm, Texinfo/Convert/Paragraph.pm:,
Patrice Dumas <=