[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Document.pm (indices_sort_strings),
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Document.pm (indices_sort_strings), tp/Texinfo/Indices.pm (setup_index_entries_sort_strings) (_setup_sort_sortable_strings_collator, sort_indices_by_index) (sort_indices_by_letter): add indices_sort_strings in Document.pm and cache setup_index_entries_sort_strings result in this function. Add _setup_sort_sortable_strings_collator for code common to sort_indices_by_index and sort_indices_by_letter. |
Date: |
Fri, 09 Feb 2024 05:04:55 -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 6b0eb2c37a * tp/Texinfo/Document.pm (indices_sort_strings),
tp/Texinfo/Indices.pm (setup_index_entries_sort_strings)
(_setup_sort_sortable_strings_collator, sort_indices_by_index)
(sort_indices_by_letter): add indices_sort_strings in Document.pm and cache
setup_index_entries_sort_strings result in this function. Add
_setup_sort_sortable_strings_collator for code common to sort_indices_by_index
and sort_indices_by_letter.
6b0eb2c37a is described below
commit 6b0eb2c37a791482730f665a03871352836ba8ab
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 9 10:39:26 2024 +0100
* tp/Texinfo/Document.pm (indices_sort_strings), tp/Texinfo/Indices.pm
(setup_index_entries_sort_strings)
(_setup_sort_sortable_strings_collator, sort_indices_by_index)
(sort_indices_by_letter): add indices_sort_strings in Document.pm
and cache setup_index_entries_sort_strings result in this function.
Add _setup_sort_sortable_strings_collator for code common to
sort_indices_by_index and sort_indices_by_letter.
---
ChangeLog | 10 ++++
tp/Texinfo/Document.pm | 20 ++++++++
tp/Texinfo/Indices.pm | 56 ++++++++++++++--------
.../res_parser/formatting_chm/formatting.2 | 1 -
4 files changed, 66 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8ba89602ff..aa8f91ff29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-09 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Document.pm (indices_sort_strings), tp/Texinfo/Indices.pm
+ (setup_index_entries_sort_strings)
+ (_setup_sort_sortable_strings_collator, sort_indices_by_index)
+ (sort_indices_by_letter): add indices_sort_strings in Document.pm
+ and cache setup_index_entries_sort_strings result in this function.
+ Add _setup_sort_sortable_strings_collator for code common to
+ sort_indices_by_index and sort_indices_by_letter.
+
2024-02-09 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Indices.pm (setup_index_entries_sort_strings)
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 8064dfe3be..a7a7763232 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -204,6 +204,26 @@ sub merged_indices($)
return $self->{'merged_indices'};
}
+# TODO document
+sub indices_sort_strings($$$;$)
+{
+ my $registrar = shift;
+ my $customization_information = shift;
+ my $document = shift;
+ my $prefer_reference_element = shift;
+
+ if (!$document->{'index_entries_sort_strings'}) {
+ my $indices_sort_strings
+ = Texinfo::Indices::setup_index_entries_sort_strings($registrar,
+ $customization_information, $document->merged_indices(),
+ $document->indices_information(),
+ $prefer_reference_element);
+ $document->{'index_entries_sort_strings'} = $indices_sort_strings;
+ }
+
+ return $document->{'index_entries_sort_strings'};
+}
+
# TODO document
sub sorted_indices_by_letter($$$$$)
{
diff --git a/tp/Texinfo/Indices.pm b/tp/Texinfo/Indices.pm
index 7b5c757039..0f31430903 100644
--- a/tp/Texinfo/Indices.pm
+++ b/tp/Texinfo/Indices.pm
@@ -302,21 +302,16 @@ sub _setup_collator($$)
return $collator;
}
-sub setup_index_entries_sort_strings($$$$;$$)
+sub setup_index_entries_sort_strings($$$$;$)
{
my $registrar = shift;
my $customization_information = shift;
my $index_entries = shift;
my $indices_information = shift;
- my $document = shift;
my $prefer_reference_element = shift;
return undef unless ($index_entries);
- if ($document and $document->{'index_entries_sort_strings'}) {
- return $document->{'index_entries_sort_strings'};
- }
-
# convert index entries to sort string using unicode when possible
# independently of input and output encodings
my $convert_text_options = {};
@@ -404,9 +399,6 @@ sub setup_index_entries_sort_strings($$$$;$$)
$indices_sort_strings->{$index_name} = $index_entries_sort_strings;
}
- if ($document) {
- $document->{'index_entries_sort_strings'} = $indices_sort_strings;
- }
return $indices_sort_strings;
}
@@ -460,7 +452,7 @@ sub setup_sortable_index_entries($$)
return ($index_sortable_index_entries, $index_entries_sort_strings);
}
-sub sort_indices_by_index($$$$$$;$)
+sub _setup_sort_sortable_strings_collator($$$$;$$$)
{
my $registrar = shift;
my $customization_information = shift;
@@ -470,9 +462,15 @@ sub sort_indices_by_index($$$$$$;$)
my $indices_information = shift;
my $document = shift;
- my $indices_sort_strings = setup_index_entries_sort_strings($registrar,
+ my $indices_sort_strings;
+ if ($document) {
+ $indices_sort_strings = Texinfo::Document::indices_sort_strings($registrar,
+ $customization_information, $document);
+ } else {
+ $indices_sort_strings = setup_index_entries_sort_strings($registrar,
$customization_information, $index_entries,
- $indices_information, $document);
+ $indices_information);
+ }
my $collator = _setup_collator($use_unicode_collation, $locale_lang);
@@ -480,6 +478,27 @@ sub sort_indices_by_index($$$$$$;$)
my ($index_sortable_index_entries, $index_entries_sort_strings)
= setup_sortable_index_entries($collator, $indices_sort_strings);
+ return ($index_sortable_index_entries, $index_entries_sort_strings,
+ $collator);
+}
+
+sub sort_indices_by_index($$$$;$$$)
+{
+ my $registrar = shift;
+ my $customization_information = shift;
+ my $use_unicode_collation = shift;
+ my $locale_lang = shift;
+ my $index_entries = shift;
+ my $indices_information = shift;
+ my $document = shift;
+
+ my ($index_sortable_index_entries, $index_entries_sort_strings,
+ $collator) = _setup_sort_sortable_strings_collator($registrar,
+ $customization_information, $use_unicode_collation,
+ $locale_lang, $index_entries, $indices_information,
+ $document);
+
+ my $sorted_index_entries;
if (!$index_sortable_index_entries) {
return ($sorted_index_entries, $index_entries_sort_strings);
}
@@ -620,16 +639,13 @@ sub sort_indices_by_letter($$$$$$;$)
my $indices_information = shift;
my $document = shift;
- my $indices_sort_strings = setup_index_entries_sort_strings($registrar,
- $customization_information, $index_entries,
- $indices_information, $document);
-
- my $collator = _setup_collator($use_unicode_collation, $locale_lang);
+ my ($index_sortable_index_entries, $index_entries_sort_strings,
+ $collator) = _setup_sort_sortable_strings_collator($registrar,
+ $customization_information, $use_unicode_collation,
+ $locale_lang, $index_entries, $indices_information,
+ $document);
my $sorted_index_entries;
- my ($index_sortable_index_entries, $index_entries_sort_strings)
- = setup_sortable_index_entries($collator, $indices_sort_strings);
-
if (!$index_sortable_index_entries) {
return ($sorted_index_entries, $index_entries_sort_strings);
}
diff --git a/tp/tests/coverage/res_parser/formatting_chm/formatting.2
b/tp/tests/coverage/res_parser/formatting_chm/formatting.2
index 79c67d1795..c4a9decc65 100644
--- a/tp/tests/coverage/res_parser/formatting_chm/formatting.2
+++ b/tp/tests/coverage/res_parser/formatting_chm/formatting.2
@@ -328,4 +328,3 @@ formatting.texi:88: warning: @image file `f-ile' (for HTML)
not found, using `f-
formatting.texi:88: warning: @image file `f-ile' (for HTML) not found, using
`f-ile.jpg' (possibly involving @mymacro)
formatting.texi:88: warning: @image file `f--ile@.' (for HTML) not found,
using `f--ile@..file ext e--xt}' (possibly involving @mymacro)
formatting.texi:88: warning: @image file `filejk _" %@' (for HTML) not found,
using `filejk _" %@.jpg' (possibly involving @mymacro)
-formatting.texi:123: warning: empty index key in @findex
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Document.pm (indices_sort_strings), tp/Texinfo/Indices.pm (setup_index_entries_sort_strings) (_setup_sort_sortable_strings_collator, sort_indices_by_index) (sort_indices_by_letter): add indices_sort_strings in Document.pm and cache setup_index_entries_sort_strings result in this function. Add _setup_sort_sortable_strings_collator for code common to sort_indices_by_index and sort_indices_by_letter.,
Patrice Dumas <=