texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Conver


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm, tp/texi2any.pl: add more default values for command line options and customizations, separating specific main program and parser customization options, and command line set from other options. Use the defaults in Texinfo::Convert::Converter and in texi2any.pl.
Date: Thu, 02 Sep 2021 17:18:11 -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 6a1c3dd  * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm, 
tp/texi2any.pl: add more default values for command line options and 
customizations, separating specific main program and parser customization 
options, and command line set from other options.  Use the defaults in 
Texinfo::Convert::Converter and in texi2any.pl.
6a1c3dd is described below

commit 6a1c3dd6c7c6995f9ef1a00cab6cb9455c1f71d0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Sep 2 23:18:02 2021 +0200

    * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm,
    tp/texi2any.pl: add more default values for command
    line options and customizations, separating specific main
    program and parser customization options, and command line
    set from other options.  Use the defaults in
    Texinfo::Convert::Converter and in texi2any.pl.
    
    * tp/Texinfo/Config.pm (texinfo_add_to_option_list)
    (texinfo_remove_from_option_list), tp/texi2any.pl,
    tp/t/init/t2h_singular.init: handle list options differently than
    string options.  Indeed, the lists need to be defined in the
    main program, therefore the main program list options would
    always take precedence if there is a precedence, and the list
    options set from init file would not have any effect. For
    list options, items are added and removed by calls to
    texinfo_add_to_option_list and texinfo_remove_from_option_list,
    be it from command line or init files, there is no precedence,
    but the order of calls matter.
    Rename $default_options as $main_program_default_options.
    
    * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
    tp/Texinfo/Convert/Unicode.pm, tp/Texinfo/Structuring.pm,
    tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm: load
    needed used modules explicitely.
    * tp/Texinfo/Convert/Text.pm: do not inherit
    Texinfo::Convert::Converter.
    
    * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/Text.pm,
    tp/texi2any.pl, tp/t/init/t2h_singular.init, tp/texi2any.pl:
    handle 'EXPANDED_FORMATS' like a normal customization option in
    converters, in particular replacing 'expanded_formats'.
---
 ChangeLog                            |  34 ++++++++
 tp/Texinfo/Common.pm                 | 156 ++++++++++++++++++++++++++---------
 tp/Texinfo/Config.pm                 |  62 ++++++++++++--
 tp/Texinfo/Convert/Converter.pm      |  56 ++++++-------
 tp/Texinfo/Convert/HTML.pm           |   4 +-
 tp/Texinfo/Convert/Text.pm           |   5 +-
 tp/Texinfo/Convert/Unicode.pm        |   2 +
 tp/Texinfo/Structuring.pm            |   2 +
 tp/Texinfo/XS/parsetexi/Parsetexi.pm |   3 +-
 tp/init/chm.pm                       |   5 ++
 tp/t/16raw.t                         |   2 +-
 tp/t/92formatting.t                  |   6 +-
 tp/t/converters_tests.t              |   6 +-
 tp/t/html_tests.t                    |   2 +-
 tp/t/init/t2h_singular.init          |   7 +-
 tp/t/plaintext_tests.t               |   6 +-
 tp/t/test_sort.t                     |  11 +--
 tp/t/test_utils.pl                   |   4 +-
 tp/texi2any.pl                       | 119 ++++++++++++++------------
 19 files changed, 332 insertions(+), 160 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b45129f..8d643f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,39 @@
 2021-09-02  Patrice Dumas  <pertusus@free.fr>
 
+       * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm,
+       tp/texi2any.pl: add more default values for command
+       line options and customizations, separating specific main
+       program and parser customization options, and command line
+       set from other options.  Use the defaults in
+       Texinfo::Convert::Converter and in texi2any.pl.
+
+       * tp/Texinfo/Config.pm (texinfo_add_to_option_list)
+       (texinfo_remove_from_option_list), tp/texi2any.pl,
+       tp/t/init/t2h_singular.init: handle list options differently than
+       string options.  Indeed, the lists need to be defined in the
+       main program, therefore the main program list options would
+       always take precedence if there is a precedence, and the list
+       options set from init file would not have any effect. For
+       list options, items are added and removed by calls to
+       texinfo_add_to_option_list and texinfo_remove_from_option_list,
+       be it from command line or init files, there is no precedence,
+       but the order of calls matter.
+       Rename $default_options as $main_program_default_options.
+
+       * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
+       tp/Texinfo/Convert/Unicode.pm, tp/Texinfo/Structuring.pm,
+       tp/Texinfo/XS/parsetexi/Parsetexi.pm, tp/init/chm.pm: load
+       needed used modules explicitely.
+       * tp/Texinfo/Convert/Text.pm: do not inherit
+       Texinfo::Convert::Converter.
+
+       * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/Text.pm,
+       tp/texi2any.pl, tp/t/init/t2h_singular.init, tp/texi2any.pl:
+       handle 'EXPANDED_FORMATS' like a normal customization option in
+       converters, in particular replacing 'expanded_formats'.
+
+2021-09-02  Patrice Dumas  <pertusus@free.fr>
+
        * NEWS: document that L2H was removed.
 
        * tp/Texinfo/Config.pm (_GNUT_map_obsolete_options),
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index db390a1..d0d0334 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -30,6 +30,13 @@ use Config;
 use File::Spec;
 
 use Texinfo::Documentlanguages;
+# used in functions, but Texinfo::Convert::Texinfo uses
+# Texinfo::Common in main module, so needs to be loaded after
+#use Texinfo::Convert::Texinfo;
+# same reason as above, and in addition Texinfo::Convert::NodeNameNormalization
+# loads most of the other modules, we may not want to load those modules
+# early.
+#use Texinfo::Convert::NodeNameNormalization;
 
 # debugging
 use Carp qw(cluck);
@@ -100,26 +107,39 @@ sub __p($$) {
   return Locale::Messages::dpgettext($messages_textdomain, $context, $msgid);
 }
 
