[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6401] rename underlying_text
From: |
Gavin D. Smith |
Subject: |
[6401] rename underlying_text |
Date: |
Tue, 07 Jul 2015 15:57:50 +0000 |
Revision: 6401
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6401
Author: gavin
Date: 2015-07-07 15:57:48 +0000 (Tue, 07 Jul 2015)
Log Message:
-----------
rename underlying_text
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/Converter.pm
trunk/tp/Texinfo/Convert/DocBook.pm
trunk/tp/Texinfo/Convert/HTML.pm
trunk/tp/Texinfo/Convert/IXIN.pm
trunk/tp/Texinfo/Convert/IXINSXML.pm
trunk/tp/Texinfo/Convert/Info.pm
trunk/tp/Texinfo/Convert/Line.pm
trunk/tp/Texinfo/Convert/Paragraph.pm
trunk/tp/Texinfo/Convert/Texinfo.pm
trunk/tp/Texinfo/Convert/TexinfoSXML.pm
trunk/tp/Texinfo/Convert/TexinfoXML.pm
trunk/tp/Texinfo/Convert/Text.pm
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/ChangeLog 2015-07-07 15:57:48 UTC (rev 6401)
@@ -1,5 +1,11 @@
2015-07-07 Gavin Smith <address@hidden>
+ * tp/Texinfo/Convert/Line.pm,
+ * tp/Texinfo/Convert/Paragraph.pm: Rename 'underlying_text' key
+ to 'last_char'. Add some comments.
+
+2015-07-07 Gavin Smith <address@hidden>
+
* tp/Texinfo/Convert/Plaintext.pm (%index_style_commands): Add 'key'.
* NEWS: Mention reduced text styles.
Modified: trunk/tp/Texinfo/Convert/Converter.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Converter.pm 2015-07-07 12:42:58 UTC (rev
6400)
+++ trunk/tp/Texinfo/Convert/Converter.pm 2015-07-07 15:57:48 UTC (rev
6401)
@@ -60,7 +60,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my %defaults = (
'ENABLE_ENCODING' => 1,
Modified: trunk/tp/Texinfo/Convert/DocBook.pm
===================================================================
--- trunk/tp/Texinfo/Convert/DocBook.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/DocBook.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -54,7 +54,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my $nbsp = '&#'.hex('00A0').';';
my $mdash = '&#'.hex('2014').';';
Modified: trunk/tp/Texinfo/Convert/HTML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/HTML.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/HTML.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -54,7 +54,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
# misc commands that are of use for formatting.
my %formatting_misc_commands =
%Texinfo::Convert::Text::formatting_misc_commands;
Modified: trunk/tp/Texinfo/Convert/IXIN.pm
===================================================================
--- trunk/tp/Texinfo/Convert/IXIN.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/IXIN.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -54,7 +54,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my $ixin_version = 1;
Modified: trunk/tp/Texinfo/Convert/IXINSXML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/IXINSXML.pm 2015-07-07 12:42:58 UTC (rev
6400)
+++ trunk/tp/Texinfo/Convert/IXINSXML.pm 2015-07-07 15:57:48 UTC (rev
6401)
@@ -53,7 +53,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my %defaults = (
'ENABLE_ENCODING' => 0,
Modified: trunk/tp/Texinfo/Convert/Info.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Info.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/Info.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -45,7 +45,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my $STDIN_DOCU_NAME = 'stdin';
Modified: trunk/tp/Texinfo/Convert/Line.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Line.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/Line.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -55,16 +55,12 @@
{
my $self = shift;
my $word = 'UNDEF';
- my $underlying = '';
if (defined($self->{'word'})) {
$word = $self->{'word'};
- if ($self->{'word'} ne $self->{'underlying_word'}) {
- $underlying = ", underlying_word: $self->{'underlying_word'},";
- }
}
my $end_sentence = 'UNDEF';
$end_sentence = $self->{'end_sentence'} if
(defined($self->{'end_sentence'}));
- print STDERR "line ($self->{'line_beginning'},$self->{'counter'}) word:
$word, space `$self->{'space'}'${underlying} end_sentence: $end_sentence\n";
+ print STDERR "line ($self->{'line_beginning'},$self->{'counter'}) word:
$word, space `$self->{'space'}' end_sentence: $end_sentence\n";
}
sub end_line($)
@@ -138,7 +134,7 @@
$result .= $line->{'word'};
print STDERR "ADD_WORD.L[$line->{'word'}]\n" if ($line->{'DEBUG'});
$line->{'word'} = undef;
- $line->{'underlying_word'} = undef;
+ $line->{'last_char'} = undef;
}
}
return $result;
@@ -163,25 +159,22 @@
my $end_sentence = shift;
my $transparent = shift;
$line->{'end_line_count'} = 0;
- return $line->_add_next($word, undef, $space, $end_sentence, $transparent);
+ return $line->_add_next($word, $space, $end_sentence, $transparent);
}
my $end_sentence_character = quotemeta('.?!');
my $after_punctuation_characters = quotemeta('"\')]');
# add a word and/or spaces and end of sentence.
-sub _add_next($;$$$$$)
+sub _add_next($;$$$$)
{
my $line = shift;
my $word = shift;
- my $underlying_word = shift;
my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
my $result = '';
- $underlying_word = $word if (!defined($underlying_word));
-
if (defined($word)) {
my $disinhibit; # full stop after capital letter ends sentence
if ($word =~ s/\x08$//) {
@@ -189,7 +182,7 @@
}
if (!defined($line->{'word'})) {
$line->{'word'} = '';
- $line->{'underlying_word'} = '';
+ $line->{'last_char'} = '';
if ($line->{'end_sentence'}
and $line->{'end_sentence'} > 0
and !$line->{'frenchspacing'}
@@ -204,18 +197,17 @@
if (!$transparent) {
if ($disinhibit) {
- $line->{'underlying_word'} = 'a';
+ $line->{'last_char'} = 'a';
} elsif ($word =~
/([^$end_sentence_character$after_punctuation_characters])
[$end_sentence_character$after_punctuation_characters]*$/x) {
# Save the last character in $word before punctuation
- $line->{'underlying_word'} = $1;
+ $line->{'last_char'} = $1;
}
}
if ($line->{'DEBUG'}) {
print STDERR "WORD+.L $word -> $line->{'word'}\n";
- print STDERR "WORD+.L $underlying_word -> $line->{'underlying_word'}\n";
}
}
if (defined($space)) {
@@ -241,7 +233,7 @@
sub allow_end_sentence($)
{
my $line = shift;
- $line->{'underlying_text'} = 'a'; # lower-case
+ $line->{'last_char'} = 'a'; # lower-case
}
sub set_space_protection($$;$$$)
@@ -279,7 +271,6 @@
{
my $line = shift;
my $text = shift;
- my $underlying_text = $text;
$line->{'end_line_count'} = 0;
my $result = '';
@@ -295,7 +286,7 @@
print STDERR "SPACES.L\n" if ($line->{'DEBUG'});
if ($line->{'protect_spaces'}) {
$line->{'word'} .= $spaces;
- $line->{'underlying_word'} .= $spaces;
+ $line->{'last_char'} = substr($spaces, -1);
} else {
my $added_word = $line->{'word'};
$result .= $line->_add_pending_word();
@@ -331,13 +322,11 @@
# Reverse the insertion of the control character in Plaintext.pm.
if ($added_word =~ s/\x08(?=[$end_sentence_character]
- [$after_punctuation_characters]*$)//x) {
+ [$after_punctuation_characters]*$)//x) {
$disinhibit = 0;
}
$result .= _add_next($line, $added_word);
- my $last_letter = $line->{'underlying_word'};
-
# Check if it is considered as an end of sentence. There are two things
# to check: one, that we have a ., ! or ?; and second, that it is not
# preceded by an upper-case letter (ignoring some punctuation)
@@ -346,8 +335,8 @@
# do nothing in the case of a continuation of
# after_punctuation_characters
} elsif (($disinhibit
- or !$last_letter
- or $last_letter !~ /[[:upper:]]/)
+ or !$line->{'last_char'}
+ or $line->{'last_char'} !~ /[[:upper:]]/)
and $added_word =~ /[$end_sentence_character]
[$after_punctuation_characters]*$/x) {
if ($line->{'frenchspacing'}) {
@@ -370,7 +359,7 @@
$line->{'word'} = '';
}
$line->{'word'} .= $added;
- $line->{'underlying_word'} = $added;
+ $line->{'last_char'} = $added;
$result .= $line->_add_pending_word();
delete $line->{'end_sentence'};
$line->{'space'} = '';
Modified: trunk/tp/Texinfo/Convert/Paragraph.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Paragraph.pm 2015-07-07 12:42:58 UTC (rev
6400)
+++ trunk/tp/Texinfo/Convert/Paragraph.pm 2015-07-07 15:57:48 UTC (rev
6401)
@@ -50,16 +50,12 @@
{
my $self = shift;
my $word = 'UNDEF';
- my $underlying = '';
if (defined($self->{'word'})) {
$word = $self->{'word'};
- if ($self->{'word'} ne $self->{'underlying_word'}) {
- $underlying = ", underlying_word: $self->{'underlying_word'},";
- }
}
my $end_sentence = 'UNDEF';
$end_sentence = $self->{'end_sentence'} if
(defined($self->{'end_sentence'}));
- print STDERR "para ($self->{'counter'}+$self->{'word_counter'}) word: $word,
space `$self->{'space'}'${underlying} end_sentence: $end_sentence\n";
+ print STDERR "para ($self->{'counter'}+$self->{'word_counter'}) word: $word,
space `$self->{'space'}' end_sentence: $end_sentence\n";
}
sub _cut_line($)
@@ -145,7 +141,7 @@
print STDERR
"ADD_WORD[$paragraph->{'word'}]+$paragraph->{'word_counter'}
($paragraph->{'counter'})\n"
if ($paragraph->{'DEBUG'});
$paragraph->{'word'} = undef;
- $paragraph->{'underlying_word'} = undef;
+ $paragraph->{'last_char'} = undef;
$paragraph->{'word_counter'} = 0;
}
$paragraph->{'space'} = '';
@@ -171,6 +167,10 @@
my $end_sentence_character = quotemeta('.?!');
my $after_punctuation_characters = quotemeta('"\')]');
+# Add $WORD and/or $SPACE, returning the text to be added to the paragraph.
+# Any end of sentence punctuation in $WORD 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.
sub add_next($;$$$$)
{
my $paragraph = shift;
@@ -202,7 +202,7 @@
}
if (!defined($paragraph->{'word'})) {
$paragraph->{'word'} = '';
- $paragraph->{'underlying_word'} = '';
+ $paragraph->{'last_char'} = '';
if ($paragraph->{'end_sentence'}
and $paragraph->{'end_sentence'} > 0
and !$paragraph->{'frenchspacing'}
@@ -220,12 +220,12 @@
if (!$transparent) {
if ($disinhibit) {
- $paragraph->{'underlying_word'} = 'a';
+ $paragraph->{'last_char'} = 'a';
} elsif ($word =~
/([^$end_sentence_character$after_punctuation_characters])
[$end_sentence_character$after_punctuation_characters]*$/x) {
# Save the last character in $word before punctuation
- $paragraph->{'underlying_word'} = $1;
+ $paragraph->{'last_char'} = $1;
}
}
@@ -236,7 +236,7 @@
_end_line($paragraph);
$paragraph->{'word_counter'} = 0;
$paragraph->{'word'} = undef;
- $paragraph->{'underlying_word'} = undef;
+ $paragraph->{'last_char'} = undef;
} else {
$paragraph->{'word_counter'} += length($word);
}
@@ -283,7 +283,7 @@
{
my $paragraph = shift;
printf STDERR "ALLOW END SENTENCE\n" if $paragraph->{'DEBUG'};
- $paragraph->{'underlying_word'} = 'a'; # lower-case
+ $paragraph->{'last_char'} = 'a'; # lower-case
}
sub set_space_protection($$;$$$)
@@ -316,7 +316,10 @@
return '';
}
-# wrap a text.
+# Wrap $TEXT, returning the wrapped text, taking into account the current
state
+# 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.
sub add_text($$)
{
my $paragraph = shift;
@@ -353,7 +356,7 @@
#my $added_word = $paragraph->{'word'};
if ($protect_spaces_flag) {
$paragraph->{'word'} .= $spaces;
- $paragraph->{'underlying_word'} = substr($spaces, -1);
+ $paragraph->{'last_char'} = substr($spaces, -1);
$paragraph->{'word_counter'} += length($spaces);
#$paragraph->{'space'} .= $spaces;
if ($paragraph->{'word'} =~ s/\n/ /g
@@ -364,7 +367,7 @@
if (length($1) < 2) {
my $added = ' ' x (2 - length($1));
$paragraph->{'word'} .= $added;
- $paragraph->{'underlying_word'} = ' ';
+ $paragraph->{'last_char'} = ' ';
$paragraph->{'word_counter'} += length($added);
}
}
@@ -429,8 +432,6 @@
$result .= _add_next($paragraph, $added_word, undef, undef,
undef, !$newline_possible_flag);
- my $last_letter = $paragraph->{'underlying_word'};
-
# Check if it is considered as an end of sentence. There are two things
# to check: one, that we have a ., ! or ?; and second, that it is not
# preceded by an upper-case letter (ignoring some punctuation)
@@ -438,8 +439,8 @@
and $added_word =~ /^[$after_punctuation_characters]*$/o) {
# do nothing in the case of a continuation of
after_punctuation_characters
} elsif (($disinhibit
- or !$last_letter
- or $last_letter !~ /[[:upper:]]/)
+ or !$paragraph->{'last_char'}
+ or $paragraph->{'last_char'} !~ /[[:upper:]]/)
and $added_word =~ /[$end_sentence_character]
[$after_punctuation_characters]*$/x) {
if ($paragraph->{'frenchspacing'}) {
@@ -459,7 +460,7 @@
$paragraph->{'word'} = '';
}
$paragraph->{'word'} .= $fullwidth_segment;
- $paragraph->{'underlying_word'} = $fullwidth_segment;
+ $paragraph->{'last_char'} = $fullwidth_segment;
$paragraph->{'word_counter'} += 2;
if ($paragraph->{'counter'} != 0 and
$paragraph->{'counter'} + $paragraph->{'word_counter'}
Modified: trunk/tp/Texinfo/Convert/Texinfo.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Texinfo.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/Texinfo.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -46,7 +46,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
my %misc_commands = %Texinfo::Common::misc_commands;
my %brace_commands = %Texinfo::Common::brace_commands;
Modified: trunk/tp/Texinfo/Convert/TexinfoSXML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/TexinfoSXML.pm 2015-07-07 12:42:58 UTC (rev
6400)
+++ trunk/tp/Texinfo/Convert/TexinfoSXML.pm 2015-07-07 15:57:48 UTC (rev
6401)
@@ -50,7 +50,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
# SXML specific
my %defaults = (
Modified: trunk/tp/Texinfo/Convert/TexinfoXML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/TexinfoXML.pm 2015-07-07 12:42:58 UTC (rev
6400)
+++ trunk/tp/Texinfo/Convert/TexinfoXML.pm 2015-07-07 15:57:48 UTC (rev
6401)
@@ -52,7 +52,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
# XML specific
my %defaults = (
Modified: trunk/tp/Texinfo/Convert/Text.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Text.pm 2015-07-07 12:42:58 UTC (rev 6400)
+++ trunk/tp/Texinfo/Convert/Text.pm 2015-07-07 15:57:48 UTC (rev 6401)
@@ -52,7 +52,7 @@
@EXPORT = qw(
);
-$VERSION = '6.0';
+$VERSION = '6.0dev';
# this is in fact not needed for 'footnote', 'shortcaption', 'caption'
# when they have no brace_command_arg, see below.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6401] rename underlying_text,
Gavin D. Smith <=