[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/ParagraphNonXS.pm (add_next,
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/Convert/ParagraphNonXS.pm (add_next, add_text): Remove handling of backspace control characters from add_next, doing it in add_text instead (as is done in the corresponding XS code). |
Date: |
Sat, 21 Oct 2023 20:04:12 -0400 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new f881d9e12d * tp/Texinfo/Convert/ParagraphNonXS.pm (add_next,
add_text): Remove handling of backspace control characters from add_next, doing
it in add_text instead (as is done in the corresponding XS code).
f881d9e12d is described below
commit f881d9e12d3793806363d7228c1644739e99d0ce
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Oct 22 00:44:52 2023 +0100
* tp/Texinfo/Convert/ParagraphNonXS.pm (add_next, add_text):
Remove handling of backspace control characters from add_next,
doing it in add_text instead (as is done in the corresponding
XS code).
---
ChangeLog | 7 +++++++
tp/Texinfo/Convert/ParagraphNonXS.pm | 37 ++++++++++++++----------------------
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 26a617caea..90d14adda0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-10-21 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/Convert/ParagraphNonXS.pm (add_next, add_text):
+ Remove handling of backspace control characters from add_next,
+ doing it in add_text instead (as is done in the corresponding
+ XS code).
+
2023-10-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/converter.c (find_output_unit_file)
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index d107fe1efc..df99d91b04 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -210,24 +210,14 @@ sub _add_next($;$$$)
return '';
}
- my $disinhibit = 0;
- # Reverse the insertion of any control characters in Plaintext.pm.
- if ($word =~ /\x08$/) {
- $disinhibit = 1;
- }
- $word =~ s/\x08//g;
-
$paragraph->{'word'} .= $word;
- if (!$transparent) {
- if ($disinhibit) {
- $paragraph->{'last_letter'} = 'a';
- } elsif ($word =~
- /([^$end_sentence_characters$after_punctuation_characters])
- [$end_sentence_characters$after_punctuation_characters]*$/ox) {
- # Save the last character in $word before punctuation
- $paragraph->{'last_letter'} = $1;
- }
+ if (!$transparent
+ and ($word =~
+ /([^$end_sentence_characters$after_punctuation_characters])
+ [$end_sentence_characters$after_punctuation_characters]*$/ox)) {
+ # Save the last character in $word before punctuation
+ $paragraph->{'last_letter'} = $1;
}
if (!$newlines_impossible and $word =~ /\n/) {
@@ -300,9 +290,6 @@ sub set_space_protection($$;$$$$)
# of $PARAGRAPH. Any end of sentence punctuation in $TEXT that should be
# allowed to end a sentence but which would otherwise be preceded by an
# upper-case letter should instead by preceded by a backspace character.
-#
-# FIXME: remove handling of \x08 control characters from add_next, doing it
-# in add_text instead (as is done in the corresponding XS code).
sub add_text($$)
{
my $paragraph = shift;
@@ -311,7 +298,7 @@ sub add_text($$)
my $result = '';
my @segments = split
- /(\s+)|(\p{InFullwidth})|((?:[^\s\p{InFullwidth}])+)/,
+ /(\s+)|(\p{InFullwidth})|((?:[^\s\p{InFullwidth}\x08])+)|(\x08)/,
$text;
# Check now if a newline exists anywhere in the string to
@@ -323,8 +310,8 @@ sub add_text($$)
# $empty_segment should be an empty string; the other variables
# here were recognized as field separators by split, the separator
# set to something else than undef for the separator matching.
- my ($empty_segment, $spaces, $fullwidth_segment, $added_word)
- = splice (@segments, 0, 4);
+ my ($empty_segment, $spaces, $fullwidth_segment, $added_word, $allow_eos)
+ = splice (@segments, 0, 5);
if ($debug_flag) {
print STDERR "p ($paragraph->{'counter'}+$paragraph->{'word_counter'}) "
@@ -391,6 +378,10 @@ sub add_text($$)
$result .= _end_line($paragraph);
}
$paragraph->{'last_letter'} = ' ';
+ } elsif (defined $allow_eos) {
+ # Reset 'last_leter' to a lower-case letter to allow an end of
+ # sentence to occur.
+ $paragraph->{'last_letter'} = 'a';
} elsif (defined $added_word) {
my $tmp = $added_word;
# Prepend 'last_letter' to add the information on the last
@@ -414,7 +405,7 @@ sub add_text($$)
and $tmp =~
/(^|[^\p{Upper}$after_punctuation_characters$end_sentence_characters])
[$after_punctuation_characters]*[$end_sentence_characters]
- [$end_sentence_characters\x08$after_punctuation_characters]*$/ox) {
+ [$end_sentence_characters$after_punctuation_characters]*$/ox) {
if ($paragraph->{'frenchspacing'}) {
$paragraph->{'end_sentence'} = -1;
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/ParagraphNonXS.pm (add_next, add_text): Remove handling of backspace control characters from add_next, doing it in add_text instead (as is done in the corresponding XS code).,
Gavin D. Smith <=