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, 15 Feb 2024 10:08:24 -0500 (EST)

branch: master
commit 9b33d8d2ca5c5e4b4d3e7b5b17644cb4a14185cc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Feb 15 16:08:07 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (current_filename)
    (%available_converter_info): add a specific accessor to get the
    current_filename.  Remove from %available_converter_info.  Update
    callers of get_info('current_filename').
    
    * doc/texi2any_api.texi: update.
---
 ChangeLog                       |  9 +++++++++
 doc/texi2any_api.texi           | 31 +++++++++++++------------------
 tp/Texinfo/Convert/Converter.pm |  6 ++++++
 tp/Texinfo/Convert/HTML.pm      | 15 ++++++++++-----
 4 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5fbdf0d20..ff59e42383 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-15  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (current_filename)
+       (%available_converter_info): add a specific accessor to get the
+       current_filename.  Remove from %available_converter_info.  Update
+       callers of get_info('current_filename').
+
+       * doc/texi2any_api.texi: update.
+
 2024-02-15  Patrice Dumas  <pertusus@free.fr>
 
        * doc/texi2any_api.texi: update.
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 5203ac67e8..867f1eb50a 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -1402,7 +1402,7 @@ The converter can also be used for in-document strings 
translation.
 One important converter method that can be used in user defined functions
 is @code{convert_tree} that convert a Texinfo tree rooted at any element.
 There is no reason to use that function often, as the converter
-already goes through the tree calling reference functions to convert
+already goes through the tree calling functions to convert
 the elements, but it can be interesting in some cases.
 
 @deftypefun {@var{$converted_text} =} @var{$converter}->convert_tree 
(@var{\%element}, @var{$explanation})
@@ -1798,7 +1798,8 @@ In the rare cases when overriding the customization would 
be needed, the
 @node Conversion General Information
 @section Conversion General Information
 
-Some general information is available from the converter.
+Some general information is available from the converter.  This information
+should not change during conversion.
 
 To determine if an output format such as @samp{html} or @samp{tex}
 is expanded (@pxref{Conditional Commands,,, texinfo, Texinfo}), use
@@ -1821,9 +1822,6 @@ The available information is about:
 Text appearing in @code{@@copying} with all the Texinfo commands
 put into comments (@pxref{@code{@@copying},,, texinfo, Texinfo}).
 
-@item current_filename
-The file name of the current output unit being converted.
-
 @item destination_directory
 Destination directory for the output files.  It is common to use that string 
in directory
 or file paths with functions requiring binary strings.  In that case the
@@ -1831,7 +1829,8 @@ character string needs to be encoded.  @xref{Encoding 
File Path Strings}.
 
 @item document
 The @code{Texinfo::Document} parsed Texinfo document being converted.
-Some information is available from the document using function accessors:
+Some information relevant for conversion is available from the document
+using function accessors:
 
 @table @code
 @item floats_information
@@ -1857,6 +1856,8 @@ Information about defined indices, merged indices and 
index entries.
 List of the sectioning commands in the document.
 @end table
 
+@xref{Texinfo@asis{::}Document Getting document 
information,,,texi2any_internals} on information available from the document.
+
 @item document_name
 Base name of the document.  It is common to use that string in in directory or
 file paths with functions requiring binary strings.  In that case the character
@@ -1874,15 +1875,6 @@ hash reference with format names as key and a true value 
as value if
 the format is expanded, according to command-line and init file
 information.
 
-@c remove from the API at leat temporary such as not to worry with
-@c that to sort out XS/nonXS interfaces for index_entries_by_letter
-@c which is actually used
-@ignore
-@item index_entries
-Information on indices taking into account merged indices.
-@xref{Texinfo::Structuring $merged_entries = 
merge_indices($index_names),,Texinfo::Structuring::merge_indices, 
texi2any_internals}.
-@end ignore
-
 @item jslicenses
 An hash reference with  categories of javascript used in the document
 as keys. The corresponding values are also hashes with file names
@@ -1932,9 +1924,6 @@ and @code{USE_TITLEPAGE_FOR_TITLE} customization 
variables in the default case.
 
 @end table
 
-@code{current_filename} is set dynamically, the other information
-should not change during conversion.
-
 @xref{Simple Customization of CSS} for an explanation on getting
 information on CSS.
 
@@ -2993,6 +2982,12 @@ preformatted containers and @@-commands such as 
@code{@@abbr}, @code{@@footnote}
 @node Dynamic Converter Formatting Information
 @section Dynamic Converter Formatting Information
 
+To get the file name of the current output unit being converted,
+use @code{current_filename}:
+@deftypefun {@var{$filename} =} @var{$converter}->current_filename ()
+Return the file name of the current output unit being converted.
+@end deftypefun
+
 To get the current paragraph and preformatted number, use 
@code{paragraph_number}
 or @code{preformatted_number}:
 
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 8b0ade9aa6..b523c506cc 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -2748,6 +2748,12 @@ the best to use for output.
 When simply sorting, the array of the sorted index entries is associated
 with the index name.
 
+The functions call L<< 
C<Texinfo::Document::sorted_indices_by_letter>|Texinfo::Document/$sorted_indices
 = $document->sorted_indices_by_letter($registrar, $customization_information, 
$use_unicode_collation, $locale_lang) >>
+or L<< 
C<Texinfo::Document::sorted_indices_by_index>|Texinfo::Document/$sorted_indices 
= $document->sorted_indices_by_index($registrar, $customization_information, 
$use_unicode_collation, $locale_lang) >>
+with arguments based on C<USE_UNICODE_COLLATION>, C<COLLATION_LANGUAGE> and
+C<DOCUMENTLANGUAGE_COLLATION> customization options, and, if relevant, current
+C<@documentlanguage>.
+
 =item $filename = sub $converter->node_information_filename($normalized, 
$label_element)
 X<C<node_information_filename>>
 
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 85a3393694..b482c5b817 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2294,11 +2294,16 @@ sub get_file_information($$;$)
   return (1, $self->{'html_files_information'}->{$filename}->{$key})
 }
 
-# information from converter available 'read-only', in general set up before
-# really starting the formatting (except for current_filename).
+sub current_filename($)
+{
+  return $self->{'current_filename'};
+}
+
+# information from converter available 'read-only', set up before
+# really starting the formatting.
 # 'document' is set up in the generic converter
 my %available_converter_info;
-foreach my $converter_info ('copying_comment', 'current_filename',
+foreach my $converter_info ('copying_comment',
    'destination_directory', 'document', 'document_name',
    'documentdescription_string', 'expanded_formats',
    'jslicenses', 'line_break_element', 'non_breaking_space',
@@ -3713,7 +3718,7 @@ sub _convert_footnote_command($$$$)
   }
 
   $self->register_footnote($command, $footid, $docid, $number_in_doc,
-                    $self->get_info('current_filename'), 
$multi_expanded_region);
+                    $self->current_filename(), $multi_expanded_region);
 
   my $footnote_number_text;
   if (in_preformatted_context($self)) {
@@ -10697,7 +10702,7 @@ sub _default_format_contents($$;$$)
   my $command = shift;
   my $filename = shift;
 
-  $filename = $self->get_info('current_filename') if (!defined($filename));
+  $filename = $self->current_filename() if (!defined($filename));
 
   my $document = $self->get_info('document');
   my $sections_list;



reply via email to

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