File: linkcheck.pl

package info (click to toggle)
r-base 2.1.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 43,944 kB
  • ctags: 23,283
  • sloc: ansic: 200,913; fortran: 68,557; sh: 12,127; perl: 8,510; makefile: 5,810; tcl: 2,953; yacc: 2,077; java: 455; asm: 268; sed: 16
file content (28 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#-*- perl -*-

##
## Comment out links that are not available. Used, e.g., for including
## the manuals in the top HTML help page. Works only for lines
## containing only the link tag.
##

while(<>){
    if(/^(\s*)<a href=\"(.*)\">(.*)<\/a>\s$/i){
	if(-f $2){
	    print "$1<a href=\"$2\">$3</a>\n";
	}
	else{
	    $link = $2;
	    $text = $3;
	    if ($link =~ /R-[A-Za-z]+\.html$/) {
		$link =~ s+../manual+http://cran.r-project.org/doc/manuals+;
		print "$1<a href=\"$link\">$text</a> (on CRAN)\n";
	    } else {
		print "$1<!a href=\"$link\">$text (not installed)\n";
	    }
	}
    }
    else{
	print $_;
    }
}