-
-# Customization variables obeyed by the parser, and the default values.
-our %default_parser_customization_values = (
+# not specific of Parser, used in other contexts.  Spread over the different
+# categories set below.  The default values are in general the same as
+# elsewheere, but occasionally may be specific of the Parser.
+my %default_parser_common_customization = (
   'INCLUDE_DIRECTORIES' => [ '.' ],
-  'documentlanguage' => undef,
-  'novalidate' => undef,
+  'documentlanguage' => undef,  # not 'en' as it is better to specify that 
there is no
+                                # need for translation since the strings are 
in english
+                                # rather than ask for translations to en
+  'novalidate' => undef,   # --no-validate
   'EXPANDED_FORMATS' => [],
   'DEBUG' => 0,     # if >= 10, tree is printed in texi2any.pl after parsing.
                     # If >= 100 tree is printed every line.
   'FORMAT_MENU' => 'menu',           # if not 'menu' no menu error related.
+  # This is not used directly, but passed to Convert::Text through
+  # Texinfo::Common::_convert_text_options
+  'ENABLE_ENCODING' => undef,     # output accented and special characters
+                                  # based on @documentencoding
+);
+
+# Customization variables obeyed only by the parser, and the default values.
+my %default_parser_specific_customization = (
   'IGNORE_BEFORE_SETFILENAME' => 1,
   'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME' => 1,
   'CPP_LINE_DIRECTIVES' => 1, # handle cpp like synchronization lines
   'MAX_MACRO_CALL_NESTING' => 100000, # max number of nested macro calls
-  # This is not used directly, but passed to Convert::Text through 
-  # Texinfo::Common::_convert_text_options
-  'ENABLE_ENCODING' => 1,     # output accented and special characters
-                              # based on @documentencoding
 );
 
+# this serves both to set defaults and list configuration options
+# valid for the parser.
+our %default_parser_customization_values = 
(%default_parser_common_customization,
+  %default_parser_specific_customization);
+
+
 # Customization variables set in the parser for other modules, and the
 # default values.
 our %default_structure_customization_values = (
@@ -127,11 +147,12 @@ our %default_structure_customization_values = (
   'CHECK_NORMAL_MENU_STRUCTURE' => 0, # output warnings when node with
             # automatic direction does directions in menu are not consistent
             # with sectionning, and when node directions are not consistent
-            # with menu directions
+            # with menu directions.  Used in complete_node_tree_with_menus()
 );
 
 
-# customization options
+# @-commands that can be used multiple time in a document and default
+# values.  Associated with customization values too.
 our %document_settable_multiple_at_commands = (
   'allowcodebreaks' => 'true',
   'clickstyle' => '@arrow',
@@ -140,7 +161,7 @@ our %document_settable_multiple_at_commands = (
   'contents' => 0,
   'deftypefnnewline' => 'off',
   'documentencoding' => 'us-ascii',
-  'documentlanguage' => 'en',
+  'documentlanguage' => 'en', # or undef?  Documented as en. Also 
--document-language
   # is N ems in TeX, 0.4 in.
   'exampleindent' => 5,
   'firstparagraphindent' => 'none',
@@ -153,7 +174,7 @@ our %document_settable_multiple_at_commands = (
   'xrefautomaticsectiontitle' => 'off',
 );
 
-# those should be unique
+# @-commands that should be unique.  Associated with customization values too.
 our %document_settable_unique_at_commands = (
   # when passed through a configuration variable, documentdescription
   # should be already formatted for HTML.  There is no default,
@@ -164,7 +185,7 @@ our %document_settable_unique_at_commands = (
   'everyfootingmarks' => 'bottom', 
   'everyheadingmarks' => 'bottom',
   'fonttextsize' => 11, 
-  'footnotestyle' => 'end', 
+  'footnotestyle' => 'end',    # also --footnote-style
   'novalidate' => 0,
   'oddfootingmarks' => undef,
   'oddheadingmarks' => undef,
@@ -181,21 +202,79 @@ our %document_settable_unique_at_commands = (
   # FIXME add afourpaper and similar?
 );
 
-my @command_line_settables = (
-  'CASE_INSENSITIVE_FILENAMES', 'ENABLE_ENCODING', 'ERROR_LIMIT',
-  'FILLCOLUMN', 'FORCE', 'HEADERS', 'INTERNAL_LINKS', 'MACRO_EXPAND',
-  'NODE_FILES', 'NO_WARN', 'NUMBER_FOOTNOTES', 'NUMBER_SECTIONS',
-  'OUTFILE', 'SPLIT', 'SPLIT_SIZE', 'SUBDIR', 'TRANSLITERATE_FILE_NAMES',
-  'VERBOSE'
+# a value corresponds to defaults that are the same for every output format
+# otherwise undef is used
+our %default_converter_command_line_options = (
+  'SPLIT_SIZE'           => 300000,  # --split-size
+  'FILLCOLUMN'           => 72,      # --fill-column
+  'NUMBER_SECTIONS'      => 1,       # --number-sections
+  'NUMBER_FOOTNOTES'     => 1,       # --number-footnotes
+  # only in HTML
+  'TRANSLITERATE_FILE_NAMES' => 1,   # --transliterate-file-names
+  'SPLIT'                => undef,   # --split
+  'HEADERS'              => 1,       # --headers.  Used to set diverse 
customization options
+                                     # in main program.  Only directly used in 
HTML converter
+  'FORMAT_MENU'          => undef,   # --headers.  Modified by the format.
+  'NODE_FILES'           => undef,   # --node-files.  Depend on SPLIT
+  'VERBOSE'              => undef,   # --verbose
+  'OUTFILE'              => undef,   # --output    If non split and not ending 
by /. 
+                                     # Setting can be format dependent
+  'SUBDIR'               => undef,   # --output    If split or ending by /.
+                                     # Setting can be format dependent
+  'ENABLE_ENCODING'      => undef,   # --disable-encoding/--enable-encoding.  
The documentation
+                                     # only mentions Info and plain text, but 
the option is used
+                                     # in many formats, with differing 
defaults.  The default expected
+                                     # by the converters is to be unset, 
although for Info and
+                                     # plain text, default is set.  If set, it 
is set in the formats
+                                     # converter defaults.
+);
+
+# only used in main program, defaults documented in manual
+my %default_main_program_command_line_options = (
+  'MACRO_EXPAND'         => undef,   # --macro-expand
+  # used in HTML only, called from main program
+  'INTERNAL_LINKS'       => undef,   # --internal-links
+  'ERROR_LIMIT'          => 100,     # --error-limit
+  'FORCE'                => undef,   # --force
+  'NO_WARN'              => undef,   # --no-warn
+);
+
+# used in main program, defaults documented in manual
+my %default_main_program_customization = (
+  'SORT_ELEMENT_COUNT_WORDS'    => undef,
+  'SORT_ELEMENT_COUNT'          => undef,
+  'TEXI2DVI'                    => 'texi2dvi',
+  'TREE_TRANSFORMATIONS'        => undef,
+  'DUMP_TREE'                   => undef,
+  'DUMP_TEXI'                   => undef,
+);
+
+# defaults for the main program.  In general transmitted to converters as 
defaults
+our %default_main_program_customization_options = (
+ %default_main_program_command_line_options,  
%default_main_program_customization);
+
+# used in converters, default documented in manual
+our %default_converter_customization = (
+  'TOP_NODE_UP'           => '(dir)',   # up node of Top node default value
+  'BASEFILENAME_LENGTH'   => 255 - 10,
+  # only used in HTML
+  'IMAGE_LINK_PREFIX'     => undef,
+  'CASE_INSENSITIVE_FILENAMES' => 0,
+  'DEBUG'                 => 0,
+  'TEST'                  => 0,
+  'TEXTCONTENT_COMMENT',  => undef,  # in textcontent format
 );
 
+# Some are for all converters, EXTENSION for instance, some for
+# some converters, for example CLOSE_QUOTE_SYMBOL and many
+# for HTML.  Could be added to %default_converter_customization.
+# Defaults are documented in manual and set in the various converters.
 our @variable_string_settables = (
 'AFTER_ABOUT',
 'AFTER_BODY_OPEN',
 'AFTER_OVERVIEW',
 'AFTER_TOC_LINES',
 'AVOID_MENU_REDUNDANCY',
-'BASEFILENAME_LENGTH',
 'BEFORE_OVERVIEW',
 'BEFORE_TOC_LINES',
 'BIG_RULE',
@@ -207,16 +286,12 @@ our @variable_string_settables = (
 'CLOSE_QUOTE_SYMBOL',
 'COMPLEX_FORMAT_IN_TABLE',
 'CONTENTS_OUTPUT_LOCATION',
-'CPP_LINE_DIRECTIVES',
 'CSS_LINES',
 'DATE_IN_HEADER',
-'DEBUG',
 'DEFAULT_RULE',
 'DEF_TABLE',
 'DO_ABOUT',
 'DOCTYPE',
-'DUMP_TEXI',
-'DUMP_TREE',
 'ENABLE_ENCODING_USE_ENTITY',
 'EXTENSION',
 'EXTERNAL_CROSSREF_SPLIT',
@@ -230,8 +305,6 @@ our @variable_string_settables = (
 'HTML_MATH',
 'HTMLXREF',
 'ICONS',
-'IGNORE_BEFORE_SETFILENAME',
-'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME',
 'IMAGE_LINK_PREFIX',
 'INDEX_ENTRY_COLON',
 'INDEX_SPECIAL_CHARS_WARNING',
@@ -251,7 +324,6 @@ our @variable_string_settables = (
 'MATHJAX_SCRIPT',
 'MATHJAX_SOURCE',
 'MAX_HEADER_LEVEL',
-'MAX_MACRO_CALL_NESTING',
 'MENU_ENTRY_COLON',
 'MENU_SYMBOL',
 'MONOLITHIC',
@@ -277,23 +349,16 @@ our @variable_string_settables = (
 'PROGRAM_NAME_IN_FOOTER',
 'SECTION_NAME_IN_TITLE',
 'SHORTEXTN',
-'FORMAT_MENU',
 'SHOW_TITLE',
 'SIMPLE_MENU',
 'SORT_ELEMENT_COUNT',
-'SORT_ELEMENT_COUNT_WORDS',
-'TEST',
-'TEXI2DVI',
 'TEXI2HTML',
 'TEXINFO_DTD_VERSION',
 'TEXINFO_OUTPUT_FORMAT',
-'TEXTCONTENT_COMMENT',
 'TOC_LINKS',
 'TOP_FILE',
 'TOP_NODE_FILE_TARGET',
-'TOP_NODE_UP',
 'TOP_NODE_UP_URL',
-'TREE_TRANSFORMATIONS',
 'USE_ACCESSKEY',
 'USE_ISO',
 'USE_LINKS',
@@ -311,7 +376,7 @@ our @variable_string_settables = (
 'XREF_USE_NODE_NAME_ARG',
 );
 
-# Not strings. 
+# Not strings.  Not documented in the manual nor elsewhere.
 # FIXME To be documented somewhere, but where?
 my @variable_other_settables = (
   'LINKS_BUTTONS', 'TOP_BUTTONS', 'SECTION_BUTTONS', 'BUTTONS_TEXT',
@@ -322,7 +387,10 @@ my @variable_other_settables = (
   'BUTTONS_EXAMPLE', 'SPECIAL_ELEMENTS_NAME', 'SPECIAL_ELEMENTS_CLASS',
   'ACTIVE_ICONS', 'PASSIVE_ICONS',
   # set from command line
-  'CSS_FILES', 'CSS_REFS', 'EXPANDED_FORMATS', 'INCLUDE_DIRECTORIES',
+  'CSS_FILES',            # --css-include
+  'CSS_REFS',             # --css-ref
+  'EXPANDED_FORMATS',     # --if*
+  'INCLUDE_DIRECTORIES',  # -I
 );
 
 our %document_settable_at_commands = (%document_settable_multiple_at_commands,
@@ -330,7 +398,12 @@ our %document_settable_at_commands = 
(%document_settable_multiple_at_commands,
 
 my %valid_options;
 foreach my $var (keys(%document_settable_at_commands),
-         @command_line_settables, @variable_string_settables,
+         keys(%default_main_program_command_line_options),
+         keys(%default_converter_command_line_options),
+         keys(%default_main_program_customization),
+         keys(%default_parser_specific_customization),
+         keys(%default_converter_customization),
+         @variable_string_settables,
          @variable_other_settables) {
   $valid_options{$var} = 1;
 }
@@ -354,8 +427,11 @@ sub add_valid_option($)
 my %customization_variable_classes = (
   'document_settable_multiple_at_commands' => [ 
sort(keys(%document_settable_multiple_at_commands)) ],
   'document_settable_unique_at_commands' => [ 
sort(keys(%document_settable_unique_at_commands)) ],
-  'command_line_settables' => \@command_line_settables,
-  'variable_string_settables' => \@variable_string_settables,
+  'command_line_settables' => [ 
sort((keys(%default_converter_command_line_options),
+                                      
keys(%default_main_program_command_line_options))) ],
+  'variable_string_settables' => [ @variable_string_settables, sort(
+    (keys(%default_parser_specific_customization), 
keys(%default_main_program_customization),
+     keys(%default_converter_customization))) ],
   'variable_other_settables' => \@variable_other_settables,
 );
 
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index d9ebf73..0cd2582 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -37,14 +37,34 @@ use Carp;
 my $real_command_name;
 
 my $cmdline_options;
-my $default_options;
+my $main_program_default_options;
 my $init_files_options = {};
 
+# list options are not handled like string options.  Indeed,
+# the lists need to be defined in the main program, therefore
+# the main program list options would always take precedence
+# if there is a precedence, and the list options set from
+# init file would not have any effect. For list options, items
+# are added and removed by calls to texinfo_add_to_option_list
+# and texinfo_remove_from_option_list, be it from command line
+# or init files, there is no precedence, but the order of calls
+# matter.
+my %options_as_lists;
+
 # called from texi2any.pl main program
 sub GNUT_initialize_config($$$) {
   $real_command_name = shift;
-  $default_options = shift;
+  $main_program_default_options = shift;
   $cmdline_options = shift;
+  # consider options passed from main program for initialization
+  # as list options
+  foreach my $cmdline_option (keys(%$cmdline_options)) {
+    if (not ref($cmdline_options->{$cmdline_option})
+        or ref($cmdline_options->{$cmdline_option}) ne 'ARRAY') {
+      warn "BUG: $cmdline_option not an ARRAY 
$cmdline_options->{$cmdline_option}\n";
+    }
+    $options_as_lists{$cmdline_option} = 1;
+  }
   #print STDERR "cmdline_options: ".join('|',keys(%$cmdline_options))."\n";
   return $init_files_options;
 }
@@ -111,7 +131,7 @@ sub texinfo_set_from_init_file($$) {
     return 0;
   }
   return 0 if (defined($cmdline_options->{$var}));
-  delete $default_options->{$var};
+  delete $main_program_default_options->{$var};
   $init_files_options->{$var} = $value;
   return 1;
 }
@@ -127,7 +147,7 @@ sub GNUT_set_from_cmdline($$) {
   }
 
   delete $init_files_options->{$var};
-  delete $default_options->{$var};
+  delete $main_program_default_options->{$var};
   if (!Texinfo::Common::valid_option($var)) {
     _GNUT_document_warn(sprintf(__("%s: unknown variable %s\n"),
                           'GNUT_set_from_cmdline', $var));
@@ -137,6 +157,36 @@ sub GNUT_set_from_cmdline($$) {
   return 1;
 }
 
+# called both from main program and init files.
+sub texinfo_add_to_option_list($$)
+{
+  my $var = shift;
+  my $values_array_ref = shift;
+  if (not $options_as_lists{$var}) {
+    return 0;
+  }
+  foreach my $value (@$values_array_ref) {
+    push @{$cmdline_options->{$var}}, $value
+      unless (grep {$_ eq $value} @{$cmdline_options->{$var}});
+  }
+  return 1;
+}
+
+# called both from main program and init files.
+sub texinfo_remove_from_option_list($$)
+{
+  my $var = shift;
+  my $values_array_ref = shift;
+  if (not $options_as_lists{$var}) {
+    return 0;
+  }
+  foreach my $value (@$values_array_ref) {
+    @{$cmdline_options->{$var}}
+      = grep {$_ ne $value} @{$cmdline_options->{$var}};
+  }
+  return 1;
+}
+
 # This also could get and set some @-command results.
 # FIXME But it does not take into account what happens during conversion,
 # for that something like $converter->get_conf(...) has to be used.
@@ -146,8 +196,8 @@ sub texinfo_get_conf($) {
     return $cmdline_options->{$var};
   } elsif (exists($init_files_options->{$var})) {
     return $init_files_options->{$var};
-  } elsif (exists($default_options->{$var})) {
-    return $default_options->{$var};
+  } elsif (exists($main_program_default_options->{$var})) {
+    return $main_program_default_options->{$var};
   } else {
     return undef;
   }
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 54273f7..5d028a6 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -31,6 +31,14 @@ use Encode;
 use Texinfo::Common;
 use Texinfo::Structuring;
 
+use Texinfo::Report;
+use Texinfo::Translations;
+
+use Texinfo::Convert::NodeNameNormalization;
+use Texinfo::Structuring;
+use Texinfo::Convert::Unicode;
+use Texinfo::Convert::Text;
+
 use Carp qw(cluck);
 
 require Exporter;
@@ -52,50 +60,34 @@ xml_accents
 $VERSION = '6.8dev';
 
 my %defaults = (
-  'ENABLE_ENCODING'      => 1,
-  'OUTFILE'              => undef,
-  'SUBDIR'               => undef,
   'documentlanguage'     => undef,
 );
 
-# defaults for all converters.  Maybe more could be added, especially what
-# can be set with --set and should be the same for all the formats.
+# defaults for all converters that are not defined elsewhere.
 # undef values in general marks information passed by the caller that
 # is valid in the parser configuration initialization hash, but
 # is not considered as "configuration", and is available directly
 # in the converter, not through get_conf().
 # FIXME separate the two types of information and check that those
-# items are not valid options.
-our %all_converters_defaults = (
+# items are not valid customization options?
+my %common_converters_defaults = (
   'language_config_dirs' => undef,
   'output_format'        => undef,
-  'SPLIT_SIZE'           => 300000,
-  'TOP_NODE_UP'          => '(dir)',   # up node of Top node default value
-  'paragraphindent'      => 3,
-  'fillcolumn'           => 72,
-  'expanded_formats'     => undef,
   'structuring'          => undef,
-  # only HTML
-  'IMAGE_LINK_PREFIX'    => undef,
-  'NUMBER_SECTIONS'      => 1,
-  'NUMBER_FOOTNOTES'     => 1,
-  'frenchspacing'        => 'off',
-  'paragraphindent'      => 3,
-  'firstparagraphindent' => 'none',
-  'allowcodebreaks'      => 'true',
-  'footnotestyle'        => 'end',
-  'deftypefnnewline'     => 'off',
-  'BASEFILENAME_LENGTH'  => 255 - 10,
+  'translated_commands'  => {'error' => 'error@arrow{}',},
 # This is the default, mainly for tests; the caller should set them.  These
 # values are what is used in tests of the Converters.
   'PACKAGE_AND_VERSION'  => 'texinfo',
   'PACKAGE_VERSION'      => '',
   'PACKAGE_URL'          => 'http://www.gnu.org/software/texinfo/',
   'PROGRAM'              => '',
+);
 
-  'DEBUG'                => 0,
-  'TEST'                 => 0,
-  'translated_commands'  => {'error' => 'error@arrow{}',},
+my %all_converters_defaults = 
(%Texinfo::Common::default_converter_command_line_options,
+  %Texinfo::Common::default_converter_customization,
+  %Texinfo::Common::document_settable_unique_at_commands,
+  %Texinfo::Common::document_settable_multiple_at_commands,
+  %common_converters_defaults
 );
 
 # For translation of in document string.
@@ -228,19 +220,17 @@ sub converter(;$)
 
   # turn the array to a hash for speed.  Not sure it really matters for such
   # a small array.
-  foreach my $expanded_format(@{$converter->{'expanded_formats'}}) {
-    $converter->{'expanded_formats_hash'}->{$expanded_format} = 1;
+  my $expanded_formats = $converter->get_conf('EXPANDED_FORMATS');
+  if (defined($expanded_formats)) {
+    foreach my $expanded_format (@{$converter->get_conf('EXPANDED_FORMATS')}) {
+      $converter->{'expanded_formats_hash'}->{$expanded_format} = 1;
+    }
   }
 
   # used for output files information, to register opened
   # and not closed files.  Accessed through output_files_information()
   $converter->{'output_files'} = {};
 
-  require Texinfo::Report;
-  require Texinfo::Translations;
-  # 'require' here instead of 'use' at top of file to cut down run time of 
-  # 'texi2any --help'
-
   $converter->Texinfo::Report::new();
 
   $converter->converter_initialize();
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6947f73..f370475 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -56,8 +56,9 @@ use if $] >= 5.012, feature => 'unicode_strings';
 
 use strict;
 
-use Texinfo::Convert::Converter;
 use Texinfo::Common;
+use Texinfo::Structuring;
+use Texinfo::Convert::Converter;
 use Texinfo::Convert::Texinfo;
 use Texinfo::Convert::Text;
 use Texinfo::Convert::Unicode;
@@ -885,7 +886,6 @@ my %defaults = (
   'TOP_FILE'             => 'index.html',
   'EXTENSION'            => 'html',
   'TOP_NODE_FILE_TARGET' => 'index.html',
-  'TRANSLITERATE_FILE_NAMES' => 1,
   'USE_LINKS'            => 1,
   'USE_NUMERIC_ENTITY'   => 1,
   'ENABLE_ENCODING_USE_ENTITY'   => 1,
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index f1d3368..0979bda 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -22,7 +22,6 @@ package Texinfo::Convert::Text;
 use 5.00405;
 use strict;
 
-use Texinfo::Convert::Converter;
 # accent commands list.
 use Texinfo::Common;
 use Texinfo::Convert::Unicode;
@@ -35,7 +34,7 @@ use File::Basename;
 
 require Exporter;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-@ISA = qw(Exporter Texinfo::Convert::Converter);
+@ISA = qw(Exporter);
 
 %EXPORT_TAGS = ( 'all' => [ qw(
   convert_to_text
@@ -635,7 +634,7 @@ sub converter($)
     #print STDERR "CTe ".join("|", sort(keys(%{$conf})))."\n";
   }
 
-  my $expanded_formats = $converter->{'expanded_formats'};;
+  my $expanded_formats = $converter->{'EXPANDED_FORMATS'};;
   if ($converter->{'parser'}) {
     $converter->{'parser_info'} = 
$converter->{'parser'}->global_informations();
     $converter->{'extra'} = 
$converter->{'parser'}->global_commands_information();
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index 257b356..ef711e9 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -34,6 +34,8 @@ use Unicode::EastAsianWidth;
 require Exporter;
 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
+use Texinfo::Encoding;
+
 use Texinfo::MiscXS;
 
 # Some extra initialization for the first time this module is loaded.
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 1c028cb..e1d859e 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -35,6 +35,8 @@ use Texinfo::Convert::Text;
 # for error messages 
 use Texinfo::Convert::Texinfo;
 
+use Texinfo::Convert::NodeNameNormalization;
+
 *node_extra_to_texi = \&Texinfo::Convert::Texinfo::node_extra_to_texi;
 
 use Carp qw(cluck);
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index d7011ea..d8604fe 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -24,7 +24,8 @@ use warnings;
 require Exporter;
 
 use Texinfo::Common;
-use Texinfo::Encoding;
+# no direct use, use through
+# Texinfo::Common::set_nodes_list_labels
 use Texinfo::Convert::NodeNameNormalization;
 use Texinfo::Report;
 use Texinfo::Translations;
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 58efaa2..55a9356 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -31,6 +31,11 @@ use File::Spec;
 # For __(
 use Texinfo::Common;
 
+# load modules to make sure that they are loaded before use
+use Texinfo::Convert::Unicode;
+use Texinfo::Convert::Text;
+use Texinfo::Structuring;
+
 main::set_global_format('html');
 
 texinfo_set_from_init_file('TOP_FILE', undef);
diff --git a/tp/t/16raw.t b/tp/t/16raw.t
index cd6d894..a72e604 100644
--- a/tp/t/16raw.t
+++ b/tp/t/16raw.t
@@ -319,7 +319,7 @@ in html
 @html
 in html
 @end html
-}',{'EXPANDED_FORMATS' => ['html']}, {'expanded_formats' => ['html']}
+}',{'EXPANDED_FORMATS' => ['html']}, {'EXPANDED_FORMATS' => ['html']}
 ],
 ['verbatim_in_brace_command',
 '@samp{
diff --git a/tp/t/92formatting.t b/tp/t/92formatting.t
index fb52727..9ac2680 100644
--- a/tp/t/92formatting.t
+++ b/tp/t/92formatting.t
@@ -42,7 +42,7 @@ my @test_cases = (
   undef, {'test_file' => 'cond.texi',
     'EXPANDED_FORMATS' => ['html', 'info', 'tex'],
   },
-  {'expanded_formats' => ['html', 'info', 'tex'], },
+  {'EXPANDED_FORMATS' => ['html', 'info', 'tex'], },
 ],
 ['cond_info',
   undef, {'test_file' => 'cond.texi',
@@ -55,14 +55,14 @@ my @test_cases = (
     'test_formats' => ['info'],
     'EXPANDED_FORMATS' => [],
   },
-  {'expanded_formats' => []}
+  {'EXPANDED_FORMATS' => []}
 ],
 ['cond_info_ifhtml_ifinfo_iftex',
   undef, {'test_file' => 'cond.texi',
     'test_formats' => ['info'],
     'EXPANDED_FORMATS' => ['info', 'html', 'tex'],
   },
-  {'expanded_formats' => ['info', 'html', 'tex'],}
+  {'EXPANDED_FORMATS' => ['info', 'html', 'tex'],}
 ],
 ['defcondx_Dbar',
   undef, {'test_file' => 'defxcond.texi',
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index f5b7e0a..68351ee 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -639,14 +639,14 @@ $raw_commands_text,
 ['raw_block_commands_expand_tex',
 $raw_commands_text,
 {'EXPANDED_FORMATS' => ['tex', 'docbook', 'html', 'xml', 'latex']},
-{'expanded_formats' => ['tex']},
+{'EXPANDED_FORMATS' => ['tex']},
 ],
 ['inline',
 $inline_text,
 ],
 ['inline_expand_tex',
 $inline_text, {'EXPANDED_FORMATS' => ['tex']},
-{'expanded_formats' => ['tex']},
+{'EXPANDED_FORMATS' => ['tex']},
 ],
 ['inlinefmtifelse',
 '@inlinefmtifelse{html,,else html no if}.
@@ -971,7 +971,7 @@ Macro not unmacroed @othermacro{}.
 
 Macros that should not be defined: @mymacro{}. @macroarg{with arg}.
 
-', {'EXPANDED_FORMATS' => ['html']}, {'expanded_formats' => ['html']}
+', {'EXPANDED_FORMATS' => ['html']}, {'EXPANDED_FORMATS' => ['html']}
 ], 
 );
 
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index a0c7430..0af2aa8 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -197,7 +197,7 @@ aa
 @end tex
 @end copying
 ', {'EXPANDED_FORMATS' => ['tex']},
-{'expanded_formats' => ['tex']}
+{'EXPANDED_FORMATS' => ['tex']}
 ],
 ['titles',
 '@setfilename html-title.info
diff --git a/tp/t/init/t2h_singular.init b/tp/t/init/t2h_singular.init
index 3a8a498..557c4d0 100644
--- a/tp/t/init/t2h_singular.init
+++ b/tp/t/init/t2h_singular.init
@@ -13,14 +13,11 @@ my $T2H_BLUE_BUTTONS = 0;
 # we only redefine things which ar of relevance to singular
 # all the others we simply "include"
 
-# -prefix
 # Set the output file prefix, prepended to all .html, .png and .pl files.
 texinfo_set_from_init_file('setfilename', 'sing');
 
-# -expand
-# if set to "tex" (or, "info") expand @iftex and @tex (or, @ifinfo) sections
-# else, neither expand @iftex, @tex, nor @ifinfo sections
-texinfo_set_from_init_file('EXPANDED_FORMATS', ['html', 'tex']);
+# add html and tex to expanded formats.  html should be redundant.
+texinfo_add_to_option_list('EXPANDED_FORMATS', ['html', 'tex']);
 
 # if set, creates one html file per node
 texinfo_set_from_init_file('SPLIT', 'node');
diff --git a/tp/t/plaintext_tests.t b/tp/t/plaintext_tests.t
index 80d1f77..c1088d8 100644
--- a/tp/t/plaintext_tests.t
+++ b/tp/t/plaintext_tests.t
@@ -90,14 +90,14 @@ Before samp. @samp{a}. after samp, w @w{in   w. after dot}  
afterw
 html
 @end html
 after.
-',{'EXPANDED_FORMATS' => ['html']}, {'expanded_formats' => ['html']}
+',{'EXPANDED_FORMATS' => ['html']}, {'EXPANDED_FORMATS' => ['html']}
 ],
 ['isolated_html_expanded',
 '
 @html
 html
 @end html
-',{'EXPANDED_FORMATS' => ['html']}, {'expanded_formats' => ['html']}
+',{'EXPANDED_FORMATS' => ['html']}, {'EXPANDED_FORMATS' => ['html']}
 ],
 ['star_at_command_formatting',
 '@macro mymacro
@@ -477,7 +477,7 @@ GGG
 HHH
 @end tex
 bbbbbbbbb1 bbbbbbbbbbb2 bbbbbbbbbb3 bbbbbbbbbbbbbb4.
-', {'EXPANDED_FORMATS' => ['tex']}, {'expanded_formats' => ['tex']}
+', {'EXPANDED_FORMATS' => ['tex']}, {'EXPANDED_FORMATS' => ['tex']}
 ],
 ['paragraphindent',
 'First
diff --git a/tp/t/test_sort.t b/tp/t/test_sort.t
index 38b9008..888ddbe 100644
--- a/tp/t/test_sort.t
+++ b/tp/t/test_sort.t
@@ -40,15 +40,16 @@ $tree = $parser->parse_texi_text('@node Top
 @cindex @l{}
 ');
 
-my ($index_names, $merged_indices) = 
-   $parser->indices_information();
+my $registrar = $parser->registered_errors();
+my ($index_names, $merged_indices) = $parser->indices_information();
 my $index_entries = Texinfo::Structuring::merge_indices($index_names);
 my $parser_informations = $parser->global_informations();
-# FIXME this is not very clean, there should be an object
-# holding only configuration instead
+# FIXME this is wrong, there should be an object
+# holding only configuration that is not a parser
 $parser->{'OUTPUT_ENCODING_NAME'} = 
$parser_informations->{'input_encoding_name'};
+$parser->{'ENABLE_ENCODING'} = 1;
 my $sorted_index_entries 
-  = Texinfo::Structuring::sort_indices($parser, $parser, $parser,
+  = Texinfo::Structuring::sort_indices($parser, $registrar, $parser,
                                   $index_entries, $index_names);
 
 my @entries = ();
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 6d970df..97f9753 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -519,8 +519,8 @@ sub set_converter_option_defaults($$$)
   my $parser_options = shift;
   my $format = shift;
   $converter_options = {} if (!defined($converter_options));
-  if (!defined($converter_options->{'expanded_formats'})) {
-    $converter_options->{'expanded_formats'} = [$format];
+  if (!defined($converter_options->{'EXPANDED_FORMATS'})) {
+    $converter_options->{'EXPANDED_FORMATS'} = [$format];
   }
   return $converter_options;
 }
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 1e7cbaf..0f28273 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -98,17 +98,6 @@ use Locale::Messages;
 use Texinfo::Common;
 use Texinfo::Config;
 
-use Texinfo::Convert::Converter;
-
-# this associates the command line options to the arrays set during
-# command line parsing.
-my @css_files = ();
-my @css_refs = ();
-my @include_dirs = ();
-my $cmdline_options = { 'CSS_FILES' => \@css_files,
-                        'CSS_REFS' => \@css_refs,
-                        'INCLUDE_DIRECTORIES' => \@include_dirs };
-
 # determine the path separators
 my $path_separator = $Config{'path_sep'};
 $path_separator = ':' if (!defined($path_separator));
@@ -275,13 +264,8 @@ if ($texinfo_dtd_version eq '@' . 'TEXINFO_DTD_VERSION@') {
 $texinfo_dtd_version = $configured_version
   if (!defined($texinfo_dtd_version));
 
-# defaults for options relevant in the main program, not undef, and also
-# defaults for all the converters.
-# Other relevant options (undef) are NO_WARN FORCE OUTFILE
-# Others are set in the converters (FORMAT_MENU).
-my $converter_default_options = { 
-    'ERROR_LIMIT' => 100,
-    'TEXI2DVI' => 'texi2dvi',
+# options set in the main program.
+my $main_program_set_options = {
     'PACKAGE_VERSION' => $configured_version,
     'PACKAGE' => $configured_package,
     'PACKAGE_NAME' => $configured_name,
@@ -291,6 +275,13 @@ my $converter_default_options = {
     'TEXINFO_DTD_VERSION' => $texinfo_dtd_version,
 };
 
+# defaults for options relevant in the main program. Also used as
+# defaults for all the converters.
+my $main_program_default_options = {
+  %$main_program_set_options,
+  %Texinfo::Common::default_main_program_customization_options,
+};
+
 # determine configuration directories.
 
 my $conf_file_name = 'Config' ;
@@ -329,18 +320,13 @@ sub locate_and_load_init_file($$)
 
   my $file = Texinfo::Common::locate_init_file($filename, $directories, 0);
   if (defined($file)) {
+    # evaluate the code in the Texinfo::Config namespace
     Texinfo::Config::GNUT_load_init_file($file);
   } else {
     document_warn(sprintf(__("could not read init file %s"), $filename));
   }
 }
 
-# read initialization files
-foreach my $file (Texinfo::Common::locate_init_file($conf_file_name, 
-                  [ reverse(@program_config_dirs) ], 1)) {
-  Texinfo::Config::GNUT_load_init_file($file);
-}
-
 sub set_from_cmdline($$) {
   return &Texinfo::Config::GNUT_set_from_cmdline(@_);
 }
@@ -349,10 +335,29 @@ sub get_conf($) {
   return &Texinfo::Config::texinfo_get_conf(@_);
 }
 
+sub add_to_option_list($$) {
+  return &Texinfo::Config::texinfo_add_to_option_list(@_);
+}
+
+sub remove_from_option_list($$) {
+  return &Texinfo::Config::texinfo_remove_from_option_list(@_);
+}
+
 my @input_file_suffixes = ('.txi','.texinfo','.texi','.txinfo','');
 
 my @texi2dvi_args = ();
 
+# this associates the command line options to the arrays set during
+# command line parsing.
+my @css_files = ();
+my @css_refs = ();
+my @include_dirs = ();
+my @expanded_formats = ();
+my $cmdline_options = { 'CSS_FILES' => \@css_files,
+                        'CSS_REFS' => \@css_refs,
+                        'INCLUDE_DIRECTORIES' => \@include_dirs,
+                        'EXPANDED_FORMATS' => \@expanded_formats };
+
 my $format = 'info';
 # this is the format associated with the output format, which is replaced
 # when the output format changes.  It may also be removed if there is the
@@ -361,33 +366,40 @@ my $default_expanded_format = [ $format ];
 my @conf_dirs = ();
 my @prepend_dirs = ();
 
-# $cmdline_options are common to main program and Texinfo::Config
-# namespace, set by GNUT_set_from_cmdline for text values, but also
-# manipulated in main program.
-# $init_files_options are managed by Texinfo::Config and available here.
-# There is in addition $parser_options for parser
-# related informations for informations that are not set through
-# set_from_cmdline.  The configuration text values are later on
-# copied over to the parser if they are parser options, with
-# format specific options also set if not already in the configuration.
-# Some parser options (as well as parser generated informations) are 
selectively
-# copied to converters either here or in converter initialization.
-my $parser_options = {'EXPANDED_FORMATS' => [],
-                      'values' => {'txicommandconditionals' => 1}};
+# $cmdline_options are set by GNUT_set_from_cmdline for text values, and also
+# accessed in main program.  The $cmdline_options passed to
+# Texinfo::Config::GNUT_initialize_config are considered to be arrays
+# in which items can be added or deleted both from the command line
+# and from init files.
+# $init_files_options are managed by Texinfo::Config, set by
+# texinfo_set_from_init_file in init files.
+#
+# There is in addition $parser_options for parser related informations
+# that are not set otherwise.
+# The configuration text values are later on copied over to the parser if
+# they are parser options, with format specific options also set with
+# less precedence.
+my $parser_options = {'values' => {'txicommandconditionals' => 1}};
 
 my $init_files_options = Texinfo::Config::GNUT_initialize_config(
-      $real_command_name, $converter_default_options, $cmdline_options);
+      $real_command_name, $main_program_default_options, $cmdline_options);
+
+# read initialization files.  Better to do that after
+# Texinfo::Config::GNUT_initialize_config() in case loaded
+# files replace default options.
+foreach my $file (Texinfo::Common::locate_init_file($conf_file_name,
+                  [ reverse(@program_config_dirs) ], 1)) {
+  Texinfo::Config::GNUT_load_init_file($file);
+}
 
 sub set_expansion($$) {
   my $region = shift;
   my $set = shift;
   $set = 1 if (!defined($set));
   if ($set) {
-    push @{$parser_options->{'EXPANDED_FORMATS'}}, $region
-      unless (grep {$_ eq $region} @{$parser_options->{'EXPANDED_FORMATS'}});
+    add_to_option_list('EXPANDED_FORMATS', [$region]);
   } else {
-    @{$parser_options->{'EXPANDED_FORMATS'}} =
-      grep {$_ ne $region} @{$parser_options->{'EXPANDED_FORMATS'}};
+    remove_from_option_list('EXPANDED_FORMATS', [$region]);
     @{$default_expanded_format} 
        = grep {$_ ne $region} @{$default_expanded_format};
   }
@@ -580,8 +592,13 @@ sub handle_errors($$$)
 sub _get_converter_default($)
 {
   my $option = shift;
-  return $Texinfo::Convert::Converter::all_converters_defaults{$option}
-   if 
(defined($Texinfo::Convert::Converter::all_converters_defaults{$option}));
+  if 
(defined($Texinfo::Common::documented_converter_default_command_line{$option})) 
{
+    return 
$Texinfo::Common::documented_converter_default_command_line{$option};
+  } elsif 
(defined($Texinfo::Common::document_settable_multiple_at_commands{$option})) {
+    return $Texinfo::Common::document_settable_multiple_at_commands{$option};
+  } #elsif 
(defined(%Texinfo::Common::document_settable_unique_at_commands{$option})) {
+  #  return $Texinfo::Common::document_settable_unique_at_commands{$option};
+  #}
   return undef;
 }
 
@@ -666,7 +683,7 @@ the behavior is identical, and does not depend on the 
installed name.\n")
                                 If VAL is `none', do not indent; if VAL is
                                 `asis', preserve existing indentation.
       --split-size=NUM        split Info files at size NUM (default %d).\n"),
-    _get_converter_default('fillcolumn'), 
+    _get_converter_default('FILLCOLUMN'),
     _get_converter_default('paragraphindent'), 
     _get_converter_default('SPLIT_SIZE'))
 ."\n";
@@ -939,7 +956,7 @@ my %test_conf = (
 );
 if (get_conf('TEST')) {
   foreach my $conf (keys (%test_conf)) {
-    $converter_default_options->{$conf} = $test_conf{$conf};
+    $main_program_default_options->{$conf} = $test_conf{$conf};
   }
 }
 
@@ -1002,10 +1019,7 @@ if (get_conf('SPLIT') and 
!$formats_table{$format}->{'split'}) {
   set_from_cmdline('SPLIT', ''); 
 }
 
-foreach my $expanded_format (@{$default_expanded_format}) {
-  push @{$parser_options->{'EXPANDED_FORMATS'}}, $expanded_format
-    unless (grep {$_ eq $expanded_format} 
@{$parser_options->{'EXPANDED_FORMATS'}});
-}
+add_to_option_list('EXPANDED_FORMATS', $default_expanded_format);
 
 my $converter_class;
 my %converter_defaults;
@@ -1302,15 +1316,15 @@ while(@input_files) {
     delete $file_cmdline_options->{'SUBDIR'}
        if (exists($file_cmdline_options->{'SUBDIR'}) and get_conf('SPLIT'));
   }
-  my $converter_options = { %$converter_default_options, 
+  my $converter_options = { %$main_program_default_options,
                             %$file_cmdline_options,
                             %$init_files_options };
 
-  $converter_options->{'expanded_formats'} = 
$parser_options->{'EXPANDED_FORMATS'};
   $converter_options->{'parser'} = $parser;
   $converter_options->{'structuring'} = $structure_informations;
   $converter_options->{'output_format'} = $format;
   $converter_options->{'language_config_dirs'} = \@language_config_dirs;
+  # FIXME isn't that done for each output file?
   unshift @{$converter_options->{'INCLUDE_DIRECTORIES'}},
           @prepended_include_directories;
 
@@ -1378,6 +1392,7 @@ while(@input_files) {
     }
   }
   if (defined(get_conf('SORT_ELEMENT_COUNT')) and $file_number == 0) {
+    require Texinfo::Convert::Converter;
     my $converter_element_count_file 
       = Texinfo::Convert::TextContent->converter($converter_options);
     my $use_sections = (! $formats_table{$format}->{'nodes_tree'}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]