[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Tue, 8 Nov 2022 03:29:27 -0500 (EST) |
branch: master
commit b6cad85cecec40af75230877999504cc9bd30e8c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Nov 4 01:03:41 2022 +0100
Also use subentries for index entries sorting in texi2any
* tp/Texinfo/Structuring.pm (_sort_index_entries, sort_indices):
collect subentries sorting keys and use them to sort the index
entries.
---
ChangeLog | 8 +
tp/Texinfo/Convert/HTML.pm | 1 +
tp/Texinfo/Structuring.pm | 63 +-
tp/t/09indices.t | 24 +
tp/t/results/indices/double_seeentry_seealso.pl | 1 +
tp/t/results/indices/seealso_duplicate.pl | 4 +-
tp/t/results/indices/sorted_subentries.pl | 1371 ++++++++++++++++++++
tp/t/results/indices/subentries.pl | 12 +-
tp/t/results/indices/subentry_and_sortas.pl | 4 +-
tp/t/results/indices/subentry_and_sortas_spaces.pl | 10 +-
tp/t/results/latex_tests/indices.pl | 2 +-
tp/t/test_sort.t | 36 +-
12 files changed, 1507 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d9d0562b29..92fb320050 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-11-03 Patrice Dumas <pertusus@free.fr>
+
+ Also use subentries for index entries sorting in texi2any
+
+ * tp/Texinfo/Structuring.pm (_sort_index_entries, sort_indices):
+ collect subentries sorting keys and use them to sort the index
+ entries.
+
2022-11-03 Patrice Dumas <pertusus@free.fr>
* doc/texi2any_api.texi (Simple Customization for Commands Without
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 66985daca2..f75bbc50c7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5304,6 +5304,7 @@ sub _convert_printindex_command($$$$)
$formatted_index_entries->{$index_entry_ref}++;
}
+ # div.display {margin-left: 3.2em}
my $subentries_tree =
$self->comma_index_subentries_tree($index_entry_ref);
my @entry_contents = @{$index_entry_ref->{'entry_content'}};
push @entry_contents, @{$subentries_tree->{'contents'}}
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 4eb17b674d..f3e8a03fa3 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -121,7 +121,7 @@ sub sectioning_structure($$$)
my $section_top;
my @sections_list;
-
+
# holds the current number for all the levels. It is not possible to use
# something like the last child index, because of @unnumbered.
my @command_numbers;
@@ -1628,9 +1628,19 @@ sub _sort_index_entries($$)
{
my $key1 = shift;
my $key2 = shift;
- my $a = uc($key1->{'key'});
- my $b = uc($key2->{'key'});
- my $res = _sort_string($a, $b);
+
+ my $key_index = 0;
+ foreach my $key1_str (@{$key1->{'keys'}}) {
+ my $res = _sort_string(uc($key1_str), uc($key2->{'keys'}->[$key_index]));
+ if ($res != 0) {
+ return $res;
+ }
+ $key_index ++;
+ if (scalar(@{$key2->{'keys'}}) <= $key_index) {
+ last;
+ }
+ }
+ my $res = (scalar(@{$key1->{'keys'}}) <=> scalar(@{$key2->{'keys'}}));
if ($res == 0) {
$res = ($key1->{'number'} <=> $key2->{'number'});
}
@@ -1716,24 +1726,53 @@ sub sort_indices($$$;$)
my $entry_key = index_entry_sort_string($entry,
{'contents' => $entry->{'entry_content'}},
$entry->{'sortas'}, $options);
- $index_entries_sort_strings->{$entry} = $entry_key;
+ my @entry_keys;
+ my $letter = '';
if ($entry_key !~ /\S/) {
$registrar->line_warn($customization_information,
sprintf(__("empty index key in \@%s"),
$entry->{'index_at_command'}),
$entry->{'entry_element'}->{'source_info'});
+ push @entry_keys, '';
} else {
- my $sortable_entry = {'entry' => $entry, 'key' => $entry_key,
- 'number' => $entry->{'entry_number'},
- 'index_at_command' => $entry->{'index_at_command'}};
-
+ push @entry_keys, $entry_key;
if ($sort_by_letter) {
- my $letter = uc(substr($entry_key, 0, 1));
- push @{$index_letter_hash->{$letter}}, $sortable_entry;
+ $letter = uc(substr($entry_key, 0, 1));
+ }
+ }
+ my $subentry_nr = 0;
+ my $subentry = $entry->{'entry_element'};
+ while ($subentry->{'extra'} and $subentry->{'extra'}->{'subentry'}) {
+ $subentry_nr ++;
+ $subentry = $subentry->{'extra'}->{'subentry'};
+ my $subentry_key = index_entry_sort_string($entry,
+ {'contents' => $subentry->{'args'}->[0]->{'contents'}},
+ $subentry->{'extra'}->{'sortas'},
$options);
+ if ($subentry_key !~ /\S/) {
+ $registrar->line_warn($customization_information,
+ sprintf(__("empty index sub entry %d key in \@%s"),
+ $subentry_nr,
+ $entry->{'index_at_command'}),
+ $entry->{'entry_element'}->{'source_info'});
+ push @entry_keys, '';
} else {
- push @{$sortable_index_entries}, $sortable_entry;
+ push @entry_keys, $subentry_key;
+ }
+ }
+ foreach my $sub_entry_key (@entry_keys) {
+ if ($sub_entry_key ne '') {
+ my $sortable_entry = {'entry' => $entry, 'keys' => \@entry_keys,
+ 'number' => $entry->{'entry_number'},
+ 'index_at_command' => $entry->{'index_at_command'}};
+ if ($sort_by_letter) {
+ push @{$index_letter_hash->{$letter}}, $sortable_entry;
+ } else {
+ push @{$sortable_index_entries}, $sortable_entry;
+ }
+ last;
}
}
+ $index_entries_sort_strings->{$entry} = join(', ', @entry_keys);
}
if ($sort_by_letter) {
foreach my $letter (sort _sort_string (keys %$index_letter_hash)) {
diff --git a/tp/t/09indices.t b/tp/t/09indices.t
index f8f7fa5d62..cfa1c2b2d6 100644
--- a/tp/t/09indices.t
+++ b/tp/t/09indices.t
@@ -564,6 +564,30 @@ in a reuglar para @sortas{foo}. @code{inside another
@sortas{command}}.
@printindex fn
', {'test_formats' => ['docbook']}
],
+['sorted_subentries',
+'@node Top
+@top
+
+@node chapter one
+@chapter one
+
+
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh @subentry jjj
+@cindex hhh jjj
+@cindex hhh @subentry k
+@cindex hhh @subentry
+@cindex hhh
+
+@node chapter second
+@chapter second
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh
+@cindex @subentry aa
+@cindex hhh @subentry jjj @subentry lll @sortas{A}
+
+@printindex cp
+'],
['seeentry',
'@node Top
@top
diff --git a/tp/t/results/indices/double_seeentry_seealso.pl
b/tp/t/results/indices/double_seeentry_seealso.pl
index ee23d071b4..7d582c7122 100644
--- a/tp/t/results/indices/double_seeentry_seealso.pl
+++ b/tp/t/results/indices/double_seeentry_seealso.pl
@@ -706,6 +706,7 @@ $result_floats{'double_seeentry_seealso'} = {};
$result_indices_sort_strings{'double_seeentry_seealso'} = {
'cp' => [
+ ', subggg',
'aaa',
'ddd',
'ggg'
diff --git a/tp/t/results/indices/seealso_duplicate.pl
b/tp/t/results/indices/seealso_duplicate.pl
index 6d8f73434b..820d22928d 100644
--- a/tp/t/results/indices/seealso_duplicate.pl
+++ b/tp/t/results/indices/seealso_duplicate.pl
@@ -347,8 +347,8 @@ $result_floats{'seealso_duplicate'} = {};
$result_indices_sort_strings{'seealso_duplicate'} = {
'cp' => [
- 'awk',
- 'awk'
+ 'awk, POSIX and',
+ 'awk, POSIX and'
]
};
diff --git a/tp/t/results/indices/sorted_subentries.pl
b/tp/t/results/indices/sorted_subentries.pl
new file mode 100644
index 0000000000..655d27dc48
--- /dev/null
+++ b/tp/t/results/indices/sorted_subentries.pl
@@ -0,0 +1,1371 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'sorted_subentries'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [],
+ 'type' => 'preamble_before_content'
+ }
+ ],
+ 'type' => 'before_node_section'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'Top'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'Top'
+ }
+ ],
+ 'normalized' => 'Top',
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'top',
+ 'contents' => [
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'extra' => {},
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'chapter one'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'chapter-one'
+ }
+ ],
+ 'normalized' => 'chapter-one',
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'one'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'contents' => [
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 1,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'jjj'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'lll'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 2,
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 8,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 8,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 8,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 2,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'jjj'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 9,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 9,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh jjj'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 3,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 10,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 4,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'k'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 11,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 11,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 5,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'missing_argument' => 1
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 6,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 13,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 5,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'chapter second'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'isindex' => 1,
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'chapter-second'
+ }
+ ],
+ 'normalized' => 'chapter-second',
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 15,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'second'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 7,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'jjj'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'lll'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 2,
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 17,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 17,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 17,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 8,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 18,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {
+ 'args' => [
+ {
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'missing_argument' => 1,
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'aa'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 19,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 19,
+ 'macro' => ''
+ }
+ },
+ {},
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'hhh'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'cindex',
+ 'extra' => {
+ 'index_entry' => {
+ 'content_normalized' => [],
+ 'entry_content' => [],
+ 'entry_element' => {},
+ 'entry_node' => {},
+ 'entry_number' => 9,
+ 'in_code' => 0,
+ 'index_at_command' => 'cindex',
+ 'index_ignore_chars' => {},
+ 'index_name' => 'cp',
+ 'index_type_command' => 'cindex'
+ },
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'jjj'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 1,
+ 'spaces_before_argument' => ' ',
+ 'subentry' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'lll'
+ },
+ {
+ 'text' => ' ',
+ 'type' => 'spaces_at_end'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'A'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'sortas',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 20,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'subentry',
+ 'extra' => {
+ 'level' => 2,
+ 'sortas' => 'A',
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 20,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 20,
+ 'macro' => ''
+ }
+ }
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 20,
+ 'macro' => ''
+ },
+ 'type' => 'index_entry_command'
+ },
+ {},
+ {},
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'cp'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'printindex',
+ 'extra' => {
+ 'misc_args' => [
+ 'cp'
+ ],
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 22,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 16,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'sorted_subentries'}{'contents'}[1]{'extra'}{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[3]{'extra'}{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[3]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[3] =
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[4] =
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[2]{'extra'}{'subentry'}{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[6] =
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[5]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[7]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[9] =
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[8]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[11] =
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[10]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12];
+$result_trees{'sorted_subentries'}{'contents'}[4]{'contents'}[12]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[5]{'extra'}{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[5]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[5]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
= $result_trees{'sorted_subentries'}{'contents'}[5]{'args'}[0]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[5];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[1] =
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[2] =
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[0]{'extra'}{'subentry'}{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[3]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[5];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[5] =
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[4]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'index_entry'}{'content_normalized'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'index_entry'}{'entry_content'}
=
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'args'}[0]{'contents'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'index_entry'}{'entry_element'}
= $result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'index_entry'}{'entry_node'}
= $result_trees{'sorted_subentries'}{'contents'}[5];
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[7] =
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'subentry'};
+$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[8] =
$result_trees{'sorted_subentries'}{'contents'}[6]{'contents'}[6]{'extra'}{'subentry'}{'extra'}{'subentry'};
+
+$result_texis{'sorted_subentries'} = '@node Top
+@top
+
+@node chapter one
+@chapter one
+
+
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh @subentry jjj
+@cindex hhh jjj
+@cindex hhh @subentry k
+@cindex hhh @subentry
+@cindex hhh
+
+@node chapter second
+@chapter second
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh
+@cindex @subentry aa
+@cindex hhh @subentry jjj @subentry lll @sortas{A}
+
+@printindex cp
+';
+
+
+$result_texts{'sorted_subentries'} = '
+1 one
+*****
+
+
+
+2 second
+********
+
+';
+
+$result_sectioning{'sorted_subentries'} = {
+ 'structure' => {
+ 'section_childs' => [
+ {
+ 'cmdname' => 'top',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top'
+ },
+ 'structure' => {}
+ }
+ },
+ 'structure' => {
+ 'section_childs' => [
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chapter-one'
+ },
+ 'structure' => {}
+ }
+ },
+ 'structure' => {
+ 'section_level' => 1,
+ 'section_number' => 1,
+ 'section_up' => {},
+ 'toplevel_prev' => {},
+ 'toplevel_up' => {}
+ }
+ },
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'isindex' => 1,
+ 'normalized' => 'chapter-second'
+ },
+ 'structure' => {}
+ }
+ },
+ 'structure' => {
+ 'section_level' => 1,
+ 'section_number' => 2,
+ 'section_prev' => {},
+ 'section_up' => {},
+ 'toplevel_prev' => {},
+ 'toplevel_up' => {}
+ }
+ }
+ ],
+ 'section_level' => 0,
+ 'section_up' => {}
+ }
+ }
+ ],
+ 'section_level' => -1
+ }
+};
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
= $result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_prev'}
= $result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_up'}
= $result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[1]{'structure'}{'section_prev'}
=
$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[1]{'structure'}{'section_up'}
= $result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[1]{'structure'}{'toplevel_prev'}
=
$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[1]{'structure'}{'toplevel_up'}
= $result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'sorted_subentries'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
= $result_sectioning{'sorted_subentries'};
+
+$result_nodes{'sorted_subentries'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'top',
+ 'extra' => {},
+ 'structure' => {}
+ },
+ 'normalized' => 'Top'
+ },
+ 'structure' => {
+ 'node_next' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {},
+ 'structure' => {
+ 'section_number' => 1
+ }
+ },
+ 'normalized' => 'chapter-one'
+ },
+ 'structure' => {
+ 'node_next' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {},
+ 'structure' => {
+ 'section_number' => 2
+ }
+ },
+ 'isindex' => 1,
+ 'normalized' => 'chapter-second'
+ },
+ 'structure' => {
+ 'node_prev' => {},
+ 'node_up' => {}
+ }
+ },
+ 'node_prev' => {},
+ 'node_up' => {}
+ }
+ }
+ }
+};
+$result_nodes{'sorted_subentries'}{'structure'}{'node_next'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
= $result_nodes{'sorted_subentries'}{'structure'}{'node_next'};
+$result_nodes{'sorted_subentries'}{'structure'}{'node_next'}{'structure'}{'node_next'}{'structure'}{'node_up'}
= $result_nodes{'sorted_subentries'};
+$result_nodes{'sorted_subentries'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
= $result_nodes{'sorted_subentries'};
+$result_nodes{'sorted_subentries'}{'structure'}{'node_next'}{'structure'}{'node_up'}
= $result_nodes{'sorted_subentries'};
+
+$result_menus{'sorted_subentries'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top'
+ },
+ 'structure' => {}
+};
+
+$result_errors{'sorted_subentries'} = [
+ {
+ 'error_line' => 'warning: @subentry missing argument
+',
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => '',
+ 'text' => '@subentry missing argument',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @cindex missing argument
+',
+ 'file_name' => '',
+ 'line_nr' => 19,
+ 'macro' => '',
+ 'text' => '@cindex missing argument',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: empty index sub entry 1 key in @cindex
+',
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => '',
+ 'text' => 'empty index sub entry 1 key in @cindex',
+ 'type' => 'warning'
+ }
+];
+
+
+$result_floats{'sorted_subentries'} = {};
+
+
+$result_indices_sort_strings{'sorted_subentries'} = {
+ 'cp' => [
+ 'hhh',
+ 'hhh',
+ 'hhh, ',
+ 'hhh, jjj',
+ 'hhh, jjj, A',
+ 'hhh, jjj, lll',
+ 'hhh, jjj, lll',
+ 'hhh, k',
+ 'hhh jjj'
+ ]
+};
+
+
+
+$result_converted{'info'}->{'sorted_subentries'} = 'This is , produced from .
+
+
+File: , Node: Top, Next: chapter one, Up: (dir)
+
+* Menu:
+
+* chapter one::
+* chapter second::
+
+
+File: , Node: chapter one, Next: chapter second, Prev: Top, Up: Top
+
+1 one
+*****
+
+
+File: , Node: chapter second, Prev: chapter one, Up: Top
+
+2 second
+********
+
+ [index ]
+* Menu:
+
+* hhh: chapter one. (line 5)
+* hhh <1>: chapter second. (line 6)
+* hhh, : chapter one. (line 6)
+* hhh, jjj: chapter one. (line 6)
+* hhh, jjj, lll: chapter second. (line 6)
+* hhh, jjj, lll <1>: chapter one. (line 6)
+* hhh, jjj, lll <2>: chapter second. (line 6)
+* hhh, k: chapter one. (line 6)
+* hhh jjj: chapter one. (line 6)
+
+
+
+Tag Table:
+Node: Top27
+Node: chapter one126
+Node: chapter second214
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
+';
+
+$result_converted_errors{'info'}->{'sorted_subentries'} = [
+ {
+ 'error_line' => 'warning: empty index sub entry 1 key in @cindex
+',
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => '',
+ 'text' => 'empty index sub entry 1 key in @cindex',
+ 'type' => 'warning'
+ }
+];
+
+
+
+$result_converted{'plaintext'}->{'sorted_subentries'} = '1 one
+*****
+
+2 second
+********
+
+* Menu:
+
+* hhh: chapter one. (line 2)
+* hhh <1>: chapter second. (line 6)
+* hhh, : chapter one. (line 3)
+* hhh, jjj: chapter one. (line 3)
+* hhh, jjj, lll: chapter second. (line 6)
+* hhh, jjj, lll <1>: chapter one. (line 3)
+* hhh, jjj, lll <2>: chapter second. (line 6)
+* hhh, k: chapter one. (line 3)
+* hhh jjj: chapter one. (line 3)
+
+';
+
+$result_converted_errors{'plaintext'}->{'sorted_subentries'} = [
+ {
+ 'error_line' => 'warning: empty index sub entry 1 key in @cindex
+',
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => '',
+ 'text' => 'empty index sub entry 1 key in @cindex',
+ 'type' => 'warning'
+ }
+];
+
+
+
+$result_converted{'html_text'}->{'sorted_subentries'} = '<div
class="top-level-extent" id="Top">
+<div class="nav-panel">
+<p>
+ [<a href="#chapter-second" title="Index" rel="index">Index</a>]</p>
+</div>
+<a class="top" id="SEC_Top"></a>
+<ul class="mini-toc">
+<li><a href="#chapter-one" accesskey="1">one</a></li>
+<li><a href="#chapter-second" accesskey="2">second</a></li>
+</ul>
+<hr>
+<div class="chapter-level-extent" id="chapter-one">
+<div class="nav-panel">
+<p>
+ [<a href="#chapter-second" title="Index" rel="index">Index</a>]</p>
+</div>
+<h2 class="chapter" id="one">1 one</h2>
+
+
+<a class="index-entry-id" id="index-hhh"></a>
+<a class="index-entry-id" id="index-hhh-1"></a>
+<a class="index-entry-id" id="index-hhh-jjj"></a>
+<a class="index-entry-id" id="index-hhh-2"></a>
+<a class="index-entry-id" id="index-hhh-3"></a>
+<a class="index-entry-id" id="index-hhh-4"></a>
+
+<hr>
+</div>
+<div class="chapter-level-extent" id="chapter-second">
+<div class="nav-panel">
+<p>
+ [<a href="#chapter-second" title="Index" rel="index">Index</a>]</p>
+</div>
+<h2 class="chapter" id="second">2 second</h2>
+<a class="index-entry-id" id="index-hhh-5"></a>
+<a class="index-entry-id" id="index-hhh-6"></a>
+<a class="index-entry-id" id="index-hhh-7"></a>
+
+<div class="printindex cp-printindex">
+<table class="cp-entries-printindex" border="0">
+<tr><td></td><th class="entries-header-printindex">Index
Entry</th><td> </td><th class="sections-header-printindex">
Section</th></tr>
+<tr><td colspan="4"> <hr></td></tr>
+<tr><th id="t_i_cp_letter-H">H</th><td></td><td></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a
href="#index-hhh-4">hhh</a>:</td><td> </td><td
class="printindex-index-section"><a href="#chapter-one">chapter
one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a
href="#index-hhh-6">hhh</a>:</td><td> </td><td
class="printindex-index-section"><a href="#chapter-second">chapter
second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-3">hhh,
</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-one">chapter one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-1">hhh,
jjj</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-one">chapter one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-7">hhh,
jjj, lll</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-second">chapter second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh">hhh, jjj,
lll</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-one">chapter one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-5">hhh,
jjj, lll</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-second">chapter second</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-2">hhh,
k</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-one">chapter one</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-hhh-jjj">hhh
jjj</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-one">chapter one</a></td></tr>
+<tr><td colspan="4"> <hr></td></tr>
+</table>
+</div>
+</div>
+</div>
+';
+
+$result_converted_errors{'html_text'}->{'sorted_subentries'} = [
+ {
+ 'error_line' => 'warning: empty index sub entry 1 key in @cindex
+',
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => '',
+ 'text' => 'empty index sub entry 1 key in @cindex',
+ 'type' => 'warning'
+ }
+];
+
+
+
+$result_converted{'xml'}->{'sorted_subentries'} = '<node name="Top" spaces="
"><nodename>Top</nodename><nodenext automatic="on">chapter one</nodenext></node>
+<top><sectiontitle></sectiontitle>
+
+</top>
+<node name="chapter-one" spaces=" "><nodename>chapter one</nodename><nodenext
automatic="on">chapter second</nodenext><nodeprev
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
+<chapter spaces=" "><sectiontitle>one</sectiontitle>
+
+
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="1">hhh</indexterm></cindex> <subentry spaces=" ">jjj
</subentry><subentry spaces=" ">lll</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="2">hhh</indexterm></cindex> <subentry spaces=" ">jjj</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp" number="3">hhh
jjj</indexterm></cindex>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="4">hhh</indexterm></cindex> <subentry spaces=" ">k</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="5">hhh</indexterm></cindex> <subentry> </subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="6">hhh</indexterm></cindex>
+
+</chapter>
+<node name="chapter-second" spaces=" "><nodename>chapter
second</nodename><nodeprev automatic="on">chapter one</nodeprev><nodeup
automatic="on">Top</nodeup></node>
+<chapter spaces=" "><sectiontitle>second</sectiontitle>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="7">hhh</indexterm></cindex> <subentry spaces=" ">jjj
</subentry><subentry spaces=" ">lll</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="8">hhh</indexterm></cindex>
+<cindex spaces=" "></cindex><subentry spaces=" ">aa</subentry>
+<cindex index="cp" spaces=" "><indexterm index="cp"
number="9">hhh</indexterm></cindex> <subentry spaces=" ">jjj
</subentry><subentry spaces=" ">lll <sortas>A</sortas></subentry>
+
+<printindex spaces=" " value="cp" line="cp"></printindex>
+</chapter>
+';
+
+1;
diff --git a/tp/t/results/indices/subentries.pl
b/tp/t/results/indices/subentries.pl
index 79ef3c7780..d8f0a7d9a9 100644
--- a/tp/t/results/indices/subentries.pl
+++ b/tp/t/results/indices/subentries.pl
@@ -1031,15 +1031,15 @@ $result_floats{'subentries'} = {};
$result_indices_sort_strings{'subentries'} = {
'cp' => [
'a--a',
- 'b--b',
- 'd--dd',
- 'g--gg'
+ 'b--b, c--c',
+ 'd--dd, e--ee, f--ff',
+ 'g--gg, h--hh jjj, k--kk, l--ll'
],
'fn' => [
'f---aa',
- 'f---bb',
- 'f---ddd',
- 'f---ggg'
+ 'f---bb, f---cc',
+ 'f---ddd, f---eee, ffff',
+ 'f---ggg, f---hhh fjjj, f---kkk, f---lll'
]
};
diff --git a/tp/t/results/indices/subentry_and_sortas.pl
b/tp/t/results/indices/subentry_and_sortas.pl
index 5ffe22bdd2..7f7e7efa4a 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -577,10 +577,10 @@ $result_floats{'subentry_and_sortas'} = {};
$result_indices_sort_strings{'subentry_and_sortas'} = {
'cp' => [
- 'A---S'
+ 'A---S, B---S1'
],
'fn' => [
- 'X---S'
+ 'X---S, X---S1'
]
};
diff --git a/tp/t/results/indices/subentry_and_sortas_spaces.pl
b/tp/t/results/indices/subentry_and_sortas_spaces.pl
index 62491a6441..6f3b8b79c9 100644
--- a/tp/t/results/indices/subentry_and_sortas_spaces.pl
+++ b/tp/t/results/indices/subentry_and_sortas_spaces.pl
@@ -709,10 +709,10 @@ $result_floats{'subentry_and_sortas_spaces'} = {};
$result_indices_sort_strings{'subentry_and_sortas_spaces'} = {
'cp' => [
- 'A---S',
- 'aaa',
- 'aaa',
- 'aaa'
+ 'A---S, C---S1',
+ 'aaa, B---S1',
+ 'aaa, bbb, ccc',
+ 'aaa, bbb, D'
]
};
@@ -807,8 +807,8 @@
$result_converted{'html_text'}->{'subentry_and_sortas_spaces'} = '<div class="to
<tr><th id="t_i_cp_letter-A">A</th><td></td><td></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa">aaa, bbb
sort as c</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-index">chapter index</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-1">aaa,
</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-index">chapter index</a></td></tr>
-<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-2">aaa,
bbb, ccc</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-index">chapter index</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-3">aaa,
bbb, ccc</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-index">chapter index</a></td></tr>
+<tr><td></td><td class="printindex-index-entry"><a href="#index-aaa-2">aaa,
bbb, ccc</a>:</td><td> </td><td class="printindex-index-section"><a
href="#chapter-index">chapter index</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
</div>
diff --git a/tp/t/results/latex_tests/indices.pl
b/tp/t/results/latex_tests/indices.pl
index ac58fd25c3..fd14b18f1f 100644
--- a/tp/t/results/latex_tests/indices.pl
+++ b/tp/t/results/latex_tests/indices.pl
@@ -1059,7 +1059,7 @@ $result_indices_sort_strings{'indices'} = {
'cp' => [
'\\cmd',
'\\some\\command for file',
- 'a!"@b "!@ a" o"',
+ 'a!"@b "!@ a" o", a!"@b',
'cmd'
],
'fn' => [
diff --git a/tp/t/test_sort.t b/tp/t/test_sort.t
index 9db4332ae6..d3e45e1534 100644
--- a/tp/t/test_sort.t
+++ b/tp/t/test_sort.t
@@ -4,7 +4,7 @@ use lib '.';
use Texinfo::ModulePath (undef, undef, undef, 'updirs' => 2);
use Test::More;
-BEGIN { plan tests => 6; };
+BEGIN { plan tests => 7; };
use Texinfo::Convert::Text;
use Texinfo::Parser;
@@ -99,3 +99,37 @@ local $Data::Dumper::Indent = 1;
}
cmp_deeply (\@letter_entries, \@letter_entries_ref, 'by letter index entries');
+
+$parser = Texinfo::Parser::parser();
+$tree = $parser->parse_texi_text('@node Top
+
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh @subentry jjj
+@cindex hhh jjj
+@cindex hhh @subentry k
+@cindex hhh @subentry
+@cindex hhh
+@cindex hhh @subentry jjj @subentry lll
+@cindex hhh
+@cindex hhh @subentry jjj @subentry lll @sortas{A}
+@cindex @subentry aa
+');
+
+$registrar = $parser->registered_errors();
+($index_names, $merged_indices) = $parser->indices_information();
+$index_entries = Texinfo::Structuring::merge_indices($index_names);
+($sorted_index_entries, $index_entries_sort_strings)
+ = Texinfo::Structuring::sort_indices($registrar, $main_configuration,
+ $index_entries);
+
+@entries = ();
+foreach my $entry (@{$sorted_index_entries->{'cp'}}) {
+ push @entries, $index_entries_sort_strings->{$entry};
+}
+
+#print STDERR join(', ', map {"'$_'"} @entries)."\n";
+
+# the entry @cindex @subentry aa does not appear, has a missing argument
+@entries_ref = ('hhh', 'hhh', 'hhh, ', 'hhh, jjj', 'hhh, jjj, A', 'hhh, jjj,
lll', 'hhh, jjj, lll', 'hhh, k', 'hhh jjj');
+
+cmp_deeply (\@entries, \@entries_ref, 'subentry sorted');
- [no subject], (continued)
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08
- [no subject], Patrice Dumas, 2022/11/08