texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * doc/texi2any_api.texi (Conversion General Infor


From: Patrice Dumas
Subject: branch master updated: * doc/texi2any_api.texi (Conversion General Information), tp/Texinfo/Convert/HTML.pm (%available_converter_info, get_info) (_convert_printindex_command, output_internal_links): remove 'index_entries_by_letter' from converter info, call directly get_converter_indices_sorted_by_letter instead, such that the current value of @documentlanguage can be used if it is used for tailoring the collation of indices.
Date: Wed, 14 Feb 2024 09:22:40 -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 a7fb7455c9 * doc/texi2any_api.texi (Conversion General Information), 
tp/Texinfo/Convert/HTML.pm (%available_converter_info, get_info) 
(_convert_printindex_command, output_internal_links): remove 
'index_entries_by_letter' from converter info, call directly 
get_converter_indices_sorted_by_letter instead, such that the current value of 
@documentlanguage can be used if it is used for tailoring the collation of 
indices.
a7fb7455c9 is described below

commit a7fb7455c929fe05c204ee6c35744201ce7d2ba0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Feb 14 15:22:10 2024 +0100

    * doc/texi2any_api.texi (Conversion General Information),
    tp/Texinfo/Convert/HTML.pm (%available_converter_info, get_info)
    (_convert_printindex_command, output_internal_links): remove
    'index_entries_by_letter' from converter info, call directly
    get_converter_indices_sorted_by_letter instead, such that the current
    value of @documentlanguage can be used if it is used for tailoring
    the collation of indices.
---
 ChangeLog                                          | 10 ++++++++++
 doc/texi2any_api.texi                              | 11 ++++++++---
 tp/Texinfo/Convert/Converter.pm                    | 22 ++++++++++++++++++++--
 tp/Texinfo/Convert/HTML.pm                         | 17 ++++++-----------
 .../index_collation_test.txt                       |  4 ++--
 5 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cce9e3bd8f..6e7e5a0114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-14  Patrice Dumas  <pertusus@free.fr>
+
+       * doc/texi2any_api.texi (Conversion General Information),
+       tp/Texinfo/Convert/HTML.pm (%available_converter_info, get_info)
+       (_convert_printindex_command, output_internal_links): remove
+       'index_entries_by_letter' from converter info, call directly
+       get_converter_indices_sorted_by_letter instead, such that the current
+       value of @documentlanguage can be used if it is used for tailoring
+       the collation of indices.
+
 2024-02-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/t/test_sort.t: call Texinfo::Document::indices_sort_strings
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 6093c03596..0e32c5a607 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -1788,6 +1788,14 @@ Return true if format @var{$format} is expanded, 
according to
 command-line and init file information.
 @end deftypefun
 
+Sorted index entries are available through
+@code{get_converter_indices_sorted_by_letter}:
+
+@deftypefun {@var{$sorted_index_entries} = } 
@var{$converter}->get_converter_indices_sorted_by_letter ()
+Returns index entries sorted by index and letter.
+@xref{Texinfo@asis{::}Convert@asis{::}Converter $sorted_indices = 
$converter->get_converter_indices_sorted_by_letter(),,Texinfo::Convert::Converter::get_converter_indices_sorted_by_letter,texi2any_internals}.
+@end deftypefun
+
 The main method to get information from the converter is @code{get_info}:
 
 @deftypefun {@var{$info} =} @var{$converter}->get_info (@var{$item})
@@ -1862,9 +1870,6 @@ 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 index_entries_by_letter
-Index entries sorted by letter. @xref{Texinfo::Structuring 
($index_entries_sorted@comma{} $index_entries_sort_strings) = 
sort_indices($registrar@comma{} $configuration_information@comma{} 
$merged_index_entries@comma{} 
$sort_by_letter),,Texinfo::Structuring::sort_indices,texi2any_internals}.
-
 @item jslicenses
 An hash reference with  categories of javascript used in the document
 as keys. The corresponding values are also hashes with file names
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index d54474d012..8b0ade9aa6 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1731,7 +1731,6 @@ sub comma_index_subentries_tree {
   return undef;
 }
 
-# TODO document?
 sub get_converter_indices_sorted_by_letter($)
 {
   my $self = shift;
@@ -1760,7 +1759,6 @@ sub get_converter_indices_sorted_by_letter($)
   return undef;
 }
 
-# TODO document?
 sub get_converter_indices_sorted_by_index($)
 {
   my $self = shift;
@@ -2730,6 +2728,26 @@ better formatted with new lines added independently of 
the presence
 of newline or comment in the initial Texinfo line, so most converters
 are better off not using this method.
 
+=item $sorted_indices = $converter->get_converter_indices_sorted_by_index()
+
+=item $sorted_indices = $converter->get_converter_indices_sorted_by_letter()
+X<C<get_converter_indices_sorted_by_index>>
+X<C<get_converter_indices_sorted_by_letter>>
+
+C<get_converter_indices_sorted_by_letter> returns the indices sorted by index
+and letter, while C<get_converter_indices_sorted_by_index> returns the indices
+with all entries of an index together.
+
+When sorting by letter, an array reference of letter hash references is
+associated with each index name.  Each letter hash reference has two
+keys, a I<letter> key with the letter, and an I<entries> key with an array
+reference of sorted index entries beginning with the letter.  The letter
+is a character string suitable for sorting letters, but is not necessarily
+the best to use for output.
+
+When simply sorting, the array of the sorted index entries is associated
+with the index name.
+
 =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 1fb95cb183..85a3393694 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2301,9 +2301,8 @@ my %available_converter_info;
 foreach my $converter_info ('copying_comment', 'current_filename',
    'destination_directory', 'document', 'document_name',
    'documentdescription_string', 'expanded_formats',
-   'index_entries_by_letter', 'jslicenses',
-   'line_break_element', 'non_breaking_space', 'paragraph_symbol',
-   'simpletitle_command_name', 'simpletitle_tree',
+   'jslicenses', 'line_break_element', 'non_breaking_space',
+   'paragraph_symbol', 'simpletitle_command_name', 'simpletitle_tree',
    'title_string', 'title_tree', 'title_titlepage') {
   $available_converter_info{$converter_info} = 1;
 }
@@ -2322,12 +2321,6 @@ sub get_info($$)
     } else {
       return $self->{'converter_info'}->{$converter_info};
     }
-  #} else {
-  #  cluck();
-  } elsif ($converter_info eq 'index_entries_by_letter') {
-    $self->{'converter_info'}->{'index_entries_by_letter'}
-      = $self->get_converter_indices_sorted_by_letter();
-    return $self->{'converter_info'}->{'index_entries_by_letter'};
   }
   return undef;
 }
