2012-01-19 19:50:02 -06:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
my $file = $ARGV[0];
|
|
|
|
|
|
|
|
my @lines = <>;
|
|
|
|
|
|
|
|
my $anchors = {};
|
|
|
|
|
|
|
|
my $i = 0;
|
2013-08-03 11:45:23 -05:00
|
|
|
for $line (@lines) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$i++;
|
2013-05-03 18:25:04 -05:00
|
|
|
if ($line =~ m/id="([^"]+)"/) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$anchors->{$1} = $i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$i = 0;
|
2013-08-03 11:45:23 -05:00
|
|
|
for $line (@lines) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$i++;
|
2013-05-03 18:25:04 -05:00
|
|
|
while ($line =~ m/href="#([^"]+)"/g) {
|
2012-01-19 19:50:02 -06:00
|
|
|
if (! exists($anchors->{$1})) {
|
|
|
|
print "$file:$i: $1 referenced\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|