texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 18 Jan 2024 18:44:53 -0500 (EST)

branch: master
commit f5fb3094d12c691b23042666c6107017b71dbc4a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jan 18 23:59:02 2024 +0100

    * tp/Texinfo/Convert/Converter.pm (set_document)
    (_set_output_units_files), tp/Texinfo/Convert/HTML.pm (label_command)
    (_get_top_unit, _convert_heading_command)
    (_set_root_commands_targets_node_files, _html_set_pages_files)
    (_prepare_units_directions_files, output), tp/Texinfo/Convert/IXIN.pm,
    tp/Texinfo/Convert/Info.pm (output), tp/Texinfo/Convert/LaTeX.pm
    (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): do not set
    'identifiers_target', instead use document labels_information to get
    document labels information identifiers_target.
---
 ChangeLog                       | 14 +++++++++-
 tp/Texinfo/Convert/Converter.pm | 16 ++++++-----
 tp/Texinfo/Convert/HTML.pm      | 62 +++++++++++++++++++++++++++++++----------
 tp/Texinfo/Convert/IXIN.pm      |  8 ++++--
 tp/Texinfo/Convert/Info.pm      |  8 ++++--
 tp/Texinfo/Convert/LaTeX.pm     | 14 ++++++----
 tp/Texinfo/Convert/Plaintext.pm | 37 ++++++++++++++++--------
 7 files changed, 114 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 49838d97b2..b236ca45e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,18 @@
        * tp/Texinfo/Common.pm (debug_print_tree): Also print 'unit_contents'
        keys to allow printing an "output unit".
 
+2024-01-18  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Converter.pm (set_document)
+       (_set_output_units_files), tp/Texinfo/Convert/HTML.pm (label_command)
+       (_get_top_unit, _convert_heading_command)
+       (_set_root_commands_targets_node_files, _html_set_pages_files)
+       (_prepare_units_directions_files, output), tp/Texinfo/Convert/IXIN.pm,
+       tp/Texinfo/Convert/Info.pm (output), tp/Texinfo/Convert/LaTeX.pm
+       (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): do not set
+       'identifiers_target', instead use document labels_information to get
+       document labels information identifiers_target.
+
 2024-01-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Converter.pm (set_document),
@@ -43,7 +55,7 @@
        tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert),
        tp/Texinfo/Convert/Plaintext.pm (_convert), tp/ext/epub3.pm,
        tp/init/book.pm (book_convert_heading_command), tp/init/chm.pm
-       (chm_init): do not set 'sections_list', nstead use document
+       (chm_init): do not set 'sections_list', instead use document
        sections_list to get document sections list.
 
 2024-01-18  Patrice Dumas  <pertusus@free.fr>
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 52c9aba966..dc55f5670f 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -266,10 +266,6 @@ sub set_document($$)
 
   $converter->{'document'} = $document;
   if (defined($document)) {
-    my $identifier_target = $document->labels_information();
-
-    $converter->{'identifiers_target'} = $identifier_target
-                                           if ($identifier_target);
     $converter->{'indices_information'}
            = $document->indices_information();
   }
@@ -1126,8 +1122,14 @@ sub _set_output_units_files($$$$$$)
     }
   } else {
     my $node_top;
-    $node_top = $self->{'identifiers_target'}->{'Top'}
-                            if ($self->{'identifiers_target'});
+
+    my $identifiers_target;
+    if ($self->{'document'}) {
+      $identifiers_target = $self->{'document'}->labels_information();
+    }
+
+    $node_top = $identifiers_target->{'Top'}
+                            if ($identifiers_target);
 
     my $top_node_filename = $self->top_node_filename($document_name);
     # first determine the top node file name.
@@ -1157,7 +1159,7 @@ sub _set_output_units_files($$$$$$)
             my $node_filename;
             # double node are not normalized, they are handled here
             if (!defined($root_command->{'extra'}->{'normalized'})
-                or !defined($self->{'identifiers_target'}->{
+                or !defined($identifiers_target->{
                                $root_command->{'extra'}->{'normalized'}})) {
               $node_filename = 'unknown_node';
             } else {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f8216f3f7b..d3cd2cbc93 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1468,8 +1468,13 @@ sub label_command($$)
   if (!defined($label)) {
     cluck;
   }
-  if ($self->{'identifiers_target'}) {
-    return $self->{'identifiers_target'}->{$label};
+  my $identifiers_target;
+  if ($self->{'document'}) {
+    $identifiers_target = $self->{'document'}->labels_information();
+
+    if ($identifiers_target) {
+      return $identifiers_target->{$label};
+    }
   }
   return undef;
 }
@@ -1858,9 +1863,14 @@ sub _get_top_unit($;$)
   my $self = shift;
   my $output_units = shift;
 
+  my $identifiers_target;
+  if ($self->{'document'}) {
+    $identifiers_target = $self->{'document'}->labels_information();
+  }
+
   my $node_top;
-  $node_top = $self->{'identifiers_target'}->{'Top'}
-                                    if ($self->{'identifiers_target'});
+  $node_top = $identifiers_target->{'Top'}
+                      if ($identifiers_target);
   my $section_top;
 
   my $global_commands;
@@ -2296,7 +2306,7 @@ foreach my $converter_info ('copying_comment', 
'current_filename',
    'destination_directory', 'document', 'document_name',
    'documentdescription_string', 'expanded_formats',
    'index_entries', 'index_entries_by_letter', 'indices_information',
-   'jslicenses', 'identifiers_target',
+   'jslicenses',
    'line_break_element', 'non_breaking_space', 'paragraph_symbol',
    'simpletitle_command_name', 'simpletitle_tree',
    'title_string', 'title_tree', 'title_titlepage') {
@@ -4754,9 +4764,14 @@ sub _convert_heading_command($$$$$)
         if ($node->{'extra'}
             and not $node->{'extra'}->{'menus'}
             and $automatic_directions) {
+          my $document = $self->get_info('document');
+          my $identifiers_target;
+          if ($document) {
+            $identifiers_target = $document->labels_information();
+          }
           my $menu_node
             = Texinfo::Structuring::new_complete_menu_master_menu($self,
-                                    $self->get_info('identifiers_target'), 
$node);
+                                                 $identifiers_target, $node);
           if ($menu_node) {
             $mini_toc_or_auto_menu = $self->convert_tree($menu_node);
           }
@@ -9320,11 +9335,13 @@ sub _set_root_commands_targets_node_files($)
   my $self = shift;
 
   my $sections_list;
+  my $identifiers_target;
   if ($self->{'document'}) {
     $sections_list = $self->{'document'}->sections_list();
+    $identifiers_target = $self->{'document'}->labels_information();
   }
 
-  if ($self->{'identifiers_target'}) {
+  if ($identifiers_target) {
     my $extension = '';
     $extension = '.'.$self->get_conf('EXTENSION')
                 if (defined($self->get_conf('EXTENSION'))
@@ -9512,10 +9529,15 @@ sub _html_set_pages_files($$$$$$$$$)
          'file_info_name' => 'non_split',
          'file_info_path' => $output_file};
   } else {
+    my $identifiers_target;
+    if ($self->{'document'}) {
+      $identifiers_target = $self->{'document'}->labels_information();
+    }
+
     # first determine the top node file name.
     my $node_top;
-    $node_top = $self->{'identifiers_target'}->{'Top'}
-                               if ($self->{'identifiers_target'});
+    $node_top = $identifiers_target->{'Top'}
+                               if ($identifiers_target);
 
     my $top_node_filename = $self->top_node_filename($document_name);
     my $node_top_output_unit;
@@ -9550,7 +9572,7 @@ sub _html_set_pages_files($$$$$$$$$)
               and $root_command->{'cmdname'} eq 'node') {
             # double node are not normalized, they are handled here
             if (!defined($root_command->{'extra'}->{'normalized'})
-                or !defined($self->{'identifiers_target'}->{
+                or !defined($identifiers_target->{
                             $root_command->{'extra'}->{'normalized'}})) {
               $node_filename = 'unknown_node';
               $node_filename .= $extension;
@@ -9842,6 +9864,11 @@ sub _prepare_units_directions_files($$$$$$$$)
   my $output_filename = shift;
   my $document_name = shift;
 
+  my $identifiers_target;
+  if ($self->{'document'}) {
+    $identifiers_target = $self->{'document'}->labels_information();
+  }
+
   $self->_prepare_output_units_global_targets($output_units, $special_units,
                                               $associated_special_units);
 
@@ -9858,8 +9885,8 @@ sub _prepare_units_directions_files($$$$$$$$)
   }
 
   # do output units directions.
-  Texinfo::Structuring::units_directions($self,
-                                $self->{'identifiers_target'}, $output_units);
+  Texinfo::Structuring::units_directions($self, $identifiers_target,
+                                         $output_units);
 
   _prepare_special_units_directions($self, $special_units);
 
@@ -12404,6 +12431,11 @@ sub output($$)
 
   $self->conversion_initialization($document);
 
+  my $identifiers_target;
+  if ($document) {
+    $identifiers_target = $document->labels_information();
+  }
+
   my $root = $document->tree();
 
   # set here early even though actual values are only set later on.  It is
@@ -12662,10 +12694,10 @@ sub output($$)
   # do node redirection pages
   $self->{'current_filename'} = undef;
   if ($self->get_conf('NODE_FILES')
-      and $self->{'identifiers_target'} and $output_file ne '') {
+      and $identifiers_target and $output_file ne '') {
     my %redirection_filenames;
-    foreach my $label (sort(keys (%{$self->{'identifiers_target'}}))) {
-      my $target_element = $self->{'identifiers_target'}->{$label};
+    foreach my $label (sort(keys (%{$identifiers_target}))) {
+      my $target_element = $identifiers_target->{$label};
       my $label_element = Texinfo::Common::get_label_element($target_element);
       # filename may not be defined in case of an @anchor or similar in
       # @titlepage, and @titlepage is not used.
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index a29f3fbdb8..27947700d6 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -383,10 +383,12 @@ sub output_ixin($$)
   my $document_info;
   my $floats;
   my $sections_list;
+  my $identifiers_target;
   if ($self->->{'document'}) {
     $document_info = $self->{'document'}->global_information();
     $floats = $self->{'document'}->floats_information();
     $sections_list = $self->{'document'}->sections_list();
+    $identifiers_target = $self->{'document'}->labels_information();
   }
 
   if ($document_info and $document_info->{'dircategory_direntry'}) {
@@ -671,9 +673,9 @@ sub output_ixin($$)
   my $non_node_labels_text = '';
   my $labels_nr = 0;
   my %floats_associated_node_id;
-  if ($self->{'identifiers_target'}) {
-    foreach my $label (sort(keys(%{$self->{'identifiers_target'}}))) {
-      my $command = $self->{'identifiers_target'}->{$label};
+  if ($identifiers_target) {
+    foreach my $label (sort(keys(%{$identifiers_target}))) {
+      my $command = $identifiers_target->{$label};
       next if ($command->{'cmdname'} eq 'node');
       $labels_nr++;
       my $associated_node_id = $self->_associated_node_id($command,
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 1816e9245e..a78132bd2b 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -155,8 +155,12 @@ sub output($$)
       $result = $output;
     }
   } else {
-    unless ($self->{'identifiers_target'}
-            and $self->{'identifiers_target'}->{'Top'}) {
+    my $identifiers_target;
+    if ($self->{'document'}) {
+      $identifiers_target = $self->{'document'}->labels_information();
+    }
+    unless ($identifiers_target
+            and $identifiers_target->{'Top'}) {
       my $input_file_name;
       if ($self->{'document'}) {
         my $document_info = $self->{'document'}->global_information();
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index efe94ea3a3..85950880ba 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3223,17 +3223,21 @@ sub _convert($$)
           $filename = _convert($self, $file_element);
           pop @{$self->{'formatting_context'}->[-1]->{'code'}};
         }
+
+        my $identifiers_target;
+        if ($self->{'document'}) {
+          $identifiers_target = $self->{'document'}->labels_information();
+        }
+
         if ($cmdname ne 'inforef' and $book eq '' and $filename eq ''
             and $node_arg and $node_arg->{'extra'}
             and defined($node_arg->{'extra'}->{'normalized'})
             and !$node_arg->{'extra'}->{'manual_content'}
-            and $self->{'identifiers_target'}
-            and $self->{'identifiers_target'}
-                   ->{$node_arg->{'extra'}->{'normalized'}}) {
+            and $identifiers_target
+            and $identifiers_target->{$node_arg->{'extra'}->{'normalized'}}) {
           # internal reference
           my $reference
-           = $self->{'identifiers_target'}
-                   ->{$node_arg->{'extra'}->{'normalized'}};
+           = $identifiers_target->{$node_arg->{'extra'}->{'normalized'}};
           my $label_element = Texinfo::Common::get_label_element($reference);
           my $reference_node_content = $label_element->{'contents'};
 
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 9397ffe03c..fa8b9ec6cf 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2300,15 +2300,19 @@ sub _convert($$)
           # correspond to the node lines numbers, and not the @ref.
           my $label_element;
           my $target_element;
+
+          my $identifiers_target;
+          if ($self->{'document'}) {
+            $identifiers_target = $self->{'document'}->labels_information();
+          }
+
           if ($node_arg and $node_arg->{'extra'}
               and !$node_arg->{'extra'}->{'manual_content'}
               and defined($node_arg->{'extra'}->{'normalized'})
-              and $self->{'identifiers_target'}
-              and $self->{'identifiers_target'}->{
-                                    $node_arg->{'extra'}->{'normalized'}}) {
+              and $identifiers_target
+              and $identifiers_target->{$node_arg->{'extra'}->{'normalized'}}) 
{
             $target_element
-              = $self->{'identifiers_target'}->{
-                                       $node_arg->{'extra'}->{'normalized'}};
+              = $identifiers_target->{$node_arg->{'extra'}->{'normalized'}};
             $label_element
               = Texinfo::Common::get_label_element($target_element);
             if (defined($label_element) and !$label_element->{'contents'}) {
@@ -3709,13 +3713,18 @@ sub _convert($$)
                                                  ->{'contents'}->[0]->{'text'})
                                    and $content->{'contents'}->[0]
                                   ->{'contents'}->[0]->{'text'} !~ /\S/)))) {
+          my $identifiers_target;
+          if ($self->{'document'}) {
+            $identifiers_target = $self->{'document'}->labels_information();
+          }
+
           if ($menu_entry_node and $menu_entry_node->{'extra'}
               and defined($menu_entry_node->{'extra'}->{'normalized'})
-              and $self->{'identifiers_target'}
+              and $identifiers_target
                 ->{$menu_entry_node->{'extra'}->{'normalized'}}
-              and $self->{'identifiers_target'}
+              and $identifiers_target
                 ->{$menu_entry_node->{'extra'}->{'normalized'}}->{'extra'}
-              and $self->{'identifiers_target'}
+              and $identifiers_target
                 ->{$menu_entry_node->{'extra'}->{'normalized'}}->{'extra'}
                                                        ->{'node_description'}) 
{
             my $description_align_column;
@@ -3729,7 +3738,7 @@ sub _convert($$)
             }
             my $description_indent_length = $description_align_column - 1;
 
-            my $description_element = $self->{'identifiers_target'}
+            my $description_element = $identifiers_target
                  ->{$menu_entry_node->{'extra'}->{'normalized'}}->{'extra'}
                                                        ->{'node_description'};
             if (! exists($self->{'seen_node_descriptions'}
@@ -4085,12 +4094,16 @@ sub _convert($$)
       if ($node and $node->{'args'} and scalar(@{$node->{'args'}}) > 1) {
         $automatic_directions = 0;
       }
-      if ($node and $automatic_directions
-            and !$self->{'seenmenus'}->{$node}) {
+      if ($node and $automatic_directions and !$self->{'seenmenus'}->{$node}) {
+        my $identifiers_target;
+        if ($self->{'document'}) {
+          $identifiers_target = $self->{'document'}->labels_information();
+        }
+
         $self->{'seenmenus'}->{$node} = 1;
         my $menu_node
          = Texinfo::Structuring::new_complete_menu_master_menu($self,
-                                     $self->{'identifiers_target'}, $node);
+                                              $identifiers_target, $node);
         if ($menu_node) {
           $self->_convert($menu_node);
         }



reply via email to

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