diff options
author | June McEnroe <june@causal.agency> | 2020-12-19 15:49:08 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-12-19 15:49:08 -0500 |
commit | 5107c9d50e11d37042e8ce33ba15511d88b5572b (patch) | |
tree | 392241c99ae3c73080ac0e798bcb0f87b845177e | |
parent | Open rfc-index.txt for :RFC without argument (diff) | |
download | src-5107c9d50e11d37042e8ce33ba15511d88b5572b.tar.gz src-5107c9d50e11d37042e8ce33ba15511d88b5572b.zip |
Sort RFC tags file
This supposedly lets vim do binary search on the file, not that it seemed slow before. Also handle section headings with no names.
-rw-r--r-- | rfc/Makefile | 2 | ||||
-rw-r--r-- | rfc/rfctags.pl | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/rfc/Makefile b/rfc/Makefile index c83f9879..630b09f9 100644 --- a/rfc/Makefile +++ b/rfc/Makefile @@ -1,7 +1,7 @@ MODULE = ftp.rfc-editor.org::rfcs-text-only tags: rfctags.pl - perl rfctags.pl > $@ + perl rfctags.pl | sort -f > $@ sync: rsync -z ${MODULE}/rfc-index.txt ${MODULE}/'rfc[0-9]*.txt' . diff --git a/rfc/rfctags.pl b/rfc/rfctags.pl index cd3ba288..5833e17a 100644 --- a/rfc/rfctags.pl +++ b/rfc/rfctags.pl @@ -5,15 +5,16 @@ use open ':encoding(ISO-8859-1)'; use IO::Uncompress::Gunzip qw($GunzipError); ($,, $\) = ("\t", "\n"); +print '!_TAG_FILE_SORTED', 2, $0; # Promise to pipe this through sort -f for my $rfc (<*.txt.gz>) { my $handle = new IO::Uncompress::Gunzip $rfc or die "${rfc}: ${GunzipError}"; while (<$handle>) { chomp; # Section headings - if (/^([\d.]+|[A-Z][.])\s+([^\t]+)/) { + if (/^([\d.]+|[A-Z][.])\s+([^\t]+)?/) { print $1, $rfc, $.; - print $2, $rfc, $.; + print $2, $rfc, $. if $2; } # References if (/^\s*(\[[\w-]+\])\s{2,}/) { |