From 69a06493027a0a8ce774ff77b53de31363e0970b Mon Sep 17 00:00:00 2001 From: Jens Seidel Date: Tue, 22 Aug 2006 17:30:20 +0000 Subject: Added simple link checker, thanks Nick Toris . CVS version numbers check_links.pl: INITIAL -> 1.1 --- check_links.pl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 check_links.pl (limited to 'check_links.pl') 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 () { 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"); -- cgit v1.2.3