texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_u


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (convert_unit_type) (output_units_internal_conversion_table): implement convert_unit_type.
Date: Sun, 26 Nov 2023 17:31:54 -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 141c806c3d * tp/Texinfo/XS/convert/convert_html.c (convert_unit_type) 
(output_units_internal_conversion_table): implement convert_unit_type.
141c806c3d is described below

commit 141c806c3d98987a81f772e8a33cd710390f442d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 26 23:31:46 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (convert_unit_type)
    (output_units_internal_conversion_table): implement convert_unit_type.
    
    * tp/Texinfo/Convert/HTML.pm (_convert_unit_type): only use
    $output_unit as variable name.
---
 ChangeLog                            |  8 +++++
 tp/Texinfo/Convert/HTML.pm           |  9 +++--
 tp/Texinfo/XS/convert/convert_html.c | 70 ++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 334dc50bcc..cf15e2d27d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-26  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (convert_unit_type)
+       (output_units_internal_conversion_table): implement convert_unit_type.
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_unit_type): only use
+       $output_unit as variable name.
+
 2023-11-26  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Transformations.pm (fill_gaps_in_sectioning),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6eb76f1843..9899780167 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -7481,7 +7481,7 @@ sub _convert_unit_type($$$$)
 {
   my $self = shift;
   my $type = shift;
-  my $element = shift;
+  my $output_unit = shift;
   my $content = shift;
 
   $content = '' if (!defined($content));
@@ -7490,7 +7490,6 @@ sub _convert_unit_type($$$$)
     return $content;
   }
   my $result = '';
-  my $output_unit = $element;
   if (not $output_unit->{'tree_unit_directions'}
       or not $output_unit->{'tree_unit_directions'}->{'prev'}) {
     $result .= $self->get_info('title_titlepage');
@@ -7515,11 +7514,11 @@ sub _convert_unit_type($$$$)
   }
   $result .= $content;
   my $unit_command;
-  if ($element->{'unit_command'}) {
-    $unit_command = $element->{'unit_command'};
+  if ($output_unit->{'unit_command'}) {
+    $unit_command = $output_unit->{'unit_command'};
   }
   $result .= &{$self->formatting_function('format_element_footer')}($self, 
$type,
-                                               $element, $content, 
$unit_command);
+                                             $output_unit, $content, 
$unit_command);
 
   return $result;
 }
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index de71c82a0c..eec6c8d12d 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -3589,6 +3589,75 @@ static TYPE_INTERNAL_CONVERSION 
types_internal_conversion_table[] = {
   {0, 0},
 };
 
+void convert_unit_type (CONVERTER *self,
+                        const enum output_unit_type unit_type,
+                        const OUTPUT_UNIT *output_unit, const char *content,
+                        TEXT *result)
+{
+  STRING_LIST *closed_strings;
+  ELEMENT *unit_command;
+  char *formatted_footer;
+
+  if (in_string (self))
+    return;
+
+  if (!output_unit->tree_unit_directions[D_prev])
+    {
+      text_append (result, self->title_titlepage);
+      if (!output_unit->tree_unit_directions[D_next])
+        {
+          char *footnotes_segment;
+          /* only one unit, use simplified formatting */
+          if (content)
+            text_append (result, content);
+   /*  if there is one unit it also means that there is no formatting
+       of footnotes in a separate unit.  And if footnotestyle is end
+       the footnotes won't be done in format_element_footer either. */
+          footnotes_segment
+            = call_formatting_function_format_footnotes_segment (self);
+          if (footnotes_segment)
+            {
+              text_append (result, footnotes_segment);
+              free (footnotes_segment);
+            }
+          if (self->conf->DEFAULT_RULE
+              && self->conf->PROGRAM_NAME_IN_FOOTER > 0)
+            {
+              text_append (result, self->conf->DEFAULT_RULE);
+              text_append_n (result, "\n", 1);
+            }
+
+    /* do it here, as it is won't be done at end of page in
+       format_element_footer */
+          closed_strings = html_close_registered_sections_level (self, 0);
+
+          if (closed_strings->number)
+            {
+              int i;
+              for (i = 0; i < closed_strings->number; i++)
+                {
+                  text_append (result, closed_strings->list[i]);
+                }
+              free (closed_strings->list);
+            }
+          free (closed_strings);
+          return;
+        }
+    }
+
+  if (content)
+    text_append (result, content);
+
+  unit_command = output_unit->unit_command;
+
+  formatted_footer
+    = call_formatting_function_format_element_footer (self, unit_type,
+                                         output_unit, content, unit_command);
+  text_append (result, formatted_footer);
+
+  free (formatted_footer);
+}
+
 void
 convert_special_unit_type (CONVERTER *self,
                         const enum output_unit_type unit_type,
@@ -3718,6 +3787,7 @@ convert_special_unit_type (CONVERTER *self,
 
 static OUTPUT_UNIT_INTERNAL_CONVERSION 
output_units_internal_conversion_table[] = {
   {OU_special_unit, &convert_special_unit_type},
+  {OU_unit, &convert_unit_type},
   {0, 0},
 };
 



reply via email to

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