X-Git-Url: http://git.i-scream.org/?a=blobdiff_plain;f=cgi-bin%2Fdocs.cgi;fp=cgi-bin%2Fdocs.cgi;h=cb6c3d2bbe8dbb9fa83e81024156f0a96e7b5586;hb=5e4357f28b692892ea28ac034c8166727ad76f06;hp=6760915f660057df6c621761aa92c3e39f764961;hpb=fe45f1cfeaf0b66c9c311fa20f45f4bff9df6ff7;p=www.i-scream.org.git diff --git a/cgi-bin/docs.cgi b/cgi-bin/docs.cgi index 6760915..cb6c3d2 100755 --- a/cgi-bin/docs.cgi +++ b/cgi-bin/docs.cgi @@ -77,6 +77,20 @@ exit 0; # Print a file, whilst escaping HTML: - sub print_file ($) { + my ($urls) = '(' . join ('|', qw{ + http + telnet + gopher + file + wais + ftp + } ) + . ')'; + + my ($ltrs) = '\w'; + my ($gunk) = '/#~:.?+=&%@!\-'; + my ($punc) = '.:?\-'; + my ($any) = "${ltrs}${gunk}${punc}"; my ($filename) = @_; open(FILE, $filename) or die "Cannot open $filename: $!\n"; print "
\n";
@@ -87,6 +101,7 @@ sub print_file ($) {
         s//>/g;
         s/"/"/g;
+        s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/$1<\/a>/igox;
         print;
     }
     print "
";