* tp/Texinfo/Common.pm (move_index_entries_after_items): consider a @subentry to be part of the moved index entries. Report from Thérèse Godefroy. * tp/t/index_before_item.t (subentry): add test with @subentry in @cindex.
diff --git a/ChangeLog b/ChangeLog index f0bd116..4cbe9cb 100644 --- a/ChangeLog +++ b/ChangeLog
@@ -1,3 +1,12 @@ +2024-10-08 Patrice Dumas <pertusus@free.fr> + + * tp/Texinfo/Common.pm (move_index_entries_after_items): + consider a @subentry to be part of the moved index entries. + Report from Thérèse Godefroy. + + * tp/t/index_before_item.t (subentry): add test with @subentry + in @cindex. + 2024-09-21 Patrice Dumas <pertusus@free.fr> * tp/t/formats_encodings.t (japanese_shift_jis): assume that test
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm index d7b146b..abc2b00 100644 --- a/tp/Texinfo/Common.pm +++ b/tp/Texinfo/Common.pm
@@ -2356,7 +2356,10 @@ and $previous_ending_container->{'contents'}->[-1]->{'type'} eq 'index_entry_command') or ($previous_ending_container->{'contents'}->[-1]->{'cmdname'} and ($previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'c' - or $previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'comment')))) { + or $previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'comment' + # subentry is not within the index entry in the tree + or $previous_ending_container->{'contents'}->[-1]->{'cmdname'} eq 'subentry') + ))) { unshift @gathered_index_entries, pop @{$previous_ending_container->{'contents'}}; } #print STDERR "Gathered: @gathered_index_entries\n";
diff --git a/tp/t/index_before_item.t b/tp/t/index_before_item.t index 89a74df..184b4ed 100644 --- a/tp/t/index_before_item.t +++ b/tp/t/index_before_item.t
@@ -5,7 +5,7 @@ use Test::More; -BEGIN { plan tests => 6; } +BEGIN { plan tests => 7; } use Texinfo::Parser qw(parse_texi_piece); use Texinfo::Common qw(move_index_entries_after_items_in_tree); @@ -164,3 +164,16 @@ @item e--mph item @end itemize ', 'only comment'); + +run_test('@enumerate +@cindex pattern @subentry variable +@item +Set the variable +@end enumerate +', '@enumerate +@item +@cindex pattern @subentry variable +Set the variable +@end enumerate +', 'subentry'); +