diff options
author | Jens Seidel <jseidel> | 2006-08-22 17:30:20 +0000 |
---|---|---|
committer | Jens Seidel <jseidel> | 2006-08-22 17:30:20 +0000 |
commit | 69a06493027a0a8ce774ff77b53de31363e0970b (patch) | |
tree | 1381983cdb353bd022187320508c884050900afe /check_links.pl | |
parent | 0b15a9a0359a9d8d2749cb2264ba3dd715b855a7 (diff) |
Added simple link checker, thanks Nick Toris <nicktoris@gmail.com>.
CVS version numbers
check_links.pl: INITIAL -> 1.1
Diffstat (limited to 'check_links.pl')
-rwxr-xr-x | check_links.pl | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/check_links.pl b/check_links.pl new file mode 100755 index 00000000000..ed4be6de794 --- /dev/null +++ b/check_links.pl @@ -0,0 +1,48 @@ +#!/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"); |