@@ -6235,7 +6228,8 @@ sub _convert_printindex_command($$$$)
   } else {
     return '';
   }
-  my $index_entries_by_letter = $self->get_info('index_entries_by_letter');
+  my $index_entries_by_letter
+    = $self->get_converter_indices_sorted_by_letter();
   if (!defined($index_entries_by_letter)
       or !$index_entries_by_letter->{$index_name}
       or !scalar(@{$index_entries_by_letter->{$index_name}})) {
@@ -12044,7 +12038,8 @@ sub output_internal_links($)
       }
     }
   }
-  my $index_entries_by_letter = $self->get_info('index_entries_by_letter');
+  my $index_entries_by_letter
+    = $self->get_converter_indices_sorted_by_letter();
   if ($index_entries_by_letter) {
     my $indices_information;
     if ($self->{'document'}) {
diff --git 
a/tp/tests/other/res_parser/index_collation_test_collation_locale_sv/index_collation_test.txt
 
b/tp/tests/other/res_parser/index_collation_test_collation_locale_sv/index_collation_test.txt
index cdde181904..4fbdfea689 100644
--- 
a/tp/tests/other/res_parser/index_collation_test_collation_locale_sv/index_collation_test.txt
+++ 
b/tp/tests/other/res_parser/index_collation_test_collation_locale_sv/index_collation_test.txt
@@ -8,8 +8,8 @@ top
 
 * e:                                     Chapter.               (line 6)
 * é:                                     Chapter.               (line 6)
-* ö:                                     Chapter.               (line 6)
 * z:                                     Chapter.               (line 6)
+* ö:                                     Chapter.               (line 6)
 
 Appendix A Indices
 ******************
@@ -18,6 +18,6 @@ Appendix A Indices
 
 * e:                                     Chapter.               (line 6)
 * é:                                     Chapter.               (line 6)
-* ö:                                     Chapter.               (line 6)
 * z:                                     Chapter.               (line 6)
+* ö:                                     Chapter.               (line 6)
 



reply via email to

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