[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve... |
Date: |
Wed, 30 Nov 2011 00:11:17 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/11/30 00:11:17
Modified files:
tp : TODO
tp/Texinfo : Parser.pm
tp/Texinfo/Convert: Converter.pm Plaintext.pm Text.pm
Log message:
In plaintext output internationalize definition lines.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.226&r2=1.227
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.337&r2=1.338
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.191&r2=1.192
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.84&r2=1.85
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -b -r1.226 -r1.227
--- TODO 23 Nov 2011 22:35:16 -0000 1.226
+++ TODO 30 Nov 2011 00:11:11 -0000 1.227
@@ -5,9 +5,7 @@
Before next release
===================
-Internationalize 'error-->'. FIXME in the code.
-
-In plaintext output internationalize definition lines like
+In HTML output internationalize definition lines along
gdt(' -- {category} of {class}: {type} {name} {arguments}')
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.337
retrieving revision 1.338
diff -u -b -r1.337 -r1.338
--- Texinfo/Parser.pm 23 Nov 2011 22:35:16 -0000 1.337
+++ Texinfo/Parser.pm 30 Nov 2011 00:11:16 -0000 1.338
@@ -3734,7 +3734,9 @@
if ($line =~ s/^{([\w\-]+)}//) {
my $value = $1;
if (exists($self->{'values'}->{$value})) {
- if (!ref($self->{'values'}->{$value})) {
+ if (!defined($self->{'values'}->{$value})) {
+ print STDERR "BUG? $value exists but not defined\n";
+ } elsif (!ref($self->{'values'}->{$value})) {
$line = $self->{'values'}->{$value} . $line;
# the push @{$current->{'contents'}}, {}; prevents a trailing
# text to be merged, to avoid having the value tree modified.
Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- Texinfo/Convert/Converter.pm 25 Nov 2011 00:31:19 -0000 1.67
+++ Texinfo/Convert/Converter.pm 30 Nov 2011 00:11:16 -0000 1.68
@@ -779,7 +779,8 @@
'dots' => '…',
'enddots' => '...',
'equiv' => '≡',
-# FIXME i18n
+ # in general the following is not used since error
+ # appears in 'translated_commands'
'error' => 'error-->',
'expansion' => '→',
'arrow' => '→',
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -b -r1.191 -r1.192
--- Texinfo/Convert/Plaintext.pm 25 Nov 2011 00:31:19 -0000 1.191
+++ Texinfo/Convert/Plaintext.pm 30 Nov 2011 00:11:16 -0000 1.192
@@ -2137,20 +2137,112 @@
} elsif ($root->{'type'} eq 'def_line') {
if ($root->{'extra'} and $root->{'extra'}->{'def_args'}
and @{$root->{'extra'}->{'def_args'}}) {
- my $parsed_definition_category
- = Texinfo::Common::definition_category ($self, $root);
- # FIXME(Karl) should the definition line formating use gdt?
- my @contents = ($parsed_definition_category, {'text' => ': '});
- if ($root->{'extra'}->{'def_parsed_hash'}->{'type'}) {
- push @contents, ($root->{'extra'}->{'def_parsed_hash'}->{'type'},
- {'text' => ' '});
+ my $arguments = Texinfo::Common::definition_arguments_content($root);
+ my $tree;
+ my $command;
+ if ($Texinfo::Common::def_aliases{$root->{'extra'}->{'def_command'}}) {
+ $command =
$Texinfo::Common::def_aliases{$root->{'extra'}->{'def_command'}};
+ } else {
+ $command = $root->{'extra'}->{'def_command'};
+ }
+ my $name;
+ if ($root->{'extra'}->{'def_parsed_hash'}->{'name'}) {
+ $name = $root->{'extra'}->{'def_parsed_hash'}->{'name'};
+ } else {
+ $name = '';
}
- push @contents, $root->{'extra'}->{'def_parsed_hash'}->{'name'};
- my $arguments = Texinfo::Common::definition_arguments_content($root);
+
+ if ($command eq 'deffn'
+ or $command eq 'defvr'
+ or $command eq 'deftp'
+ or (($command eq 'deftypefn'
+ or $command eq 'deftypevr')
+ and !$root->{'extra'}->{'def_parsed_hash'}->{'type'})) {
+ if ($arguments) {
+ $tree = $self->gdt("address@hidden }-- {category}: {name}
{arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category}: {name}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name});
+ }
+ } elsif ($command eq 'deftypefn'
+ or $command eq 'deftypevr') {
+ if ($arguments) {
+ $tree = $self->gdt("address@hidden }-- {category}: {type} {name}
{arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category}: {type} {name}",
{
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'name' => $name});
+ }
+ } elsif ($command eq 'defcv'
+ or ($command eq 'deftypecv'
+ and !$root->{'extra'}->{'def_parsed_hash'}->{'type'})) {
if ($arguments) {
- push @contents, {'text' => ' '};
- push @contents, @$arguments;
+ $tree = $self->gdt("address@hidden }-- {category} of {class}:
{name} {arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category} of {class}:
{name}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'name' => $name});
+ }
+ } elsif ($command eq 'defop'
+ or ($command eq 'deftypeop'
+ and !$root->{'extra'}->{'def_parsed_hash'}->{'type'})) {
+ if ($arguments) {
+ $tree = $self->gdt("address@hidden }-- {category} on {class}:
{name} {arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category} on {class}:
{name}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'name' => $name});
+ }
+ } elsif ($command eq 'deftypeop') {
+ if ($arguments) {
+ $tree = $self->gdt("address@hidden }-- {category} on {class}:
{type} {name} {arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category} on {class}:
{type} {name}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'name' => $name});
+ }
+ } elsif ($command eq 'deftypecv') {
+ if ($arguments) {
+ $tree = $self->gdt("address@hidden }-- {category} of {class}:
{type} {name} {arguments}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'name' => $name,
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'arguments' => $arguments});
+ } else {
+ $tree = $self->gdt("address@hidden }-- {category} of {class}:
{type} {name}", {
+ 'category' =>
$root->{'extra'}->{'def_parsed_hash'}->{'category'},
+ 'type' => $root->{'extra'}->{'def_parsed_hash'}->{'type'},
+ 'class' =>
$root->{'extra'}->{'def_parsed_hash'}->{'class'},
+ 'name' => $name});
+ }
}
my $def_paragraph = $self->new_formatter('paragraph',
@@ -2158,9 +2250,7 @@
'indent_length_next' =>
(1+$self->{'format_context'}->[-1]->{'indent_level'})*$indent_length});
push @{$self->{'formatters'}}, $def_paragraph;
- $result .= $self->_count_added($def_paragraph->{'container'},
- $def_paragraph->{'container'}->add_next(" -- "));
- $result .= $self->_convert({'type' => 'code', 'contents' =>
address@hidden);
+ $result .= $self->_convert({'type' => 'code', 'contents' => [$tree]});
$result .= $self->_count_added($def_paragraph->{'container'},
$def_paragraph->{'container'}->end());
Index: Texinfo/Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- Texinfo/Convert/Text.pm 25 Nov 2011 00:31:20 -0000 1.84
+++ Texinfo/Convert/Text.pm 30 Nov 2011 00:11:16 -0000 1.85
@@ -78,7 +78,6 @@
'dots' => '...',
'enddots' => '...',
'equiv' => '==',
-# FIXME i18n
'error' => 'error-->',
'expansion' => '==>',
'arrow' => '->',