texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Add last element argument to format_end_file


From: Patrice Dumas
Subject: branch master updated: Add last element argument to format_end_file
Date: Mon, 04 Sep 2023 15:27:50 -0400

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 a7686eba61 Add last element argument to format_end_file
a7686eba61 is described below

commit a7686eba61d5b6ec506f1922e6ce2be304f89c7c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 4 21:27:40 2023 +0200

    Add last element argument to format_end_file
    
    * doc/texi2any_api.texi (Customizing HTML File End),
    tp/Texinfo/Convert/HTML.pm (_default_format_end_file, output): add the
    last element to the call of format_end_file in output.  Idea from
    LilyPond init file commit from Jonas Hahnfeld where converter state
    is used, to be able to get the output unit directly instead.
---
 ChangeLog                   | 10 ++++++++++
 doc/texi2any_api.texi       |  3 ++-
 tp/Texinfo/Convert/HTML.pm  |  8 +++++---
 tp/t/init/t2h_singular.init |  2 +-
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b63287cd45..f4fe902b42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-09-04  Patrice Dumas <pertusus@free.fr>
+
+       Add last element argument to format_end_file
+
+       * doc/texi2any_api.texi (Customizing HTML File End),
+       tp/Texinfo/Convert/HTML.pm (_default_format_end_file, output): add the
+       last element to the call of format_end_file in output.  Idea from
+       LilyPond init file commit from Jonas Hahnfeld where converter state
+       is used, to be able to get the output unit directly instead.
+
 2023-09-03  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Config.pm (GNUT_load_init_file): Check if
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index b98232f89e..bccefa31f6 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -4096,8 +4096,9 @@ The @code{format_end_file} function reference give full 
control over the page
 footer formatting done at the bottom of each HTML output file.
 
 @deftypefn {Function Reference} @var{$file_end} format_end_file @
-                                         (@var{$converter}, @var{$filename})
+                 (@var{$converter}, @var{$filename}, @var{\%tree_unit_element})
 @var{$filename} is the name of the file output.
+@var{\%tree_unit_element} is the last output unit of the file.
 @cindex @code{</body>} tag, outputting
 This function should print the page footer, including
 the @code{</body>} element.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6c21e5a19f..0c4d46f5f6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9837,10 +9837,11 @@ sub _default_format_program_string($)
   }
 }
 
-sub _default_format_end_file($$)
+sub _default_format_end_file($$$)
 {
   my $self = shift;
   my $filename = shift;
+  my $output_unit = shift;
 
   my $program_text = '';
   if ($self->get_conf('PROGRAM_NAME_IN_FOOTER')) {
@@ -11200,7 +11201,7 @@ sub output($$)
 
     # do end file first, in case it needs some CSS
     my $footer = &{$self->formatting_function('format_end_file')}($self,
-                                                       $output_filename);
+                                                  $output_filename, undef);
     my $header = &{$self->formatting_function('format_begin_file')}($self,
                                                   $output_filename, undef);
     $output .= $self->write_or_return($header, $fh);
@@ -11282,7 +11283,8 @@ sub output($$)
         }
         # do end file first in case it requires some CSS
         my $end_file = &{$self->formatting_function('format_end_file')}($self,
-                                                           $element_filename);
+                                                           $element_filename,
+                                                           $element);
         print $file_fh "".&{$self->formatting_function('format_begin_file')}(
                                        $self, $element_filename, 
$file_element);
         print $file_fh "".$files{$element_filename}->{'body'};
diff --git a/tp/t/init/t2h_singular.init b/tp/t/init/t2h_singular.init
index f05fee9c33..9bad8e75ee 100644
--- a/tp/t/init/t2h_singular.init
+++ b/tp/t/init/t2h_singular.init
@@ -109,7 +109,7 @@ sub singular_format_footer($$$$)
 texinfo_register_formatting_function('format_end_file' , 
\&singular_format_end_file);
 
 # footer of page
-sub singular_format_end_file($)
+sub singular_format_end_file($$$)
 {
   my $self = shift;
   my $pre_body_close = $self->get_conf('PRE_BODY_CLOSE');



reply via email to

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