summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/ctwill-proofsort
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctwill-proofsort')
-rwxr-xr-xBuild/source/texk/web2c/cwebdir/ctwill-proofsort10
1 files changed, 7 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-proofsort b/Build/source/texk/web2c/cwebdir/ctwill-proofsort
index b26904d00e9..7043ddf16dd 100755
--- a/Build/source/texk/web2c/cwebdir/ctwill-proofsort
+++ b/Build/source/texk/web2c/cwebdir/ctwill-proofsort
@@ -61,10 +61,14 @@ foreach my $line (<STDIN>)
$print_index = 1;
%mini_index = (); # reset mini-index storage
} elsif ("}\\FI\n" eq $line) { # end of mini-index
- foreach my $key ($collator ?
+ foreach my $key ($collator ? # (I) sort by second column
$collator->sort(keys %mini_index) :
sort {"\L$a" cmp "\L$b"} keys %mini_index) {
- print $mini_index{$key};
+ print sort { # (II) sort by third and first column
+ my ($a_loc,undef,$a_id) = split / /, $a, 3;
+ my ($b_loc,undef,$b_id) = split / /, $b, 3;
+ $a_id cmp $b_id || $a_loc cmp $b_loc }
+ @{ $mini_index{$key} };
}
$print_index = 0;
} elsif ($print_index) { # mini-index entry
@@ -72,7 +76,7 @@ foreach my $line (<STDIN>)
$key =~ s/\\//g; # strip internal TeX escape(s)
$key =~ m/\w*\{(\w+)\}/; # extract plain key from control seq.
$key =~ m/\$(\w+)\$/ unless defined $1; # extract @f TeX key
- $mini_index{$1} = $line; # store index entry
+ push @{ $mini_index{$1} }, $line; # store index entry
next; # print later
}