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_tree_unit_


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (command_filename, command_href, _default_format_element_header) (_convert_special_element_type, _default_format_element_footer) (_html_set_pages_files, output), tp/Texinfo/Structuring.pm (elements_file_directions), tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm, tp/t/init/t2h_singular.init: put 'unit_filename' in 'structure' hash reference.
Date: Sat, 08 Jan 2022 06:22:45 -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 4eb84e345e * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file) 
(_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm (command_filename, 
command_href, _default_format_element_header) (_convert_special_element_type, 
_default_format_element_footer) (_html_set_pages_files, output), 
tp/Texinfo/Structuring.pm (elements_file_directions), tp/init/book.pm, 
tp/init/chm.pm, tp/init/epub3.pm, tp/t/init/t2h_singular.init: put 
'unit_filename' in 'structure' hash reference.
4eb84e345e is described below

commit 4eb84e345ec7b4fe7544e9889779fa253aee05e5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 8 12:22:29 2022 +0100

    * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
    (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
    (command_filename, command_href, _default_format_element_header)
    (_convert_special_element_type, _default_format_element_footer)
    (_html_set_pages_files, output),
    tp/Texinfo/Structuring.pm (elements_file_directions),
    tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm,
    tp/t/init/t2h_singular.init: put 'unit_filename' in 'structure'
    hash reference.
---
 ChangeLog                       |  16 +++++-
 tp/Texinfo/Convert/Converter.pm |  35 ++++++-------
 tp/Texinfo/Convert/HTML.pm      | 106 +++++++++++++++++++++-------------------
 tp/Texinfo/Structuring.pm       |  12 ++---
 tp/init/book.pm                 |   4 +-
 tp/init/chm.pm                  |  10 ++--
 tp/init/epub3.pm                |   2 +-
 tp/t/init/t2h_singular.init     |   7 +--
 8 files changed, 108 insertions(+), 84 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dc2fbebb49..8f09b8b794 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,7 +3,21 @@
        * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
        (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
        (command_filename, command_href, _default_format_element_header)
-       (_default_format_element_footer, _html_set_pages_files, output),
+       (_convert_special_element_type, _default_format_element_footer)
+       (_html_set_pages_files, output),
+       tp/Texinfo/Structuring.pm (elements_file_directions),
+       tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm,
+       tp/t/init/t2h_singular.init: put 'unit_filename' in 'structure'
+       hash reference.
+
+
+2022-01-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Converter.pm (set_tree_unit_file)
+       (_set_tree_units_files, output), tp/Texinfo/Convert/HTML.pm
+       (command_filename, command_href, _default_format_element_header)
+       (_convert_special_element_type, _default_format_element_footer)
+       (_html_set_pages_files, output),
        tp/Texinfo/Structuring.pm (elements_file_directions),
        tp/init/book.pm, tp/init/chm.pm, tp/init/epub3.pm,
        tp/t/init/t2h_singular.init: rename tree unit 'filename' key as
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index b0b07ac924..24bc854145 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -568,7 +568,7 @@ sub set_tree_unit_file($$$$)
       $self->{'filenames'}->{lc($filename)} = $filename;
     }
   }
-  $tree_unit->{'unit_filename'} = $filename;
+  $tree_unit->{'structure'}->{'unit_filename'} = $filename;
   if (defined($destination_directory) and $destination_directory ne '') {
     $tree_unit->{'out_filepath'} =
       File::Spec->catfile($destination_directory, $filename);
@@ -641,8 +641,8 @@ sub _set_tree_units_files($$$$$$)
 
   if (!$self->get_conf('SPLIT')) {
     foreach my $tree_unit (@$tree_units) {
-      if (!defined($tree_unit->{'unit_filename'})) {
-        $tree_unit->{'unit_filename'} = $output_filename;
+      if (!defined($tree_unit->{'structure'}->{'unit_filename'})) {
+        $tree_unit->{'structure'}->{'unit_filename'} = $output_filename;
         $tree_unit->{'out_filepath'} = $output_file;
       }
     }
@@ -662,11 +662,11 @@ sub _set_tree_units_files($$$$$$)
     my $previous_page;
     foreach my $tree_unit (@$tree_units) {
       # For Top node.
-      next if (defined($tree_unit->{'unit_filename'}));
+      next if (defined($tree_unit->{'structure'}->{'unit_filename'}));
       if (!$tree_unit->{'extra'}->{'first_in_page'}) {
         cluck ("No first_in_page for $tree_unit\n");
       }
-      if 
(!defined($tree_unit->{'extra'}->{'first_in_page'}->{'unit_filename'})) {
+      if 
(!defined($tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'}))
 {
         my $file_tree_unit = $tree_unit->{'extra'}->{'first_in_page'};
         foreach my $root_command (@{$file_tree_unit->{'contents'}}) {
           if ($root_command->{'cmdname'} 
@@ -686,7 +686,7 @@ sub _set_tree_units_files($$$$$$)
             last;
           }
         }
-        if (!defined($file_tree_unit->{'unit_filename'})) {
+        if (!defined($file_tree_unit->{'structure'}->{'unit_filename'})) {
           # use section to do the file name if there is no node
           my $command = $file_tree_unit->{'extra'}->{'unit_command'};
           if ($command) {
@@ -716,18 +716,18 @@ sub _set_tree_units_files($$$$$$)
           }
         }
       }
-      $tree_unit->{'unit_filename'}
-         = $tree_unit->{'extra'}->{'first_in_page'}->{'unit_filename'};
+      $tree_unit->{'structure'}->{'unit_filename'}
+         = 
$tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'};
       $tree_unit->{'out_filepath'}
          = $tree_unit->{'extra'}->{'first_in_page'}->{'out_filepath'};
     }
   }
 
   foreach my $tree_unit (@$tree_units) {
-    $self->{'file_counters'}->{$tree_unit->{'unit_filename'}}++;
+    $self->{'file_counters'}->{$tree_unit->{'structure'}->{'unit_filename'}}++;
     print STDERR "Page $tree_unit "
      .Texinfo::Structuring::root_or_external_element_cmd_texi($tree_unit)
-     .": 
$tree_unit->{'unit_filename'}($self->{'file_counters'}->{$tree_unit->{'unit_filename'}})\n"
+     .": 
$tree_unit->{'structure'}->{'unit_filename'}($self->{'file_counters'}->{$tree_unit->{'structure'}->{'unit_filename'}})\n"
       if ($self->get_conf('DEBUG'));
   }
 }
@@ -777,12 +777,12 @@ sub output($$)
                                  $output_filename, $document_name);
   }
 
-  #print STDERR "$tree_units $tree_units->[0]->{'unit_filename'}\n";
+  #print STDERR "$tree_units 
$tree_units->[0]->{'structure'}->{'unit_filename'}\n";
 
   # Now do the output
   my $fh;
   my $output = '';
-  if (!$tree_units or !defined($tree_units->[0]->{'unit_filename'})) {
+  if (!$tree_units or 
!defined($tree_units->[0]->{'structure'}->{'unit_filename'})) {
     # no page
     my $outfile;
     if ($output_file ne '') {
@@ -835,9 +835,10 @@ sub output($$)
     my %files;
     
     foreach my $tree_unit (@$tree_units) {
+      my $tree_unit_filename = $tree_unit->{'structure'}->{'unit_filename'};
       my $file_fh;
       # open the file and output the elements
-      if (!$files{$tree_unit->{'unit_filename'}}->{'fh'}) {
+      if (!$files{$tree_unit_filename}->{'fh'}) {
         $file_fh = Texinfo::Common::output_files_open_out(
                              $self->output_files_information(), $self,
                              $tree_unit->{'out_filepath'});
@@ -847,14 +848,14 @@ sub output($$)
                                     $tree_unit->{'out_filepath'}, $!));
           return undef;
         }
-        $files{$tree_unit->{'unit_filename'}}->{'fh'} = $file_fh;
+        $files{$tree_unit_filename}->{'fh'} = $file_fh;
       } else {
-        $file_fh = $files{$tree_unit->{'unit_filename'}}->{'fh'};
+        $file_fh = $files{$tree_unit_filename}->{'fh'};
       }
       my $tree_unit_text = $self->convert_tree($tree_unit);
       print $file_fh $tree_unit_text;
-      $self->{'file_counters'}->{$tree_unit->{'unit_filename'}}--;
-      if ($self->{'file_counters'}->{$tree_unit->{'unit_filename'}} == 0) {
+      $self->{'file_counters'}->{$tree_unit_filename}--;
+      if ($self->{'file_counters'}->{$tree_unit_filename} == 0) {
         # NOTE do not close STDOUT here to avoid a perl warning
         if ($tree_unit->{'out_filepath'} ne '-') {
           Texinfo::Common::output_files_register_closed(
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f13e986e0a..bda5b303fc 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -623,14 +623,16 @@ sub command_filename($$)
     if (defined($target->{'filename'})) {
       return $target->{'filename'};
     }
-    my ($root_element, $root_command) = 
$self->_html_get_tree_root_element($command, 1);
+    my ($root_element, $root_command)
+           = $self->_html_get_tree_root_element($command, 1);
 
     if (defined($root_command)) {
       $target->{'root_command'} = $root_command;
     }
     if (defined($root_element)) {
-      $target->{'filename'} = $root_element->{'unit_filename'};
-      return $root_element->{'unit_filename'};
+      $target->{'filename'}
+        = $root_element->{'structure'}->{'unit_filename'};
+      return $root_element->{'structure'}->{'unit_filename'};
     }
   }
   return undef;
@@ -709,9 +711,9 @@ sub command_href($$;$$)
     # as in the test cases.  Also for things in @titlepage when
     # titlepage is not output.
     if ($self->{'tree_units'} and $self->{'tree_units'}->[0]
-       and defined($self->{'tree_units'}->[0]->{'unit_filename'})) {
+       and 
defined($self->{'tree_units'}->[0]->{'structure'}->{'unit_filename'})) {
       # In that case use the first page.
-      $target_filename = $self->{'tree_units'}->[0]->{'unit_filename'};
+      $target_filename = 
$self->{'tree_units'}->[0]->{'structure'}->{'unit_filename'};
     }
   }
   if (defined($target_filename)) { 
@@ -3154,8 +3156,8 @@ sub _default_format_element_header($$$$)
       # and there is more than one element
       and ($tree_unit->{'structure'}->{'unit_next'} or 
$tree_unit->{'structure'}->{'unit_prev'})) {
     my $is_top = $self->element_is_tree_unit_top($tree_unit);
-    my $first_in_page = (defined($tree_unit->{'unit_filename'})
-           and $self->{'counter_in_file'}->{$tree_unit->{'unit_filename'}} == 
1);
+    my $first_in_page = (defined($tree_unit->{'structure'}->{'unit_filename'})
+           and 
$self->{'counter_in_file'}->{$tree_unit->{'structure'}->{'unit_filename'}} == 
1);
     my $previous_is_top = ($tree_unit->{'structure'}->{'unit_prev'}
                    and 
$self->element_is_tree_unit_top($tree_unit->{'structure'}->{'unit_prev'}));
 
@@ -5660,7 +5662,7 @@ sub _convert_special_element_type($$$$)
   $result .= ">\n";
   if ($self->get_conf('HEADERS')
       # first in page
-      or $self->{'counter_in_file'}->{$element->{'unit_filename'}} == 1) {
+      or 
$self->{'counter_in_file'}->{$element->{'structure'}->{'unit_filename'}} == 1) {
     $result .= &{$self->{'format_navigation_header'}}($self,
                $self->get_conf('MISC_BUTTONS'), undef, $element);
   }
@@ -5751,9 +5753,10 @@ sub _default_format_element_footer($$$$)
                    and $element->{'structure'}->{'unit_next'}->{'type'} eq 
'special_element');
 
   my $end_page = (!$element->{'structure'}->{'unit_next'}
-       or (defined($element->{'unit_filename'})
-           and $element->{'unit_filename'} ne 
$element->{'structure'}->{'unit_next'}->{'unit_filename'}
-           and $self->{'file_counters'}->{$element->{'unit_filename'}} == 1));
+       or (defined($element->{'structure'}->{'unit_filename'})
+           and $element->{'structure'}->{'unit_filename'}
+               ne 
$element->{'structure'}->{'unit_next'}->{'structure'}->{'unit_filename'}
+           and 
$self->{'file_counters'}->{$element->{'structure'}->{'unit_filename'}} == 1));
 
   my $is_special = (defined($element->{'type'})
                     and $element->{'type'} eq 'special_element');
@@ -5805,9 +5808,9 @@ sub _default_format_element_footer($$$$)
   # condition appearing in end_page except that the file counter
   # needs not to be 1
   if ((!$element->{'structure'}->{'unit_next'}
-       or (defined($element->{'unit_filename'})
-           and $element->{'unit_filename'}
-                  ne 
$element->{'structure'}->{'unit_next'}->{'unit_filename'}))
+       or (defined($element->{'structure'}->{'unit_filename'})
+           and $element->{'structure'}->{'unit_filename'}
+               ne 
$element->{'structure'}->{'unit_next'}->{'structure'}->{'unit_filename'}))
       and $self->get_conf('footnotestyle') eq 'end') {
     $result .= &{$self->{'format_footnotes_text'}}($self);
   }
@@ -6787,8 +6790,8 @@ sub _html_set_pages_files($$$$$$$$)
 
   if (!$self->get_conf('SPLIT')) {
     foreach my $tree_unit (@$tree_units) {
-      if (!defined($tree_unit->{'unit_filename'})) {
-        $tree_unit->{'unit_filename'} = $output_filename;
+      if (!defined($tree_unit->{'structure'}->{'unit_filename'})) {
+        $tree_unit->{'structure'}->{'unit_filename'} = $output_filename;
         $tree_unit->{'out_filepath'} = $output_file;
       }
     }
@@ -6808,11 +6811,11 @@ sub _html_set_pages_files($$$$$$$$)
     my $previous_page;
     foreach my $tree_unit (@$tree_units) {
       # For Top node.
-      next if (defined($tree_unit->{'unit_filename'}));
+      next if (defined($tree_unit->{'structure'}->{'unit_filename'}));
       if (!$tree_unit->{'extra'}->{'first_in_page'}) {
         cluck ("No first_in_page for $tree_unit\n");
       }
-      if 
(!defined($tree_unit->{'extra'}->{'first_in_page'}->{'unit_filename'})) {
+      if 
(!defined($tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'}))
 {
         my $file_tree_unit = $tree_unit->{'extra'}->{'first_in_page'};
         foreach my $root_command (@{$file_tree_unit->{'contents'}}) {
           if ($root_command->{'cmdname'} 
@@ -6840,7 +6843,7 @@ sub _html_set_pages_files($$$$$$$$)
             last;
           }
         }
-        if (!defined($file_tree_unit->{'unit_filename'})) {
+        if (!defined($file_tree_unit->{'structure'}->{'unit_filename'})) {
           # use section to do the file name if there is no node
           my $command = $self->element_command($file_tree_unit);
           if ($command) {
@@ -6869,8 +6872,8 @@ sub _html_set_pages_files($$$$$$$$)
           }
         }
       }
-      $tree_unit->{'unit_filename'}
-         = $tree_unit->{'extra'}->{'first_in_page'}->{'unit_filename'};
+      $tree_unit->{'structure'}->{'unit_filename'}
+         = 
$tree_unit->{'extra'}->{'first_in_page'}->{'structure'}->{'unit_filename'};
       $tree_unit->{'out_filepath'}
          = $tree_unit->{'extra'}->{'first_in_page'}->{'out_filepath'};
     }
@@ -6881,14 +6884,14 @@ sub _html_set_pages_files($$$$$$$$)
       # NOTE the information that it is associated with @top or @node Top
       # may be determined with $self->element_is_tree_unit_top($tree_unit);
       my $filename = &$Texinfo::Config::element_file_name($self, $tree_unit,
-                                                          
$tree_unit->{'unit_filename'});
+                                       
$tree_unit->{'structure'}->{'unit_filename'});
       $self->set_tree_unit_file($tree_unit, $filename, $destination_directory)
          if (defined($filename));
     }
-    $self->{'file_counters'}->{$tree_unit->{'unit_filename'}}++;
+    $self->{'file_counters'}->{$tree_unit->{'structure'}->{'unit_filename'}}++;
     print STDERR "Page $tree_unit "
       .Texinfo::Structuring::root_or_external_element_cmd_texi($tree_unit)
-      .": 
$tree_unit->{'unit_filename'}($self->{'file_counters'}->{$tree_unit->{'unit_filename'}})\n"
+      .": 
$tree_unit->{'structure'}->{'unit_filename'}($self->{'file_counters'}->{$tree_unit->{'structure'}->{'unit_filename'}})\n"
       if ($self->get_conf('DEBUG'));
   }
   if ($special_elements) {
@@ -6898,8 +6901,8 @@ sub _html_set_pages_files($$$$$$$$)
        = $self->{'targets'}->{$special_element}->{'misc_filename'};
       if (defined($filename)) {
         $self->set_tree_unit_file($special_element, $filename, 
$destination_directory);
-        $self->{'file_counters'}->{$special_element->{'unit_filename'}}++;
-        print STDERR "Special page $special_element: 
$special_element->{'unit_filename'}($self->{'file_counters'}->{$special_element->{'unit_filename'}})\n"
+        
$self->{'file_counters'}->{$special_element->{'structure'}->{'unit_filename'}}++;
+        print STDERR "Special page $special_element: 
$special_element->{'structure'}->{'unit_filename'}($self->{'file_counters'}->{$special_element->{'structure'}->{'unit_filename'}})\n"
           if ($self->get_conf('DEBUG'));
       }
       $special_element->{'structure'}->{'unit_prev'} = $previous_tree_unit;
@@ -7097,7 +7100,8 @@ sub _prepare_contents_elements($)
         my $default_filename;
         if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_title') {
           if ($self->{'tree_units'}) {
-            $default_filename = $self->{'tree_units'}->[0]->{'unit_filename'};
+            $default_filename
+              = $self->{'tree_units'}->[0]->{'structure'}->{'unit_filename'};
           }
         } elsif ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top') {
           my $section_top = undef;
@@ -7112,7 +7116,8 @@ sub _prepare_contents_elements($)
               my ($root_element, $root_command)
                 = $self->_html_get_tree_root_element($command);
               if (defined($root_element)) {
-                $default_filename = $root_element->{'unit_filename'};
+                $default_filename
+                   = $root_element->{'structure'}->{'unit_filename'};
                 last;
               }
             }
@@ -8165,7 +8170,7 @@ sub _default_format_frame_files($$)
     my $top_file = '';
     if ($self->global_element('Top')) {
       my $top_element = $self->global_element('Top');
-      $top_file = $top_element->{'unit_filename'};
+      $top_file = $top_element->{'structure'}->{'unit_filename'};
     }
     my $title = $self->{'title_string'};
     print $frame_fh <<EOT;
@@ -8462,12 +8467,13 @@ sub output($$)
   # This may only happen if not split.
   if ($special_elements
       and $tree_units and $tree_units->[0]
-      and defined($tree_units->[0]->{'unit_filename'})) {
+      and defined($tree_units->[0]->{'structure'}->{'unit_filename'})) {
     foreach my $special_element (@$special_elements) {
-      if (!defined($special_element->{'unit_filename'})) {
-        $special_element->{'unit_filename'} = 
$tree_units->[0]->{'unit_filename'};
+      if (!defined($special_element->{'structure'}->{'unit_filename'})) {
+        $special_element->{'structure'}->{'unit_filename'}
+           = $tree_units->[0]->{'structure'}->{'unit_filename'};
         $special_element->{'out_filepath'} = 
$tree_units->[0]->{'out_filepath'};
-        $self->{'file_counters'}->{$special_element->{'unit_filename'}}++;
+        
$self->{'file_counters'}->{$special_element->{'structure'}->{'unit_filename'}}++;
       }
     }
   }
@@ -8617,7 +8623,8 @@ sub output($$)
   my $fh;
   my $output = '';
 
-  if (!$tree_units or !defined($tree_units->[0]->{'unit_filename'})) {
+  if (!$tree_units
+      or !defined($tree_units->[0]->{'structure'}->{'unit_filename'})) {
     # no page
     my $no_page_out_filepath;
     if ($output_file ne '') {
@@ -8644,7 +8651,7 @@ sub output($$)
       }
       # this can be used in init file when there are no tree units.
       # FIXME use an API?  Set in $self->{'no_page'}?
-      $self->{'unit_filename'} = $no_page_output_filename;
+      $self->{'structure'}->{'unit_filename'} = $no_page_output_filename;
       $self->{'out_filepath'} = $no_page_out_filepath;
 
       $self->{'current_filename'} = $no_page_output_filename;
@@ -8699,9 +8706,10 @@ sub output($$)
     # Now do the output, converting each tree units and special elements in 
turn
     $special_elements = [] if (!defined($special_elements));
     foreach my $element (@$tree_units, @$special_elements) {
-      $self->{'current_filename'} = $element->{'unit_filename'};
-      $self->{'counter_in_file'}->{$element->{'unit_filename'}}++;
-      if ($self->{'counter_in_file'}->{$element->{'unit_filename'}} == 1) {
+      my $element_filename = $element->{'structure'}->{'unit_filename'};
+      $self->{'current_filename'} = $element_filename;
+      $self->{'counter_in_file'}->{$element_filename}++;
+      if ($self->{'counter_in_file'}->{$element_filename} == 1) {
         $self->{'element_math'} = 0;
       }
 
@@ -8714,7 +8722,7 @@ sub output($$)
         print STDERR "\nUNIT SPECIAL\n" if ($self->get_conf('DEBUG'));
         $special_element_content .= $self->_convert($element, "output s-unit 
$unit_nr");
         if ($special_element_content eq '') {
-          $self->{'file_counters'}->{$element->{'unit_filename'}}--;
+          $self->{'file_counters'}->{$element_filename}--;
           next ;
         }
       }
@@ -8731,14 +8739,14 @@ sub output($$)
       # register the element but do not print anything. Printing
       # only when file_counters reach 0, to be sure that all the
       # elements have been converted.
-      if (!$files{$element->{'unit_filename'}}->{'first_element'}) {
-        $files{$element->{'unit_filename'}}->{'first_element'} = $element;
-        $files{$element->{'unit_filename'}}->{'body'} = '';
-      }
-      $files{$element->{'unit_filename'}}->{'body'} .= $body;
-      $self->{'file_counters'}->{$element->{'unit_filename'}}--;
-      if ($self->{'file_counters'}->{$element->{'unit_filename'}} == 0) {
-        my $file_element = 
$files{$element->{'unit_filename'}}->{'first_element'};
+      if (!$files{$element_filename}->{'first_element'}) {
+        $files{$element_filename}->{'first_element'} = $element;
+        $files{$element_filename}->{'body'} = '';
+      }
+      $files{$element_filename}->{'body'} .= $body;
+      $self->{'file_counters'}->{$element_filename}--;
+      if ($self->{'file_counters'}->{$element_filename} == 0) {
+        my $file_element = $files{$element_filename}->{'first_element'};
         my $file_fh = Texinfo::Common::output_files_open_out(
                          $self->output_files_information(), $self,
                          $file_element->{'out_filepath'});
@@ -8751,8 +8759,8 @@ sub output($$)
         # do end file first in case it requires some CSS
         my $end_file = &{$self->{'format_end_file'}}($self);
         print $file_fh "".&{$self->{'format_begin_file'}}($self,
-                         $file_element->{'unit_filename'}, $file_element);
-        print $file_fh "".$files{$element->{'unit_filename'}}->{'body'};
+                         $file_element->{'structure'}->{'unit_filename'}, 
$file_element);
+        print $file_fh "".$files{$element_filename}->{'body'};
         # end file
         print $file_fh "". $end_file;
 
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 85ba78a628..b7decd1ea0 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1205,8 +1205,8 @@ sub elements_file_directions($)
   foreach my $tree_unit (@$tree_units) {
     my $directions;
     my $filename;
-    if (defined($tree_unit->{'unit_filename'})) {
-      $filename = $tree_unit->{'unit_filename'};
+    if (defined($tree_unit->{'structure'}->{'unit_filename'})) {
+      $filename = $tree_unit->{'structure'}->{'unit_filename'};
       my $current_tree_unit = $tree_unit;
       if (not defined($current_filename)
           or $filename ne $current_filename) {
@@ -1216,8 +1216,8 @@ sub elements_file_directions($)
       }
       while ($current_tree_unit->{'structure'}->{'unit_prev'}) {
         $current_tree_unit = $current_tree_unit->{'structure'}->{'unit_prev'};
-        if (defined($current_tree_unit->{'unit_filename'})) {
-          if ($current_tree_unit->{'unit_filename'} ne $filename) {
+        if (defined($current_tree_unit->{'structure'}->{'unit_filename'})) {
+          if ($current_tree_unit->{'structure'}->{'unit_filename'} ne 
$filename) {
             $tree_unit->{'structure'}->{'directions'}->{'PrevFile'}
                  = $current_tree_unit;
             last;
@@ -1229,8 +1229,8 @@ sub elements_file_directions($)
       $current_tree_unit = $tree_unit;
       while ($current_tree_unit->{'structure'}->{'unit_next'}) {
         $current_tree_unit = $current_tree_unit->{'structure'}->{'unit_next'};
-        if (defined($current_tree_unit->{'unit_filename'})) {
-          if ($current_tree_unit->{'unit_filename'} ne $filename) {
+        if (defined($current_tree_unit->{'structure'}->{'unit_filename'})) {
+          if ($current_tree_unit->{'structure'}->{'unit_filename'} ne 
$filename) {
             $tree_unit->{'structure'}->{'directions'}->{'NextFile'}
                = $current_tree_unit;
             last;
diff --git a/tp/init/book.pm b/tp/init/book.pm
index 9225082426..0d85f9f929 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -107,8 +107,8 @@ sub book_format_navigation_header($$$$)
           or (!$tree_unit->{'contents'}->[0]->{'cmdname'}
               and $tree_unit->{'contents'}->[1] eq $element))
       # FIXME API
-      and defined($tree_unit->{'unit_filename'})
-      and $self->{'counter_in_file'}->{$tree_unit->{'unit_filename'}} == 1) {
+      and defined($tree_unit->{'structure'}->{'unit_filename'})
+      and 
$self->{'counter_in_file'}->{$tree_unit->{'structure'}->{'unit_filename'}} == 
1) {
     
     return book_print_up_toc($self, $tree_unit->{'extra'}->{'unit_command'}) .
        &{$self->default_formatting_function('format_navigation_header')}($self,
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 91a6e513cd..473787a0d0 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -252,9 +252,9 @@ sub chm_init($)
         # happens for things in @titlepage when it is not output
         if (!defined($file)) {
           if ($self->{'tree_units'} and $self->{'tree_units'}->[0]
-             and defined($self->{'tree_units'}->[0]->{'unit_filename'})) {
+             and 
defined($self->{'tree_units'}->[0]->{'structure'}->{'unit_filename'})) {
             # In that case use the first page.
-            $file = $self->{'tree_units'}->[0]->{'unit_filename'};
+            $file = 
$self->{'tree_units'}->[0]->{'structure'}->{'unit_filename'};
           } else {
             $file = '';
           }
@@ -403,9 +403,9 @@ EOT
   my %chm_files;
   if ($self->{'tree_units'}) {
     foreach my $element (@{$self->{'tree_units'}}) {
-      if (!$chm_files{$element->{'unit_filename'}}) {
-        print $hhp_fh "$element->{'unit_filename'}\n";
-        $chm_files{$element->{'unit_filename'}} = 1;
+      if (!$chm_files{$element->{'structure'}->{'unit_filename'}}) {
+        print $hhp_fh "$element->{'structure'}->{'unit_filename'}\n";
+        $chm_files{$element->{'structure'}->{'unit_filename'}} = 1;
       }
     }
   }
diff --git a/tp/init/epub3.pm b/tp/init/epub3.pm
index c9aab15805..36691e1006 100644
--- a/tp/init/epub3.pm
+++ b/tp/init/epub3.pm
@@ -192,7 +192,7 @@ sub epub_convert_tree_unit_type($$$$)
   my $element = shift;
   my $content = shift;
 
-  push @epub_output_filenames, $element->{'unit_filename'};
+  push @epub_output_filenames, $element->{'structure'}->{'unit_filename'};
   return &{$self->default_types_conversion($type)}($self,
                                       $type, $element, $content);
 }
diff --git a/tp/t/init/t2h_singular.init b/tp/t/init/t2h_singular.init
index c97ea45d73..3b0140aa70 100644
--- a/tp/t/init/t2h_singular.init
+++ b/tp/t/init/t2h_singular.init
@@ -60,9 +60,10 @@ sub singular_format_footer($$$$)
 
   my $end_page = (!$element->{'structure'}->{'unit_next'}
    # FIXME API
-   or (defined($element->{'unit_filename'})
-       and $element->{'unit_filename'} ne 
$element->{'structure'}->{'unit_next'}->{'unit_filename'}
-       and $self->{'file_counters'}->{$element->{'unit_filename'}} == 1));
+   or (defined($element->{'structure'}->{'unit_filename'})
+       and $element->{'structure'}->{'unit_filename'}
+           ne 
$element->{'structure'}->{'unit_next'}->{'structure'}->{'unit_filename'}
+       and 
$self->{'file_counters'}->{$element->{'structure'}->{'unit_filename'}} == 1));
 
   if ($self->element_is_tree_unit_top($element)) {
     my $buttons = $self->get_conf('TOP_BUTTONS');



reply via email to

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