[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8046] remove gettext as config value
From: |
gavinsmith0123 |
Subject: |
[8046] remove gettext as config value |
Date: |
Sun, 12 Aug 2018 15:40:47 -0400 (EDT) |
Revision: 8046
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8046
Author: gavin
Date: 2018-08-12 15:40:47 -0400 (Sun, 12 Aug 2018)
Log Message:
-----------
remove gettext as config value
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Common.pm
trunk/tp/Texinfo/Convert/Converter.pm
trunk/tp/Texinfo/Parser.pm
trunk/tp/Texinfo/Report.pm
trunk/tp/texi2any.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2018-08-12 19:01:17 UTC (rev 8045)
+++ trunk/ChangeLog 2018-08-12 19:40:47 UTC (rev 8046)
@@ -1,5 +1,29 @@
2018-08-12 Gavin Smith <address@hidden>
+ * tp/Texinfo/Common.pm (%default_parser_state_configuration):
+ Remove 'gettext' and 'pgettext'.
+ * tp/texi2any.pl ($parser_default_options): Remove 'gettext' and
+ 'pgettext'.
+ * tp/Texinfo/Parser.pm (%parser_default_configration_subs):
+ (%parser_default_configration_no_subs): Remove. There are no
+ subroutines in the parser configuration any more.
+ (_setup_parser_default_configuration): Remove.
+ (parser, simple_parser): Call dclone directly instead of
+ _setup_parser_default_configuration. Do not check for CODE
+ values on the parser hash object when duplicating a parser.
+ (_setup_conf): Do not check for CODE values on the parser hash
+ object when copying a parser configuration.
+ (MODULE DOCUMENTATION SECTION): Remove mention of 'gettext'
+ configuration.
+ * tp/Texinfo/Common.pm (warn_unknown_language, warn_unknown_split):
+ Do not take a 'gettext' argument. Callers updated.
+ * tp/Texinfo/Report.pm (new): Do not set 'gettext' or 'pgettext'
+ on object.
+ * tp/Texinfo/Convert/Converter.pm (converter): Do not set
+ 'gettext' or 'pgettext' on object.
+
+2018-08-12 Gavin Smith <address@hidden>
+
* tp/Texinfo/Common.pm (__, __p): Copy functions from
texi2any.pl. Place these in @EXPORT.
(%default_parser_state_configuration): Refer to __ and __p
Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm 2018-08-12 19:01:17 UTC (rev 8045)
+++ trunk/tp/Texinfo/Common.pm 2018-08-12 19:40:47 UTC (rev 8046)
@@ -112,8 +112,6 @@
# don't want Texinfo::Common to use Texinfo::Parser.
our %default_parser_state_configuration = (
'expanded_formats' => [],
- 'gettext' => \&__,
- 'pgettext' => \&__p,
'include_directories' => [ '.' ],
# these are the user-added indices. May be an array reference on names
# or an hash reference in the same format than %index_names below
@@ -1091,9 +1089,8 @@
return $filehandle;
}
-sub warn_unknown_language($$) {
+sub warn_unknown_language($) {
my $lang = shift;
- my $gettext = shift;
my @messages = ();
my $lang_code = $lang;
@@ -1105,12 +1102,12 @@
}
if (! $Texinfo::Documentlanguages::language_codes{$lang_code}) {
- push @messages, sprintf(&$gettext(N__("%s is not a valid language code")),
+ push @messages, sprintf(__("%s is not a valid language code"),
$lang_code);
}
if (defined($region_code)
and ! $Texinfo::Documentlanguages::region_codes{$region_code}) {
- push @messages, sprintf(&$gettext(N__("%s is not a valid region code")),
+ push @messages, sprintf(__("%s is not a valid region code"),
$region_code);
}
return @messages;
@@ -1122,14 +1119,12 @@
'node' => 1,
);
-sub warn_unknown_split($$) {
+sub warn_unknown_split($) {
my $split = shift;
- my $gettext = shift;
my @messages = ();
if ($split and !$possible_split{$split}) {
- push @messages, sprintf(&$gettext(N__("%s is not a valid split
possibility")),
- $split);
+ push @messages, sprintf(__("%s is not a valid split possibility"), $split);
}
return @messages;
}
Modified: trunk/tp/Texinfo/Convert/Converter.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Converter.pm 2018-08-12 19:01:17 UTC (rev
8045)
+++ trunk/tp/Texinfo/Convert/Converter.pm 2018-08-12 19:40:47 UTC (rev
8046)
@@ -244,8 +244,6 @@
}
}
}
- $converter->{'gettext'} = $converter->{'parser'}->{'gettext'};
- $converter->{'pgettext'} = $converter->{'parser'}->{'pgettext'};
delete $conf->{'parser'};
}
foreach my $key (keys(%$conf)) {
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2018-08-12 19:01:17 UTC (rev 8045)
+++ trunk/tp/Texinfo/Parser.pm 2018-08-12 19:40:47 UTC (rev 8046)
@@ -143,16 +143,6 @@
my %parser_default_configuration =
(%Texinfo::Common::default_parser_state_configuration,
%default_customization_values);
-# split subs/no subs to help dclone that cannot clone subs
-my %parser_default_configuration_subs = ();
-my %parser_default_configuration_no_subs = %parser_default_configuration;
-foreach my $key(keys(%parser_default_configuration)) {
- if (ref($parser_default_configuration{$key}) eq 'CODE') {
- $parser_default_configuration_subs{$key}
- = delete $parser_default_configuration_no_subs{$key};
- }
-}
-
# the other possible keys for the parser state are:
#
# expanded_formats_hash each key comes from expanded_formats value is 1
@@ -574,7 +564,7 @@
if (defined($conf)) {
foreach my $key (keys(%$conf)) {
if (exists($parser_default_configuration{$key})) {
- if (ref($conf->{$key}) ne 'CODE' and $key ne 'values' and
ref($conf->{$key})) {
+ if ($key ne 'values' and ref($conf->{$key})) {
$parser->{$key} = dclone($conf->{$key});
} else {
$parser->{$key} = $conf->{$key};
@@ -589,16 +579,6 @@
}
}
-sub _setup_parser_default_configuration()
-{
- # _deep_copy/dclone doesn't handle subs
- my $parser = dclone(\%parser_default_configuration_no_subs);
- foreach my $key(keys(%parser_default_configuration_subs)) {
- $parser->{$key} = $parser_default_configuration_subs{$key};
- }
- return $parser;
-}
-
# initialization entry point. Set up a parser.
# The last argument, optional, is a hash provided by the user to change
# the default values for what is present in %parser_default_configuration.
@@ -609,7 +589,7 @@
my $class = shift;
my $conf;
- my $parser = _setup_parser_default_configuration();
+ my $parser = dclone(\%parser_default_configuration);
# called not object-oriented
if (ref($class) eq 'HASH') {
@@ -629,7 +609,7 @@
= $old_parser->{$key}->{$info_key};
}
}
- } elsif(ref($old_parser->{$key}) and ref($old_parser->{$key}) ne 'CODE')
{
+ } elsif(ref($old_parser->{$key})) {
$parser->{$key} = dclone($old_parser->{$key});
} else {
$parser->{$key} = $old_parser->{$key};
@@ -735,7 +715,7 @@
{
my $conf = shift;
- my $parser = _setup_parser_default_configuration();
+ my $parser = dclone(\%parser_default_configuration);
bless $parser;
_setup_conf($parser, $conf, "Texinfo::Parser::simple_parser");
@@ -3163,8 +3143,7 @@
}
}
} elsif ($command eq 'documentlanguage') {
- my @messages = Texinfo::Common::warn_unknown_language($text,
- $self->{'gettext'});
+ my @messages = Texinfo::Common::warn_unknown_language($text);
foreach my $message(@messages) {
$self->_command_warn($current, $line_nr, $message);
}
@@ -5951,12 +5930,6 @@
An array reference of the output formats for which C<@ifI<FORMAT>>
conditional blocks should be expanded. Default is empty.
-=item gettext
-
-If set, the function reference is used to translate error and warning
-messages. It takes a string as argument and returns a string. The default
-function returns the error message as-is.
-
=item GLOBAL_COMMANDS
The associated value is a reference on an array. All the commands in the
Modified: trunk/tp/Texinfo/Report.pm
===================================================================
--- trunk/tp/Texinfo/Report.pm 2018-08-12 19:01:17 UTC (rev 8045)
+++ trunk/tp/Texinfo/Report.pm 2018-08-12 19:40:47 UTC (rev 8046)
@@ -64,8 +64,6 @@
$self->{'errors_warnings'} = [];
#print STDERR "REPORT NEW $self $self->{'errors_warnings'}\n";
$self->{'errors_nrs'} = 0;
- $self->{'gettext'} = sub {return $_[0];} if (!defined($self->{'gettext'}));
- $self->{'pgettext'} = sub {return $_[1];} if (!defined($self->{'pgettext'}));
return $self;
}
Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl 2018-08-12 19:01:17 UTC (rev 8045)
+++ trunk/tp/texi2any.pl 2018-08-12 19:40:47 UTC (rev 8046)
@@ -522,9 +522,7 @@
# options for all the files
my $parser_default_options = {'expanded_formats' => [],
- 'values' => {'txicommandconditionals' => 1},
- 'gettext' => \&__,
- 'pgettext' => \&__p,};
+ 'values' => {'txicommandconditionals' => 1}};
Texinfo::Config::_load_config($converter_default_options, $cmdline_options);
@@ -897,7 +895,7 @@
},
'split=s' => sub { my $split = $_[1];
my @messages
- = Texinfo::Common::warn_unknown_split($_[1], \&__);
+ = Texinfo::Common::warn_unknown_split($_[1]);
if (@messages) {
foreach my $message (@messages) {
document_warn($message);
@@ -931,7 +929,7 @@
set_from_cmdline('documentlanguage', $_[1]);
$parser_default_options->{'documentlanguage'} = $_[1];
my @messages
- = Texinfo::Common::warn_unknown_language($_[1], \&__);
+ = Texinfo::Common::warn_unknown_language($_[1]);
foreach my $message (@messages) {
document_warn($message);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8046] remove gettext as config value,
gavinsmith0123 <=