[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Converter.pm (converter), tp
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/Converter.pm (converter), tp/Texinfo/Convert/*.pm (converter_defaults): have converter_defaults return a reference on a hash instead of a hash. |
Date: |
Thu, 03 Oct 2024 13:39:08 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new ee16d864c2 * tp/Texinfo/Convert/Converter.pm (converter),
tp/Texinfo/Convert/*.pm (converter_defaults): have converter_defaults return a
reference on a hash instead of a hash.
ee16d864c2 is described below
commit ee16d864c26447d9bd3a4f99e4fa996d45c0708b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 5 19:03:05 2024 +0200
* tp/Texinfo/Convert/Converter.pm (converter), tp/Texinfo/Convert/*.pm
(converter_defaults): have converter_defaults return a reference on a
hash instead of a hash.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/Converter.pm | 15 ++++++++-------
tp/Texinfo/Convert/DocBook.pm | 2 +-
tp/Texinfo/Convert/HTML.pm | 8 ++++----
tp/Texinfo/Convert/IXINSXML.pm | 2 +-
tp/Texinfo/Convert/Info.pm | 18 ++++++++++--------
tp/Texinfo/Convert/LaTeX.pm | 2 +-
tp/Texinfo/Convert/PlainTexinfo.pm | 2 +-
tp/Texinfo/Convert/Plaintext.pm | 2 +-
tp/Texinfo/Convert/TexinfoMarkup.pm | 1 +
tp/Texinfo/Convert/TexinfoSXML.pm | 2 +-
tp/Texinfo/Convert/TexinfoXML.pm | 2 +-
tp/Texinfo/Convert/Text.pm | 2 +-
tp/Texinfo/Convert/TextContent.pm | 2 +-
tp/Texinfo/DebugTree.pm | 2 +-
tp/texi2any.pl | 12 ++++++------
16 files changed, 45 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 492b373cf6..906970db24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-08-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (converter), tp/Texinfo/Convert/*.pm
+ (converter_defaults): have converter_defaults return a reference on a
+ hash instead of a hash.
+
2024-08-05 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Converter.pm (%XS_overrides, set_document),
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 091383586e..e3bfba5725 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -208,7 +208,7 @@ foreach my $ref_cmd ('pxref', 'xref', 'ref') {
# Functions that should be defined in specific converters
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
# should be redefined by specific converters
@@ -329,10 +329,10 @@ sub converter($;$)
bless $converter, $class;
- my %format_defaults = $converter->converter_defaults($conf);
+ my $format_defaults = $converter->converter_defaults($conf);
# if with XS, XS converter initialization.
- _generic_converter_init($converter, $class, \%format_defaults, $conf);
+ _generic_converter_init($converter, $class, $format_defaults, $conf);
$converter->converter_initialize();
@@ -2015,7 +2015,7 @@ Texinfo::Convert::Converter - Parent class for Texinfo
tree converters
@ISA = qw(Texinfo::Convert::Converter);
sub converter_defaults ($$) {
- return %myconverter_defaults;
+ return \%myconverter_defaults;
}
sub converter_initialize($) {
my $self = shift;
@@ -2212,11 +2212,12 @@ can define two methods:
=over
-=item %defaults = $converter->converter_defaults($options)
+=item \%defaults = $converter->converter_defaults($options)
X<C<converter_defaults>>
-The module can provide a defaults hash for converter customization options.
-The I<$options> hash reference holds options for the converter.
+The module can provide the reference on a hash with defaults for converter
+customization options. The I<$options> hash reference holds options for the
+converter.
=item converter_initialize
X<C<converter_initialize>>
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 99bbbb5d36..de90fdb0d8 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -283,7 +283,7 @@ my %sectioning_commands_done;
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 307bf7424b..a6f7ec1b91 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2719,11 +2719,11 @@ sub converter_defaults($$)
my $conf = shift;
if ($conf and defined($conf->{'TEXI2HTML'})) {
my $default_ref = { %defaults };
- my %texi2html_defaults = %$default_ref;
- _set_variables_texi2html(\%texi2html_defaults);
- return %texi2html_defaults;
+ my $texi2html_defaults = { %$default_ref };
+ _set_variables_texi2html($texi2html_defaults);
+ return $texi2html_defaults;
}
- return %defaults;
+ return \%defaults;
}
my %default_css_element_class_styles
diff --git a/tp/Texinfo/Convert/IXINSXML.pm b/tp/Texinfo/Convert/IXINSXML.pm
index 584dafc192..553e3d8c33 100644
--- a/tp/Texinfo/Convert/IXINSXML.pm
+++ b/tp/Texinfo/Convert/IXINSXML.pm
@@ -60,7 +60,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
# In the main program, the 'converted_format' needs to be 'ixinsxml'
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 19fd67e449..561c26d7cb 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -44,23 +44,25 @@ our $VERSION = '7.1.90';
my $STDIN_DOCU_NAME = 'stdin';
-my %defaults = Texinfo::Convert::Plaintext::converter_defaults(undef, undef);
+my $plaintext_defaults
+ = Texinfo::Convert::Plaintext::converter_defaults(undef, undef);
+my $defaults = { %$plaintext_defaults };
# Customization option variables
-$defaults{'FORMAT_MENU'} = 'menu';
-$defaults{'EXTENSION'} = 'info';
-$defaults{'USE_SETFILENAME_EXTENSION'} = 1;
-$defaults{'OUTFILE'} = undef;
+$defaults->{'FORMAT_MENU'} = 'menu';
+$defaults->{'EXTENSION'} = 'info';
+$defaults->{'USE_SETFILENAME_EXTENSION'} = 1;
+$defaults->{'OUTFILE'} = undef;
# in the Emacs Info reader and in old readers, DEL character will appear,
# but the node names are problematic in those readers, so it is not
# such an issue to have them marked that way.
-$defaults{'INFO_SPECIAL_CHARS_QUOTE'} = 1;
+$defaults->{'INFO_SPECIAL_CHARS_QUOTE'} = 1;
# set as default independently of INFO_SPECIAL_CHARS_QUOTE as long
# as the Emacs Info reader does not support node names quoting.
-$defaults{'INFO_SPECIAL_CHARS_WARNING'} = 1;
+$defaults->{'INFO_SPECIAL_CHARS_WARNING'} = 1;
sub converter_defaults($$)
{
- return %defaults;
+ return $defaults;
}
sub output($$)
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 98a2eba6d3..33c8c83a31 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -800,7 +800,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
# Converter state keys:
diff --git a/tp/Texinfo/Convert/PlainTexinfo.pm
b/tp/Texinfo/Convert/PlainTexinfo.pm
index 1b0a7e5982..143b4650d5 100644
--- a/tp/Texinfo/Convert/PlainTexinfo.pm
+++ b/tp/Texinfo/Convert/PlainTexinfo.pm
@@ -64,7 +64,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
sub _convert_tree_with_XS($)
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index d3cd043954..66e73399b3 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -410,7 +410,7 @@ sub pop_top_formatter($)
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
sub conversion_initialization($;$)
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index add68e2526..f50b0cb100 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -274,6 +274,7 @@ my %default_context_block_commands = (
# converter_defaults() should be implemented by subclasses.
sub converter_defaults($$)
{
+ return undef;
}
sub converter_initialize($)
diff --git a/tp/Texinfo/Convert/TexinfoSXML.pm
b/tp/Texinfo/Convert/TexinfoSXML.pm
index b3d764ebd0..5e80586821 100644
--- a/tp/Texinfo/Convert/TexinfoSXML.pm
+++ b/tp/Texinfo/Convert/TexinfoSXML.pm
@@ -48,7 +48,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
# TODO protect formfeeds, end of lines and other special spaces as in
TexinfoXML?
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index edcec01390..92bb4a018b 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -52,7 +52,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index fd4d953b99..ced2961966 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -1086,7 +1086,7 @@ sub get_converter_errors($)
sub converter_defaults()
{
- return ();
+ return undef;
}
sub output_files_information($)
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 0014cdf858..7f5b1c0a1b 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -66,7 +66,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
my %formatted_line_commands = %Texinfo::Commands::formatted_line_commands;
diff --git a/tp/Texinfo/DebugTree.pm b/tp/Texinfo/DebugTree.pm
index a2d1c22728..8db4501e0a 100644
--- a/tp/Texinfo/DebugTree.pm
+++ b/tp/Texinfo/DebugTree.pm
@@ -42,7 +42,7 @@ my %defaults = (
sub converter_defaults($$)
{
- return %defaults;
+ return \%defaults;
}
sub output($$)
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 5efc919617..39b76ef911 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1549,8 +1549,6 @@ if (get_conf('SPLIT') and
!$formats_table{$converted_format}->{'split'}) {
add_to_option_list('EXPANDED_FORMATS', $default_expanded_format);
-my %converter_defaults;
-
if (defined($formats_table{$converted_format}->{'module'})) {
# Speed up initialization by only loading the module we need.
my $module = $formats_table{$converted_format}->{'module'};
@@ -1581,13 +1579,15 @@ if
(defined($formats_table{$converted_format}->{'module'})) {
# $cmdline_options is passed to have command line settings, here
# in practice TEXI2HTML set, for conversion to HTML to select
# possibly different customization variable values.
- %converter_defaults = $converter_class->converter_defaults($cmdline_options);
- if (defined($converter_defaults{'FORMAT_MENU'})) {
+ my $converter_defaults
+ = $converter_class->converter_defaults($cmdline_options);
+ if (defined($converter_defaults->{'FORMAT_MENU'})) {
# could be done for other customization options
- set_main_program_default('FORMAT_MENU',
$converter_defaults{'FORMAT_MENU'});
+ set_main_program_default('FORMAT_MENU',
+ $converter_defaults->{'FORMAT_MENU'});
# for FORMAT_MENU need in addition to have the value if
# command-line set to 'set_format_menu_from_cmdline_header_option'
- $conversion_format_menu_default = $converter_defaults{'FORMAT_MENU'};
+ $conversion_format_menu_default = $converter_defaults->{'FORMAT_MENU'};
} else {
# this happens for the plaintexinfo format for which nothing
# is set.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Converter.pm (converter), tp/Texinfo/Convert/*.pm (converter_defaults): have converter_defaults return a reference on a hash instead of a hash.,
Patrice Dumas <=