Commit 69a06493 authored by Jens Seidel's avatar Jens Seidel

Added simple link checker, thanks Nick Toris <nicktoris@gmail.com>.

CVS version numbers

check_links.pl: INITIAL -> 1.1
parent 0b15a9a0
#!/usr/bin/perl
sub catfile {
my $a = "";
open(F, shift) || return "";
while (<F>) { s/\r//g; trim; if (not m/^#/) { $a .= $_; } };
close(F);
return $a;
}
$original = "english";
$translation = "german";
$origfile = "links.en.txt";
$transfile = "links.de.txt";
open FR, ">$transfile" || die "Can't create file";
open FE, ">$origfile" || die "Can't create file";
@list = `find $translation/ -name *.wml -type f -print`;
foreach $rus (@list) {
chomp($rus);
($eng = $rus) =~ s{$translation}{$original};
($f = $rus) =~ s{$translation/}{};
$rrus = catfile($rus);
$rrus =~ s{/\n}{}g;
$rrus =~ s{\n}{ }g;
@lrus = ();
$rrus =~ s{<[aA]\s*[hH][rR][eE][fF]=(.*?)>}{
push @lrus, "$f: $1"; $1
}gse;
foreach (sort @lrus) { print FR "$_\n"; }
$reng = catfile($eng);
$reng =~ s{/\n}{}g;
$reng =~ s{\n}{ }g;
@leng = ();
$reng =~ s{<[aA]\s*[hH][rR][eE][fF]=(.*?)>}{
push @leng, "$f: $1"; $1
}gse;
foreach (sort @leng) { print FE "$_\n"; }
}
close FE;
close FR;
exec("diff -u $transfile $origfile > links.diff");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment