Slight improvements to URL and email address parsing.
[sw-tools] / perl / SWInfo.pm
index 04898df..276ac05 100644 (file)
@@ -1,6 +1,6 @@
 # -*-perl-*-
 #
-# $Id: SWInfo.pm,v 1.1 1999/07/30 18:46:37 mdw Exp $
+# $Id: SWInfo.pm,v 1.2 1999/08/18 17:10:07 mdw Exp $
 #
 # Read and output GNU Info files
 #
@@ -28,6 +28,9 @@
 #----- Revision history -----------------------------------------------------
 #
 # $Log: SWInfo.pm,v $
+# Revision 1.2  1999/08/18 17:10:07  mdw
+# Slight improvements to URL and email address parsing.
+#
 # Revision 1.1  1999/07/30 18:46:37  mdw
 # New CGI script for browsing installed software and documentation.
 #
@@ -141,8 +144,8 @@ sub info {
   }
   $out .= $n;
 
-  $out =~ s!(http|ftp)://[^]&)\s]*[^]&).,\s\'\"]!<a href="$&">$&</a>!g;
-  $out =~ s![^\s()&;{}.,\`\"][^\s()&;{}\`\"]*\@[^\s()&;{}\'\"]*[^\s()&;{}.,\'\"]!<a href="mailto:$&">$&</a>!g;
+  $out =~ s!\b(https?|ftp|file|news):[^]&)\s]*[^]&).,\s\'\"]!<a href="$&">$&</a>!g;
+  $out =~ s!(?:\bmailto:)?([^\s()&;:{}.,\`\"][^\s()&;:{}\`\"]*\@[^\s()&;:{}\'\"]*[^\s()&;:{}.,\'\"])!<a href="mailto:$1">$&</a>!g;
   $out =~ s!([-_.\w]+)\((\d+\w*)\)!SWMan::subst("$1($2)", $1, $2)!eg;
 
   header("Info: ($file)$node");