texlive[67353] Build/source/texk/web2c/cwebdir/proofsort: {CWEB]

commits+ascherer at tug.org commits+ascherer at tug.org
Tue Jun 13 18:08:39 CEST 2023


Revision: 67353
          http://tug.org/svn/texlive?view=revision&revision=67353
Author:   ascherer
Date:     2023-06-13 18:08:38 +0200 (Tue, 13 Jun 2023)
Log Message:
-----------
{CWEB] Improve proofsort script.

No need to chomp($line).
Sort case-insensitive.
Support @f TeX replacements; these come in $math$ mode.

Example from CTWILL: @f TeX_string TeX

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/proofsort

Modified: trunk/Build/source/texk/web2c/cwebdir/proofsort
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/proofsort	2023-06-13 00:22:57 UTC (rev 67352)
+++ trunk/Build/source/texk/web2c/cwebdir/proofsort	2023-06-13 16:08:38 UTC (rev 67353)
@@ -25,15 +25,14 @@
 my %mini_index; # storage for index entries of a section
 my $print_index=0; # do we collect and print a mini-index?
 
-foreach my $line (<TEX>) {
-	chomp($line);
-
-	if ('\\mini' eq $line) { # start of mini-index
+foreach my $line (<TEX>)
+{
+	if ("\\mini\n" eq $line) { # start of mini-index
 		$print_index=1;
 		%mini_index=(); # reset mini-index
-	} elsif ('}\\FI' eq $line) { # end of mini-index
-		foreach my $key (sort keys %mini_index) {
-			print "$mini_index{$key}\n";
+	} elsif ("}\\FI\n" eq $line) { # end of mini-index
+		foreach my $key (sort {"\L$a" cmp "\L$b"} keys %mini_index) {
+			print $mini_index{$key};
 		}
 		$print_index=0;
 	} elsif ($print_index) { # mini-index entry
@@ -40,11 +39,12 @@
 		my ($location,$key) = split / /, $line; # 2nd column is the key
 		$key=~s/\\//g; # strip TeX escape(s)
 		$key=~m/\w*\{(\w+)\}/; # extract plain key
+		$key=~m/\$(\w+)\$/ unless defined $1; # extract @f TeX key
 		$mini_index{$1}=$line; # store index entry
 		next; # print later
 	}
 
-	print "$line\n";
+	print $line;
 }
 
 close(TEX);



More information about the tex-live-commits mailing list.