From f2f34147350143acc449967e7dde72c3d8b53ecb Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sun, 29 Oct 2023 13:15:04 +0000 Subject: [CWEB] Make 'proofsort' like 'refsort'. Read input from and write output to . git-svn-id: svn://tug.org/texlive/trunk@68690 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/cwebdir/ChangeLog | 5 ++++ Build/source/texk/web2c/cwebdir/ctwill-proofsort | 32 +++++++----------------- Build/source/texk/web2c/cwebdir/ctwill.test | 2 +- Build/source/texk/web2c/man/ChangeLog | 5 ++++ Build/source/texk/web2c/man/ctwill.man | 15 +++++++---- Build/source/texk/web2c/man/cweb.man | 7 ++++-- 6 files changed, 35 insertions(+), 31 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index ceb6ed51ed9..be1de8cb1b1 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,8 @@ +2023-10-29 Andreas Scherer + + * ctwill-proofsort, + * ctwill.test: Make 'proofsort' like 'refsort'. + 2023-10-25 Andreas Scherer * cwebmac.tex, diff --git a/Build/source/texk/web2c/cwebdir/ctwill-proofsort b/Build/source/texk/web2c/cwebdir/ctwill-proofsort index 71e71dd4b3a..9dc8d9d9cc7 100755 --- a/Build/source/texk/web2c/cwebdir/ctwill-proofsort +++ b/Build/source/texk/web2c/cwebdir/ctwill-proofsort @@ -22,17 +22,9 @@ BEGIN { }; } -# We expect a TeX file as the single command-line parameter. -my $usage = "Usage: $progname input_file\n"; -if (@ARGV > 1) { - my $first = shift @ARGV; - $usage .= "extra file argument(s): @ARGV\n"; - unshift @ARGV, $first; -} -$usage .= "try --help if you need it.\n"; - -die $usage unless scalar @ARGV == 1; +my $usage = "Usage: $progname < input_file > output_file\n"; +# Standard options for TeX Live. Getopt::Long::GetOptions( 'help|?' => \&help_handler, 'version' => sub { print version(); exit 0; } @@ -50,14 +42,7 @@ sub version { return $progname.' $Revision$ $Date$'."\n"; } -my $tex = $ARGV[0]; - -open(TEX, $tex) or die "$0: Could not open input file $tex.\n"; - -my %mini_index; # storage for index entries of a section -my $print_index = 0; # do we collect and print a mini-index? - -# Scroll through the input file and look for blocks like +# Read input from the console and look for blocks like # \mini # [LOCATION KEY TEXPART]* # }\FI @@ -68,7 +53,9 @@ my $print_index = 0; # do we collect and print a mini-index? # or as a single identifier in $math_mode$; the latter come from '@f'ormat # definitions. All internal backslashes are removed from the KEY before it # is used in the storage. -foreach my $line () +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 () { if ("\\mini\n" eq $line) { # start of mini-index $print_index = 1; @@ -92,8 +79,6 @@ foreach my $line () print $line; } -close(TEX); - exit 0; =pod @@ -109,12 +94,13 @@ ctwill-proofsort - Sort mini-indexes alphabetically This small Perl script 'ctwill-proofsort' sorts the mini-indexes for each section in the TeX file created by 'ctwill +P', i.e., prior to formatting with the 'ctproofmac.tex' macros. +It reads its input from and writes its output to . =over =item Run CTWILL twice on your 'input_file'.w, creating 'input_file'.tex -=item Invoke "ctwill-proofsort 'input_file'.tex > 'input_file'-sorted.tex" +=item Invoke "ctwill-proofsort < 'input_file'.tex > 'input_file'-sorted.tex" =item Invoke "mv 'input_file'-sorted.tex 'input_file'.tex" @@ -135,7 +121,7 @@ Example from MMIX (https://github.com/ascherer/mmix, 'local' branch): =item $ ctwill +P -x mmotype mmotype-twill (run this two times) -=item $ ctwill-proofsort mmotype.tex > mmotype-sorted.tex +=item $ ctwill-proofsort < mmotype.tex > mmotype-sorted.tex =item $ mv mmotype-sorted.tex mmotype.tex diff --git a/Build/source/texk/web2c/cwebdir/ctwill.test b/Build/source/texk/web2c/cwebdir/ctwill.test index 26697ce121d..219f6eb54aa 100755 --- a/Build/source/texk/web2c/cwebdir/ctwill.test +++ b/Build/source/texk/web2c/cwebdir/ctwill.test @@ -36,7 +36,7 @@ $DIFF index.tex $testdir/index.tex || exit 6 # Perl script not available in builddir, and requires Unicode::Collate; # if that module is not available, just quit testing. perl -e 'use Unicode::Collate; Unicode::Collate->new();' 2>/dev/null || exit 0 -$testdir/../ctwill-proofsort ham.tex > ham-sorted.tex || exit 7 +$testdir/../ctwill-proofsort < ham.tex > ham-sorted.tex || exit 7 $DIFF ham-sorted.tex $testdir/ham-sorted.tex || exit 8 exit 0 diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index b2bc27bd053..b6a2df91533 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,3 +1,8 @@ +2023-10-29 Andreas Scherer + + * cweb.man: Regenerate with Pandoc 3.1.9. + * ctwill.man: Make 'proofsort' like 'refsort'. + 2023-10-13 Andreas Scherer * weave.man: Add option '-p' to '\input pwebmac'. diff --git a/Build/source/texk/web2c/man/ctwill.man b/Build/source/texk/web2c/man/ctwill.man index 70d83f68214..5b57cae8bfe 100644 --- a/Build/source/texk/web2c/man/ctwill.man +++ b/Build/source/texk/web2c/man/ctwill.man @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc .\" -.TH "CTWILL" "1" "August 19, 2023" "Web2c @VERSION@" "General Commands Manual" +.TH "CTWILL" "1" "October 29, 2023" "Web2c @VERSION@" "General Commands Manual" .SH NAME ctwill, ctwill-proofsort, ctwill-refsort, ctwill-twinx - translate CWEB to TeX with mini-indexes @@ -10,7 +10,8 @@ mini-indexes .PD 0 .P .PD -\f[B]ctwill-proofsort\f[R] \f[I]texfile\f[R].tex > \f[I]texfile\f[R]-sorted.tex +\f[B]ctwill-proofsort\f[R] < \f[I]texfile\f[R].tex > +\f[I]texfile\f[R]-sorted.tex .PD 0 .P .PD @@ -105,7 +106,8 @@ output. You can use \f[B]ctwill-proofsort\f[R] to get the index entries in alphabetical order; just invoke .IP \[bu] 2 -\f[B]ctwill-proofsort\f[R] \f[I]texfile\f[R].tex > \f[I]texfile\f[R]-sorted.tex +\f[B]ctwill-proofsort\f[R] < \f[I]texfile\f[R].tex > +\f[I]texfile\f[R]-sorted.tex .IP \[bu] 2 \f[B]mv\f[R] \f[I]texfile\f[R]-sorted.tex \f[I]texfile\f[R].tex .PP @@ -240,8 +242,11 @@ Other \f[B]aux\f[R]iliary files with references are created automatically by \f[B]ctwill\f[R] and the actual index files are created by TeX. .IP \[bu] 2 -\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from -CTAN (https://ctan.org/pkg/cweb). +\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from \c +.UR https://ctan.org/pkg/cweb +CTAN +.UE \c +\&. .SH SEE ALSO .IP \[bu] 2 The CWEB System of Structured Documentation: by Donald E.\ Knuth and diff --git a/Build/source/texk/web2c/man/cweb.man b/Build/source/texk/web2c/man/cweb.man index d67fe171368..b7abcd512cb 100644 --- a/Build/source/texk/web2c/man/cweb.man +++ b/Build/source/texk/web2c/man/cweb.man @@ -142,8 +142,11 @@ Use the \f[B]kpsewhich\f[R] utility to find their locations. \f[B]cwebmac.tex\f[R]: The default TeX\ macros \f[B]\[rs]input\f[R] in the first line of the \f[B]cweave\f[R] output file. .IP \[bu] 2 -\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from -CTAN (https://ctan.org/pkg/cweb). +\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from \c +.UR https://ctan.org/pkg/cweb +CTAN +.UE \c +\&. .SH SEE ALSO .IP \[bu] 2 The CWEB System of Structured Documentation: by Donald E.\ Knuth and -- cgit v1.2.3