Fix a bunch of broken internal links in the docs. Add a hokey link checker.

This commit is contained in:
Graydon Hoare 2012-01-19 17:50:02 -08:00
parent 6d4884d983
commit 874390831a
2 changed files with 81 additions and 58 deletions

26
src/etc/check-links.pl Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/perl -w
my $file = $ARGV[0];
my @lines = <>;
my $anchors = {};
my $i = 0;
foreach $line (@lines) {
$i++;
if ($line =~ m/id="([^"]+)"/) {
$anchors->{$1} = $i;
}
}
$i = 0;
foreach $line (@lines) {
$i++;
while ($line =~ m/href="#([^"]+)"/g) {
if (! exists($anchors->{$1})) {
print "$file:$i: $1 referenced\n";
}
}
}