From 5e4357f28b692892ea28ac034c8166727ad76f06 Mon Sep 17 00:00:00 2001 From: Tim Bishop Date: Thu, 9 Nov 2000 22:03:56 +0000 Subject: [PATCH] URL's are actually linked now... which is nice :-) --- cgi-bin/docs.cgi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 "
"; -- 2.44.0