summary refs log tree commit diff
path: root/doc/rfc/rfctags.pl
diff options
context:
space:
mode:
Diffstat (limited to 'doc/rfc/rfctags.pl')
-rw-r--r--doc/rfc/rfctags.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/rfc/rfctags.pl b/doc/rfc/rfctags.pl
new file mode 100644
index 00000000..05173d00
--- /dev/null
+++ b/doc/rfc/rfctags.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use open ':encoding(ISO-8859-1)';
+
+($,, $\) = ("\t", "\n");
+while (<>) {
+	chomp;
+	# Section headings
+	if (/^([\d.]+|[A-Z][.])\s+([^\t]+)?/) {
+		print $1, $ARGV, $.;
+		print $2, $ARGV, $. if $2;
+		print $1, $ARGV, $. if $1 =~ /^([\d.]+)[.]$/;
+	}
+	# References
+	if (/^\s*(\[[\w-]+\])\s{2,}/) {
+		print $1, $ARGV, $.;
+		print "\\$1", $ARGV, $.; # vim ^] prepends \ to [
+	}
+	close ARGV if eof;
+}