From: Tim Bishop Date: Thu, 9 Nov 2000 22:03:56 +0000 (+0000) Subject: URL's are actually linked now... which is nice :-) X-Git-Tag: PROJECT_COMPLETION~126 X-Git-Url: http://git.i-scream.org/?a=commitdiff_plain;h=5e4357f28b692892ea28ac034c8166727ad76f06;p=www.i-scream.org.git URL's are actually linked now... which is nice :-) --- 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 "
";