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 (output), tp/Te


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Converter.pm (output), tp/Texinfo/Convert/HTML.pm (_internal_command_href, _html_get_tree_root_element) (_html_set_pages_files, _prepare_special_units, _html_convert_convert) (output_internal_links, _html_convert_output), tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm (output), tp/Texinfo/Convert/Plaintext.pm (convert), tp/Texinfo/XS/convert/convert_html.c (html_get_tree_root_element) (prepare_special_units, html_internal_command_href) (html_set_pages_files, h [...]
Date: Tue, 20 Feb 2024 17:40:35 -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 da830b6d67 * tp/Texinfo/Convert/Converter.pm (output), 
tp/Texinfo/Convert/HTML.pm (_internal_command_href, 
_html_get_tree_root_element) (_html_set_pages_files, _prepare_special_units, 
_html_convert_convert) (output_internal_links, _html_convert_output), 
tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm (output), 
tp/Texinfo/Convert/Plaintext.pm (convert), tp/Texinfo/XS/convert/convert_html.c 
 (html_get_tree_root_element) (prepare_special_units, 
html_internal_command_href) (ht [...]
da830b6d67 is described below

commit da830b6d67f44cdb44528b76bb0517df984ee4d6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Feb 20 23:40:27 2024 +0100

    * tp/Texinfo/Convert/Converter.pm (output), tp/Texinfo/Convert/HTML.pm
    (_internal_command_href, _html_get_tree_root_element)
    (_html_set_pages_files, _prepare_special_units, _html_convert_convert)
    (output_internal_links, _html_convert_output),
    tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm (output),
    tp/Texinfo/Convert/Plaintext.pm (convert),
    tp/Texinfo/XS/convert/convert_html.c  (html_get_tree_root_element)
    (prepare_special_units, html_internal_command_href)
    (html_set_pages_files, html_convert_convert, html_convert_output):
    remove all the codes that are never run as they correspond to
    no output unit since output units are always set if split_by_*
    have been called.
---
 ChangeLog                            |  15 +++++
 tp/Texinfo/Convert/Converter.pm      |  17 ++----
 tp/Texinfo/Convert/HTML.pm           | 106 +++++++++++++----------------------
 tp/Texinfo/Convert/IXIN.pm           |  69 +++++++++++------------
 tp/Texinfo/Convert/Info.pm           |   3 +-
 tp/Texinfo/Convert/Plaintext.pm      |  19 +------
 tp/Texinfo/XS/convert/convert_html.c | 105 ++++++++++++----------------------
 7 files changed, 131 insertions(+), 203 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6ee627e08d..8f6c4589ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-02-20  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Converter.pm (output), tp/Texinfo/Convert/HTML.pm
+       (_internal_command_href, _html_get_tree_root_element)
+       (_html_set_pages_files, _prepare_special_units, _html_convert_convert)
+       (output_internal_links, _html_convert_output),
+       tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Info.pm (output),
+       tp/Texinfo/Convert/Plaintext.pm (convert),
+       tp/Texinfo/XS/convert/convert_html.c  (html_get_tree_root_element)
+       (prepare_special_units, html_internal_command_href)
+       (html_set_pages_files, html_convert_convert, html_convert_output):
+       remove all the codes that are never run as they correspond to
+       no output unit since output units are always set if split_by_*
+       have been called.
+
 2024-02-20  Patrice Dumas  <pertusus@free.fr>
 
        Fix memory leaks found with valgrind
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 93bfc72ad5..edf86f0b54 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -421,8 +421,7 @@ sub output($$)
 
   # Now do the output
   my $fh;
-  if (!$output_units
-      or !defined($output_units->[0]->{'unit_filename'})) {
+  if (!defined($output_units->[0]->{'unit_filename'})) {
     # no page
     my $output = '';
     my $outfile_name;
@@ -460,17 +459,9 @@ sub output($$)
         if ($self->get_conf('DEBUG'));
     }
 
-    if ($output_units and scalar(@$output_units)) {
-      foreach my $output_unit (@$output_units) {
-        my $output_unit_text = $self->convert_output_unit($output_unit);
-        $output .= $self->write_or_return($output_unit_text, $fh);
-      }
-    } else {
-      # REMARK right now, this code is never called, as
-      # Texinfo::Structuring::split_by_node or split_by_page always return
-      # an array containing at least one unit.  But this was not the case
-      # in the past and could change again in the future.
-      $output .= $self->write_or_return($self->convert($document), $fh);
+    foreach my $output_unit (@$output_units) {
+      my $output_unit_text = $self->convert_output_unit($output_unit);
+      $output .= $self->write_or_return($output_unit_text, $fh);
     }
     # NOTE do not close STDOUT now to avoid a perl warning.
     # FIXME is it still true that there is such a warning?
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index d7cb41ed20..5bc192e3f4 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1076,9 +1076,7 @@ sub _internal_command_href($$;$$)
     # Happens if there are no pages, for example if OUTPUT is set to ''
     # as in the test cases.  Also for things in @titlepage when
     # titlepage is not output.
-    if ($self->{'document_units'} and $self->{'document_units'}->[0]
-        and defined($self->{'document_units'}->[0]
-                                   ->{'unit_filename'})) {
+    if ($self->{'document_units'}->[0]->{'unit_filename'}) {
       # In that case use the first page.
       $target_filename
         = $self->{'document_units'}->[0]->{'unit_filename'};
@@ -9608,8 +9606,7 @@ sub _html_get_tree_root_element($$;$)
           }
         } elsif ($current->{'cmdname'} eq 'titlepage'
                  and $self->get_conf('USE_TITLEPAGE_FOR_TITLE')
-                 and $self->get_conf('SHOW_TITLE')
-                 and $self->{'document_units'}->[0]) {
+                 and $self->get_conf('SHOW_TITLE')) {
           #print STDERR "FOR titlepage document_units [0]\n" if ($debug);
           return ($self->{'document_units'}->[0],
                   $self->{'document_units'}->[0]->{'unit_command'});
@@ -9652,9 +9649,6 @@ sub _html_set_pages_files($$$$$$$$$)
   my $output_filename = shift;
   my $document_name = shift;
 
-  # Ensure that the document has pages
-  return undef if (!defined($output_units) or !@$output_units);
-
   $self->initialize_output_units_files();
 
   my @filenames_order;
@@ -9883,7 +9877,6 @@ sub _html_set_pages_files($$$$$$$$$)
       # Associate the special elements that have no page with the main page.
       # This may only happen if not split.
       if (!defined($filename)
-          and $output_units and $output_units->[0]
           and defined($output_units->[0]->{'unit_filename'})) {
         $filename = $output_units->[0]->{'unit_filename'};
       }
@@ -10109,11 +10102,7 @@ sub _prepare_special_units($$)
         } else {
           my $associated_output_unit;
           if ($contents_location eq 'after_title') {
-            if ($output_units and scalar(@$output_units)) {
-              $associated_output_unit = $output_units->[0];
-            } else {
-              next;
-            }
+            $associated_output_unit = $output_units->[0];
           } elsif ($contents_location eq 'after_top') {
             if ($global_commands and $global_commands->{'top'}) {
               my $section_top = $global_commands->{'top'};
@@ -10149,12 +10138,12 @@ sub _prepare_special_units($$)
 
   if ($global_commands and $global_commands->{'footnote'}
       and $self->get_conf('footnotestyle') eq 'separate'
-      and $output_units and scalar(@$output_units) > 1) {
+      and scalar(@$output_units) > 1) {
     $do_special{'footnotes'} = 1;
   }
 
   if ((!defined($self->get_conf('DO_ABOUT'))
-       and $output_units and scalar(@$output_units) > 1
+       and scalar(@$output_units) > 1
            and ($self->get_conf('SPLIT') or $self->get_conf('HEADERS')))
        or ($self->get_conf('DO_ABOUT'))) {
     $do_special{'about'} = 1;
@@ -10184,9 +10173,7 @@ sub _prepare_special_units($$)
 
   # Setup separate special output units
   my $previous_output_unit;
-  if ($output_units and scalar(@$output_units)) {
-    $previous_output_unit = $output_units->[-1];
-  }
+  $previous_output_unit = $output_units->[-1];
 
   foreach my $special_unit_variety (@sorted_elements_varieties) {
 
@@ -11967,22 +11954,16 @@ sub _html_convert_convert($$$$)
 
   $self->{'current_filename'} = '';
 
-  if (!defined($output_units)) {
-    print STDERR "\nC NO UNIT\n" if ($self->get_conf('DEBUG'));
-    $result = $self->_convert($root, 'convert no unit');
-    $result .= 
&{$self->formatting_function('format_footnotes_segment')}($self);
-  } else {
-    my $unit_nr = 0;
-    # TODO there is no rule before the footnotes special element in
-    # case of separate footnotes in the default formatting style.
-    # Not sure if it is an issue.
-    foreach my $output_unit (@$output_units, @$special_units) {
-      print STDERR "\nC UNIT $unit_nr\n" if ($self->get_conf('DEBUG'));
-      my $output_unit_text = $self->convert_output_unit($output_unit,
-                                                 "convert unit $unit_nr");
-      $result .= $output_unit_text;
-      $unit_nr++;
-    }
+  my $unit_nr = 0;
+  # TODO there is no rule before the footnotes special element in
+  # case of separate footnotes in the default formatting style.
+  # Not sure if it is an issue.
+  foreach my $output_unit (@$output_units, @$special_units) {
+    print STDERR "\nC UNIT $unit_nr\n" if ($self->get_conf('DEBUG'));
+    my $output_unit_text = $self->convert_output_unit($output_unit,
+                                               "convert unit $unit_nr");
+    $result .= $output_unit_text;
+    $unit_nr++;
   }
   $self->{'current_filename'} = undef;
   return $result;
@@ -12139,19 +12120,18 @@ sub output_internal_links($)
 {
   my $self = shift;
   my $out_string = '';
-  if ($self->{'document_units'}) {
-    foreach my $output_unit (@{$self->{'document_units'}}) {
-      my $text;
-      my $href;
-      my $command = $output_unit->{'unit_command'};
-      if (defined($command)) {
-        # Use '' for filename, to force a filename in href.
-        $href = $self->command_href($command, '');
-        my $tree = $self->command_tree($command);
-        if ($tree) {
-          $text = Texinfo::Convert::Text::convert_to_text($tree,
-                                    $self->{'convert_text_options'});
-        }
+
+  foreach my $output_unit (@{$self->{'document_units'}}) {
+    my $text;
+    my $href;
+    my $command = $output_unit->{'unit_command'};
+    if (defined($command)) {
+      # Use '' for filename, to force a filename in href.
+      $href = $self->command_href($command, '');
+      my $tree = $self->command_tree($command);
+      if ($tree) {
+        $text = Texinfo::Convert::Text::convert_to_text($tree,
+                                  $self->{'convert_text_options'});
       }
       if (defined($href) or defined($text)) {
         $out_string .= $href if (defined($href));
@@ -12161,6 +12141,7 @@ sub output_internal_links($)
       }
     }
   }
+
   my $index_entries_by_letter
     = $self->get_converter_indices_sorted_by_letter();
   if ($index_entries_by_letter) {
@@ -12453,24 +12434,17 @@ sub _html_convert_output($$$$$$$$)
   if ($output_file eq '') {
     $self->{'current_filename'} = $output_filename;
     my $body = '';
-    if ($output_units and @$output_units) {
-      my $unit_nr = 0;
-      # TODO there is no rule before the footnotes special element in
-      # case of separate footnotes in the default formatting style.
-      # Not sure if it is an issue.
-      foreach my $output_unit (@$output_units, @$special_units) {
-        print STDERR "\nUNIT NO-PAGE $unit_nr\n" if ($self->get_conf('DEBUG'));
-        my $output_unit_text
-          = $self->convert_output_unit($output_unit,
-                                       "no-page output unit $unit_nr");
-        $body .= $output_unit_text;
-        $unit_nr++;
-      }
-    } else {
-      $body .= $self->get_info('title_titlepage');
-      print STDERR "\nNO UNIT NO PAGE\n" if ($self->get_conf('DEBUG'));
-      $body .= $self->_convert($root, 'no-page output no unit');
-      $body .= 
&{$self->formatting_function('format_footnotes_segment')}($self);
+    my $unit_nr = 0;
+    # TODO there is no rule before the footnotes special element in
+    # case of separate footnotes in the default formatting style.
+    # Not sure if it is an issue.
+    foreach my $output_unit (@$output_units, @$special_units) {
+      print STDERR "\nUNIT NO-PAGE $unit_nr\n" if ($self->get_conf('DEBUG'));
+      my $output_unit_text
+        = $self->convert_output_unit($output_unit,
+                                     "no-page output unit $unit_nr");
+      $body .= $output_unit_text;
+      $unit_nr++;
     }
 
     # do end file first, in case it needs some CSS
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 7bf4d2164a..d5823b4660 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -519,45 +519,42 @@ sub output_ixin($$)
   my %node_tweaks;
   my @nodes;
   my $document_output = '';
-  if ($output_units) {
-    foreach my $output_unit (@$output_units) {
-      next if (not defined($output_unit->{'unit_command'}));
-      $node_nr++;
-      my $node = $output_unit->{'unit_command'};
-      push @nodes, $node;
-      my $normalized_node_name = $node->{'extra'}->{'normalized'};
-      foreach my $setting_command_name (keys(%current_settings)) {
-        $node_tweaks{$normalized_node_name}->{$setting_command_name}
-          = $current_settings{$setting_command_name};
-      }
-      $node_label_number{$normalized_node_name} = $node_nr;
-
-      my $output_unit_result = $self->convert_output_unit($output_unit)."\n";
-      $document_output .= $output_unit_result;
-
-      # get node length.
-      $output_unit_byte_sizes{$normalized_node_name}
-         = $self->_count_bytes($output_unit_result);
-      # update current settings
-      if (defined($end_of_nodes_setting_commands{$normalized_node_name})) {
-        foreach my $setting_command_name 
(keys(%{$end_of_nodes_setting_commands{$normalized_node_name}})) {
-          # FIXME should use get_conf instead?
-          my $value = 
Texinfo::Common::_informative_command_value_informative_command_value(
-            
$end_of_nodes_setting_commands{$normalized_node_name}->{$setting_command_name});
-          if ((defined($settings{$setting_command_name})
-               and $settings{$setting_command_name} eq $value)
-              or (!defined($settings{$setting_command_name})
-                  and 
defined($setting_commands_defaults{$setting_command_name})
-                  and $setting_commands_defaults{$setting_command_name} eq 
$value)) {
-            delete $current_settings{$setting_command_name};
-          } else {
-            $current_settings{$setting_command_name} = $value;
-          }
+
+  foreach my $output_unit (@$output_units) {
+    next if (not defined($output_unit->{'unit_command'}));
+    $node_nr++;
+    my $node = $output_unit->{'unit_command'};
+    push @nodes, $node;
+    my $normalized_node_name = $node->{'extra'}->{'normalized'};
+    foreach my $setting_command_name (keys(%current_settings)) {
+      $node_tweaks{$normalized_node_name}->{$setting_command_name}
+        = $current_settings{$setting_command_name};
+    }
+    $node_label_number{$normalized_node_name} = $node_nr;
+
+    my $output_unit_result = $self->convert_output_unit($output_unit)."\n";
+    $document_output .= $output_unit_result;
+
+    # get node length.
+    $output_unit_byte_sizes{$normalized_node_name}
+       = $self->_count_bytes($output_unit_result);
+    # update current settings
+    if (defined($end_of_nodes_setting_commands{$normalized_node_name})) {
+      foreach my $setting_command_name 
(keys(%{$end_of_nodes_setting_commands{$normalized_node_name}})) {
+        # FIXME should use get_conf instead?
+        my $value = 
Texinfo::Common::_informative_command_value_informative_command_value(
+          
$end_of_nodes_setting_commands{$normalized_node_name}->{$setting_command_name});
+        if ((defined($settings{$setting_command_name})
+             and $settings{$setting_command_name} eq $value)
+            or (!defined($settings{$setting_command_name})
+                and defined($setting_commands_defaults{$setting_command_name})
+                and $setting_commands_defaults{$setting_command_name} eq 
$value)) {
+          delete $current_settings{$setting_command_name};
+        } else {
+          $current_settings{$setting_command_name} = $value;
         }
       }
     }
-  } else {
-    # not a full document.
   }
 
   my $nodes_index = $self->ixin_open_element('nodesindex');
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 13c5f07908..6b2dc4fe10 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -123,8 +123,7 @@ sub output($$)
 
   my $out_file_nr = 0;
   my @indirect_files;
-  if (!defined($output_units) or not defined($output_units->[0])
-      or not defined($output_units->[0]->{'unit_command'})) {
+  if (not defined($output_units->[0]->{'unit_command'})) {
     my $input_file_name;
     if ($self->{'document'}) {
       my $document_info = $self->{'document'}->global_information();
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index d681b41baa..6b25a63145 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -630,23 +630,10 @@ sub convert($$)
   my $result = '';
 
   my $output_units = Texinfo::Structuring::split_by_node($root);
-  if (!defined($output_units)) {
-    push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0,
-                                       'locations' => [],
-                                       'result' => '' };
-    $self->_convert($root);
-    $self->count_context_bug_message('no element ');
-    $self->process_footnotes();
-    $self->count_context_bug_message('no element footnotes ');
-    $result = _stream_result($self);
 
-    pop @{$self->{'count_context'}};
-    return $result;
-  } else {
-    foreach my $output_unit (@$output_units) {
-      my $node_text = convert_output_unit($self, $output_unit);
-      $result .= $node_text;
-    }
+  foreach my $output_unit (@$output_units) {
+    my $node_text = convert_output_unit($self, $output_unit);
+    $result .= $node_text;
   }
 
   $self->conversion_finalization();
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index dbbae01cab..39b276b3c4 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -374,8 +374,7 @@ html_get_tree_root_element (CONVERTER *self, const ELEMENT 
*command,
             }
           else if (data_cmd == CM_titlepage
                    && self->conf->USE_TITLEPAGE_FOR_TITLE.integer > 0
-                   && self->conf->SHOW_TITLE.integer > 0
-                   && output_units->number > 0)
+                   && self->conf->SHOW_TITLE.integer > 0)
             {
               ROOT_AND_UNIT *result = malloc (sizeof (ROOT_AND_UNIT));
               result->output_unit = output_units->list[0];
@@ -1483,10 +1482,7 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
                   const OUTPUT_UNIT *associated_output_unit = 0;
                   if (!strcmp (contents_location, "after_title"))
                     {
-                      if (output_units->number > 0)
-                        associated_output_unit = output_units->list[0];
-                      else
-                        continue;
+                      associated_output_unit = output_units->list[0];
                     }
                   else if (!strcmp (contents_location, "after_top"))
                     {
@@ -1541,11 +1537,11 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
 
   if (self->document->global_commands->footnotes.number > 0
       && !strcmp(self->conf->footnotestyle.string, "separate")
-      && output_units && output_units->number > 1)
+      && output_units->number > 1)
     add_string ("footnotes", do_special);
 
   if ((self->conf->DO_ABOUT.integer < 0
-       && output_units && output_units->number > 1
+       && output_units->number > 1
        && ((self->conf->SPLIT.string && strlen (self->conf->SPLIT.string))
            || self->conf->HEADERS.integer > 0))
       || self->conf->DO_ABOUT.integer > 0)
@@ -1564,8 +1560,7 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
   qsort (special_units_order, do_special->number, sizeof (SPECIAL_UNIT_ORDER),
          compare_special_units);
 
-  if (output_units && output_units->number > 0)
-    previous_output_unit = output_units->list[output_units->number-1];
+  previous_output_unit = output_units->list[output_units->number-1];
 
   for (i = 0; i < do_special->number; i++)
     {
@@ -3502,8 +3497,7 @@ html_internal_command_href (CONVERTER *self, const 
ELEMENT *command,
       titlepage is not output. */
       const OUTPUT_UNIT_LIST *output_units
          = retrieve_output_units (self->document_units_descriptor);
-      if (output_units && output_units->number > 0
-          && output_units->list[0]->unit_filename)
+      if (output_units->list[0]->unit_filename)
         { /* In that case use the first page. */
           target_filename = (FILE_NUMBER_NAME *)
             malloc (sizeof (FILE_NUMBER_NAME));
@@ -5260,9 +5254,6 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST 
*output_units,
   char **unit_file_name_paths;
   int i;
 
-  if (!output_units || !output_units->number)
-    return 0;
-
   initialize_output_units_files (self);
 
   files_source_info = (FILE_SOURCE_INFO_LIST *)
@@ -5617,7 +5608,6 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST 
*output_units,
         /* Associate the special elements that have no page with the main page.
            This may only happen if not split. */
           if (!filename && special_units->number
-              && output_units && output_units->number
               && output_units->list[0]->unit_filename)
             {
               filename = output_units->list[0]->unit_filename;
@@ -18274,6 +18264,8 @@ html_convert_convert (CONVERTER *self, const ELEMENT 
*root,
                       int special_units_descriptor)
 {
   TEXT result;
+  int unit_nr = 0;
+  int i;
 
   const OUTPUT_UNIT_LIST *output_units
     = retrieve_output_units (output_units_descriptor);
@@ -18285,38 +18277,24 @@ html_convert_convert (CONVERTER *self, const ELEMENT 
*root,
   self->current_filename.filename = "";
   self->current_filename.file_number = 1;
 
-  if (!output_units || !output_units->number)
+  for (i = 0; i < output_units->number; i++)
     {
-      if (self->conf->DEBUG.integer > 0)
-        fprintf (stderr, "\nC NO UNIT\n");
-
-      convert_to_html_internal (self, root, &result,
-                                "convert no unit");
-
-      format_footnotes_segment (self, &result);
+      const OUTPUT_UNIT *output_unit = output_units->list[i];
+      convert_convert_output_unit_internal (self, &result, output_unit,
+                            unit_nr, "C UNIT", "convert unit");
+      unit_nr++;
     }
-  else
+  if (special_units && special_units->number)
     {
-      int unit_nr = 0;
-      int i;
-      for (i = 0; i < output_units->number; i++)
+      for (i = 0; i < special_units->number; i++)
         {
-          const OUTPUT_UNIT *output_unit = output_units->list[i];
-          convert_convert_output_unit_internal (self, &result, output_unit,
-                                unit_nr, "C UNIT", "convert unit");
+          const OUTPUT_UNIT *special_unit = special_units->list[i];
+          convert_convert_output_unit_internal (self, &result,
+                    special_unit, unit_nr, "C UNIT", "convert unit");
           unit_nr++;
         }
-      if (special_units && special_units->number)
-        {
-          for (i = 0; i < special_units->number; i++)
-            {
-              const OUTPUT_UNIT *special_unit = special_units->list[i];
-              convert_convert_output_unit_internal (self, &result,
-                        special_unit, unit_nr, "C UNIT", "convert unit");
-              unit_nr++;
-            }
-        }
     }
+
   self->current_filename.filename = 0;
 
   return result.text;
@@ -18554,48 +18532,35 @@ html_convert_output (CONVERTER *self, const ELEMENT 
*root,
     {
       char *file_end;
       char *file_beginning;
+      int unit_nr = 0;
+      int i;
 
       self->current_filename.filename = output_filename;
       self->current_filename.file_number = 1;
 
       text_append (&text, "");
 
-      if (output_units && output_units->number)
+      for (i = 0; i < output_units->number; i++)
         {
-          int unit_nr = 0;
-          int i;
-          for (i = 0; i < output_units->number; i++)
-            {
-              const OUTPUT_UNIT *output_unit = output_units->list[i];
-              convert_convert_output_unit_internal (self, &text, output_unit,
-                             unit_nr, "UNIT NO-PAGE", "no-page output unit");
-              unit_nr++;
-            }
+          const OUTPUT_UNIT *output_unit = output_units->list[i];
+          convert_convert_output_unit_internal (self, &text, output_unit,
+                         unit_nr, "UNIT NO-PAGE", "no-page output unit");
+          unit_nr++;
+        }
       /* TODO there is no rule before the footnotes special element in
          case of separate footnotes in the default formatting style.
          Not sure if it is an issue. */
-          if (special_units && special_units->number)
+      if (special_units && special_units->number)
+        {
+          for (i = 0; i < special_units->number; i++)
             {
-              for (i = 0; i < special_units->number; i++)
-                {
-                  const OUTPUT_UNIT *special_unit = special_units->list[i];
-                  convert_convert_output_unit_internal (self, &text,
-                                 special_unit, unit_nr, "UNIT NO-PAGE",
-                                 "no-page output unit");
-                  unit_nr++;
-                }
+              const OUTPUT_UNIT *special_unit = special_units->list[i];
+              convert_convert_output_unit_internal (self, &text,
+                             special_unit, unit_nr, "UNIT NO-PAGE",
+                             "no-page output unit");
+              unit_nr++;
             }
         }
-      else
-        {
-          if (self->conf->DEBUG.integer > 0)
-            fprintf (stderr, "\nNO UNIT NO PAGE\n");
-
-          text_append (&text, self->title_titlepage);
-          convert_to_html_internal (self, root, &text,
-                                     "no-page output no unit");
-          format_footnotes_segment (self, &result);
-        }
 
       /* do end file first, in case it needs some CSS */
       file_end = format_end_file (self, output_filename, 0);



reply via email to

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