texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Converter.pm (set_global_doc


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Converter.pm (set_global_document_commands) (_command_init): determine the initial values only when needed.
Date: Sat, 08 Jan 2022 08:48:57 -0500

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 98212783ad * tp/Texinfo/Convert/Converter.pm 
(set_global_document_commands) (_command_init): determine the initial values 
only when needed.
98212783ad is described below

commit 98212783ad8662bdbba488280c18bffd76344a89
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 8 14:48:44 2022 +0100

    * tp/Texinfo/Convert/Converter.pm (set_global_document_commands)
    (_command_init): determine the initial values only when needed.
---
 ChangeLog                       |  5 +++++
 tp/Texinfo/Convert/Converter.pm | 32 ++++++++++++++++++--------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b3692291f5..984d9e2d9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Converter.pm (set_global_document_commands)
+       (_command_init): determine the initial values only when needed.
+
 2022-01-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (%css_map, converter_initialize):
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 6642ca29f3..a1f63a589e 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -243,6 +243,21 @@ sub output_files_information($)
   return $self->{'output_files'};
 }
 
+# determine the default, with $INIT_CONF if set, or the default common
+# to all the converters
+sub _command_init($$)
+{
+  my $global_command = shift;
+  my $init_conf = shift;
+  if 
(exists($Texinfo::Common::document_settable_at_commands{$global_command})) {
+    if (defined($init_conf->{$global_command})) {
+      return $init_conf->{$global_command};
+    } elsif 
(defined($Texinfo::Common::document_settable_at_commands{$global_command})) {
+      return $Texinfo::Common::document_settable_at_commands{$global_command};
+    }
+  }
+}
+
 # $COMMANDS_LOCATION is 0, 1 or -1.
 # 0 means setting to the values before the document commands
 # (default and command-line).
@@ -271,25 +286,14 @@ sub set_global_document_commands($$;$)
     $init_conf = $self->{'converter_init_conf'};
   }
 
-  # gather the defaults
-  my $commands_init = {};
-  foreach my $global_command 
(keys(%Texinfo::Common::document_settable_at_commands)) {
-    if (defined($init_conf->{$global_command})) {
-      $commands_init->{$global_command} = $init_conf->{$global_command};
-    } elsif 
(defined($Texinfo::Common::document_settable_at_commands{$global_command})) {
-      $commands_init->{$global_command} =
-            $Texinfo::Common::document_settable_at_commands{$global_command};
-    }
-  }
-
   if (not defined($selected_commands)) {
-    $selected_commands = [keys(%{$commands_init})];
+    $selected_commands = 
[keys(%Texinfo::Common::document_settable_at_commands)];
   }
   if ($commands_location == 0) {
     foreach my $global_command (@{$selected_commands}) {
       # for commands not appearing in the document, this should set the
       # same value, the converter initialization value
-      $self->set_conf($global_command, $commands_init->{$global_command});
+      $self->set_conf($global_command, _command_init($global_command, 
$init_conf));
     }
   } else {
     foreach my $global_command (@{$selected_commands}) {
@@ -315,7 +319,7 @@ sub set_global_document_commands($$;$)
       } else {
         # commands not appearing in the document, this should set the
         # same value, the converter initialization value
-        $self->set_conf($global_command, $commands_init->{$global_command});
+        $self->set_conf($global_command, _command_init($global_command, 
$init_conf));
       }
     }
   }



reply via email to

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