[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo/Convert HTML.pm Plaintext.pm...
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo/Convert HTML.pm Plaintext.pm... |
Date: |
Sat, 22 Oct 2011 19:56:27 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/10/22 19:56:27
Modified files:
tp/Texinfo/Convert: HTML.pm Plaintext.pm Text.pm Unicode.pm
Log message:
Instead of 0 meaning lower case, a negative number means lower-case.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.192&r2=1.193
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.175&r2=1.176
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Unicode.pm?cvsroot=texinfo&r1=1.23&r2=1.24
Patches:
Index: HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -b -r1.192 -r1.193
--- HTML.pm 22 Oct 2011 19:02:24 -0000 1.192
+++ HTML.pm 22 Oct 2011 19:56:26 -0000 1.193
@@ -120,15 +120,10 @@
}
}
-# 0 do not necessarily mean the same than undef, it may mean lower_casing
sub in_upper_case($)
{
my $self = shift;
- if
($self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'upper_case'})
{
return
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'upper_case'};
- } else {
- return undef;
- }
}
sub in_space_protected($)
@@ -1165,7 +1160,7 @@
$cmdname = $click_cmdname;
}
}
- if ($self->in_upper_case and $letter_no_arg_commands{$cmdname}
+ if ($self->in_upper_case() and $letter_no_arg_commands{$cmdname}
and $self->{'commands_formatting'}->{'normal'}->{uc($cmdname)}) {
$cmdname = uc($cmdname);
}
Index: Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -b -r1.175 -r1.176
--- Plaintext.pm 20 Oct 2011 20:51:07 -0000 1.175
+++ Plaintext.pm 22 Oct 2011 19:56:26 -0000 1.176
@@ -1182,15 +1182,9 @@
if ($self->get_conf('ENABLE_ENCODING')) {
$encoding = $self->{'encoding_name'};
}
- # it is important that sc is either set or undef, as if 0 it means
- # lower casing
- my $sc;
- if ($formatter->{'upper_case'}) {
- $sc = 1;
- }
my $text = Texinfo::Convert::Text::brace_no_arg_command($root,
{'enabled_encoding' => $encoding,
- 'sc' => $sc});
+ 'sc' => $formatter->{'upper_case'}});
my $lower_case_text;
# always double spacig, so set underlying text lower case.
if ($formatter->{'var'} or $formatter->{'code'}) {
@@ -1245,7 +1239,7 @@
my $accented_text_lower_case;
if ($formatter->{'var'} or $formatter->{'code'}) {
$accented_text_lower_case
- = Texinfo::Convert::Text::text_accents($root, $encoding, 0);
+ = Texinfo::Convert::Text::text_accents($root, $encoding, -1);
} elsif ($formatter->{'upper_case'}) {
$accented_text_lower_case
= Texinfo::Convert::Text::text_accents($root, $encoding);
Index: Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- Text.pm 18 Oct 2011 23:16:15 -0000 1.74
+++ Text.pm 22 Oct 2011 19:56:26 -0000 1.75
@@ -182,10 +182,10 @@
{
my $result = shift;
my $stack = shift;
- my $in_upper_case = shift;
+ my $set_case = shift;
- if (defined($in_upper_case) and $result =~ /^\w$/) {
- if ($in_upper_case) {
+ if ($set_case and $result =~ /^\w$/) {
+ if ($set_case > 0) {
$result = uc($result);
} else {
$result = lc($result);
@@ -202,22 +202,22 @@
{
my $accent = shift;
my $encoding = shift;
- my $in_upper_case = shift;
+ my $set_case = shift;
my ($contents, $stack)
= Texinfo::Common::find_innermost_accent_contents($accent);
my $options = {};
$options->{'enabled_encoding'} = $encoding if (defined($encoding));
- $options->{'sc'} = $in_upper_case if (defined($in_upper_case));
+ $options->{'sc'} = $set_case if (defined($set_case));
my $text = convert({'contents' => $contents}, $options);
my $result = Texinfo::Convert::Unicode::encoded_accents($text, $stack,
- $encoding, \&ascii_accent, $in_upper_case);
+ $encoding, \&ascii_accent, $set_case);
if (defined($result)) {
return $result;
} else {
- return ascii_accents($text, $stack, $in_upper_case);
+ return ascii_accents($text, $stack, $set_case);
}
}
@@ -606,15 +606,15 @@
an argument. The function returns a transliteration of the accented
character.
-=item $accents_text = text_accents($accents, $encoding, $in_upper_case)
+=item $accents_text = text_accents($accents, $encoding, $set_case)
I<$accents> is an accent command that may contain other nested accent
commands. The function will format the whole stack of nested accent
commands and the innermost text. If I<$encoding> is set, the formatted
text is converted to this encoding as much as possible instead of being
-converted as simple ascii. If I<$in_upper_case> is set, the result
-is meant to be upper-cased, if it is defined and false, the result is
-meant to be lower-cased.
+converted as simple ascii. If I<$set_case> is positive, the result
+is meant to be upper-cased, if it is negative, the result is to be
+lower-cased.
=back
Index: Unicode.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Unicode.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- Unicode.pm 18 Oct 2011 23:16:15 -0000 1.23
+++ Unicode.pm 22 Oct 2011 19:56:27 -0000 1.24
@@ -1262,7 +1262,7 @@
my $result = shift;
my $stack = shift;
my $format_accent = shift;
- my $in_upper_case = shift;
+ my $set_case = shift;
while (@$stack) {
my $formatted_result = unicode_accent($result, $stack->[-1]);
@@ -1271,14 +1271,16 @@
$result = $formatted_result;
pop @$stack;
}
- if ($in_upper_case) {
+ if ($set_case) {
+ if ($set_case > 0) {
$result = uc ($result);
- } elsif (defined($in_upper_case)) {
+ } else {
$result = lc ($result);
}
+ }
while (@$stack) {
my $accent_command = pop @$stack;
- $result = &$format_accent($result, $accent_command, $in_upper_case);
+ $result = &$format_accent($result, $accent_command, $set_case);
}
return $result;
}
@@ -1289,7 +1291,7 @@
my $stack = shift;
my $encoding = shift;
my $convert_accent = shift;
- my $in_upper_case = shift;
+ my $set_case = shift;
my $result = $unicode_formatted;
@@ -1310,8 +1312,8 @@
if (defined($unicode_formatted)) {
$unicode_formatted
= unicode_accent($unicode_formatted, $stack->[-1]);
- if (defined($unicode_formatted) and defined($in_upper_case)) {
- if ($in_upper_case) {
+ if (defined($unicode_formatted) and $set_case) {
+ if ($set_case > 0) {
$unicode_formatted = uc($unicode_formatted);
} else {
$unicode_formatted = lc($unicode_formatted);
@@ -1394,7 +1396,7 @@
while (@results_stack) {
$result = &$convert_accent($result,
$results_stack[0]->[1],
- $in_upper_case);
+ $set_case);
shift @results_stack;
}
@@ -1409,14 +1411,14 @@
my $stack = shift;
my $encoding = shift;
my $format_accent = shift;
- my $in_upper_case = shift;
+ my $set_case = shift;
if ($encoding) {
if ($encoding eq 'utf-8') {
- return unicode_accents($text, $stack, $format_accent, $in_upper_case);
+ return unicode_accents($text, $stack, $format_accent, $set_case);
} elsif ($Texinfo::Encoding::eight_bit_encoding_aliases{$encoding}) {
return eight_bit_accents($text, $stack, $encoding, $format_accent,
- $in_upper_case);
+ $set_case);
}
}
return undef;
@@ -1504,7 +1506,7 @@
an argument. The function returns the unicode representation of the accented
character.
-=item $result = encoded_accents ($text, $stack, $encoding, $format_accent,
$in_upper_case)
+=item $result = encoded_accents ($text, $stack, $encoding, $format_accent,
$set_case)
I<$text> is the text appearing within nested accent commands. I<$stack> is
an array reference holding the nested accents texinfo element trees. For
@@ -1515,8 +1517,8 @@
is a function reference that is used to format the accent commands if
there is no encoded character available for the encoding I<$encoding>
at some point of the conversion of the I<$stack>. Last, if
-I<$in_upper_case> is set, the result is upper-cased, while it is defined
-and flase, the result is lower-cased.
+I<$set_case> is positive, the result is upper-cased, while if it is negative,
+the result is lower-cased.
=item $result = unicode_text ($text, $in_code)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo/Convert HTML.pm Plaintext.pm...,
Patrice Dumas <=