texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 7 Apr 2024 19:17:08 -0400 (EDT)

branch: master
commit c0f585c2d77616af28c27ef360039cb4f42b8435
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Apr 7 23:08:45 2024 +0200

    * tp/t/test_utils.pl (test): separate better parser options and main
    configuration options used for structuring.  Setup main configuration
    later on.
    
    * tp/texi2any.pl: add a list of customization options actually
    used in main_configuration and where they are used in comments.
---
 ChangeLog          |  9 +++++++++
 tp/t/test_utils.pl | 54 ++++++++++++++++++++++++++++++++----------------------
 tp/texi2any.pl     | 15 ++++++++++++---
 3 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b506beb27..98741df6d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-07  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/t/test_utils.pl (test): separate better parser options and main
+       configuration options used for structuring.  Setup main configuration
+       later on.
+
+       * tp/texi2any.pl: add a list of customization options actually
+       used in main_configuration and where they are used in comments.
+
 2024-04-07  Patrice Dumas  <pertusus@free.fr>
 
        * doc/texi2any_api.texi: refer more to the reader as you.  Update for
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index d224aaf147..1b83bb84ab 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -913,21 +913,6 @@ sub test($$)
     delete $parser_options->{'TREE_TRANSFORMATIONS'};
   }
 
-  # set FORMAT_MENU default to menu, which is the default for the parser.
-  # get the same structuring warnings as texi2any.
-  my $added_main_configurations = {'FORMAT_MENU' => 'menu',
-                                   'CHECK_MISSING_MENU_ENTRY' => 1};
-
-  foreach my $structuring_option ('CHECK_NORMAL_MENU_STRUCTURE',
-                                  'FORMAT_MENU', 'USE_UNICODE_COLLATION',
-                                  'COLLATION_LANGUAGE') {
-    if (defined($parser_options->{$structuring_option})) {
-      $added_main_configurations->{$structuring_option}
-        = $parser_options->{$structuring_option};
-      delete $parser_options->{$structuring_option};
-    }
-  }
-
   if ($parser_options->{'skip'}) {
     if (!$self->{'generate'}) {
       SKIP: {
@@ -991,13 +976,29 @@ sub test($$)
     }
     delete $parser_options->{'init_files'};
   }
+
+  # Setup main_configuration_options at this point to remove
+  # structuring options from parser options.
+  # set FORMAT_MENU default to menu.  It is also the default for the parser.
+  # get the same warnings as texi2any for menus.
+  my $main_configuration_options = {'FORMAT_MENU' => 'menu',
+                                   'CHECK_MISSING_MENU_ENTRY' => 1};
+
+  # gather options for structuring.
+  foreach my $structuring_option ('CHECK_NORMAL_MENU_STRUCTURE',
+                                  'USE_UNICODE_COLLATION',
+                                  'COLLATION_LANGUAGE') {
+    if (defined($parser_options->{$structuring_option})) {
+      $main_configuration_options->{$structuring_option}
+        = $parser_options->{$structuring_option};
+      delete $parser_options->{$structuring_option};
+    }
+  }
+
   my $completed_parser_options =
           {'INCLUDE_DIRECTORIES' => [$srcdir.'t/include/'],
            'DEBUG' => $self->{'DEBUG'},
             %$parser_options};
-  my $main_configuration = Texinfo::MainConfig::new({
-                                    %$completed_parser_options,
-                                    %$added_main_configurations });
 
   my $parser = Texinfo::Parser::parser($completed_parser_options);
 
@@ -1046,12 +1047,17 @@ sub test($$)
 
   my ($errors, $error_nrs) = $parser->errors();
 
-  if ($tree_transformations{'fill_gaps_in_sectioning'}) {
-    Texinfo::Transformations::fill_gaps_in_sectioning($tree);
-  }
-
   my $document_information = $document->global_information();
 
+  foreach my $parser_and_structuring_option ('FORMAT_MENU', 'DEBUG') {
+    if (defined($parser_options->{$parser_and_structuring_option})) {
+      $main_configuration_options->{$parser_and_structuring_option}
+        = $parser_options->{$parser_and_structuring_option};
+    }
+  }
+  my $main_configuration = Texinfo::MainConfig::new({
+                                    %$main_configuration_options });
+
   Texinfo::Common::set_output_encodings($main_configuration,
                                         $document);
 
@@ -1063,6 +1069,10 @@ sub test($$)
   # document XS
   $main_configuration->register_XS_document_main_configuration($document);
 
+  if ($tree_transformations{'fill_gaps_in_sectioning'}) {
+    Texinfo::Transformations::fill_gaps_in_sectioning($tree);
+  }
+
   if ($tree_transformations{'relate_index_entries_to_items'}) {
     Texinfo::Common::relate_index_entries_to_table_items_in_tree($document);
   }
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 19001e0b85..e5d32a853e 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1525,9 +1525,18 @@ while(@input_files) {
   # a "handle" is returned.
   my $tree = $document->tree($XS_structuring);
 
-  # setup a configuration object which defines get_conf and gives the same as
-  # get_conf() in main program.  It is for Structuring/Transformations methods
-  # needing access to the configuration information.
+  # setup a configuration Perl object which defines get_conf and gives the
+  # same as get_conf() in the main program.  It is used by
+  # Structuring/Transformations methods needing access to configuration
+  # information.
+  # OUTPUT_ENCODING_NAME is accessed in set_output_encodings.
+  # OUTPUT_PERL_ENCODING is accessed in set_output_encodings and
+  # in output_files_open_out for the MACRO_EXPAND file name.
+  # The following variables are directly used in Structuring/Transformations:
+  # novalidate, FORMAT_MENU, CHECK_NORMAL_MENU_STRUCTURE,
+  # CHECK_MISSING_MENU_ENTRY.  And DEBUG.
+  # documentlanguage is used in Structuring/Transformations for
+  # translations.
   my $main_configuration = Texinfo::MainConfig::new();
 
   # encoding is needed for output files



reply via email to

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