# -*-perl-*-
#
-# $Id: SWDoc.pm,v 1.1 1999/07/30 18:46:37 mdw Exp $
+# $Id: SWDoc.pm,v 1.2 1999/08/18 17:10:07 mdw Exp $
#
# Display documentation files
#
#----- Revision history -----------------------------------------------------
#
# $Log: SWDoc.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.
#
$line =~ s/\&/&/g;
$line =~ s/\</</g;
$line =~ s/\>/>/g;
- $line =~ s!(http|ftp)://[^]&)\s]*[^]&).,\s\']!<a href="$&">$&</a>!g;
+ $line =~ s!\b(https?|ftp|file|news):[^]&)\s]*[^]&).,\s\']!<a href="$&">$&</a>!g;
$line =~ s!info:([^]&)\s]*[^]&).,\s\'\"])!<a href="$ref?act=info&file=$1&node=Top">$&</a>!g;
- $line =~ s![^\s()&;{}.,\`\"][^\s()&;{}\`\"]*\@[^\s()&;{}\'\"]*[^\s()&;{}.,\'\"]!<a href="mailto:$&">$&</a>!g;
+ $line =~ s!(?:\bmailto:)?([^\s()&;:{}.,\`\"][^\s()&;:{}\`\"]*\@[^\s()&;:{}\'\"]*[^\s()&;:{}.,\'\"])!<a href="mailto:$1">$&</a>!g;
$line =~ s!([-_.\w]+)\((\d+\w*)\)!SWMan::subst("$1($2)", $1, $2)!eg;
print $line;
}
# -*-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
#
#----- 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.
#
}
$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");
# -*-perl-*-
#
-# $Id: SWMan.pm,v 1.1 1999/07/30 18:46:37 mdw Exp $
+# $Id: SWMan.pm,v 1.2 1999/08/18 17:10:07 mdw Exp $
#
# Display and other fiddling of manual pages
#
#----- Revision history -----------------------------------------------------
#
# $Log: SWMan.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.
#
# --- And email and hypertext references too ---
$l =~ s! ((?:\<[bi]\>)*) # Leading highlighting
- ((?:http|ftp) # A protocol name
- :// # The important and obvious bit
+ ((?:https?|ftp|file|news) # A protocol name
+ : # The important and obvious bit
[^]&)\s]+ # Most characters are allowed
[^]&).,\s\'\"]) # Don't end on punctuation
((?:\</[bi]\>)*) # Closing tags, optional
- !<a href="$2">$&</a>!gx;
+ !$1<a href="$2">$&</a>$3!gx;
- $l =~ s! ((?:\<[bi]\>)*)
- ( [^\s()&;{}<>,.\`\"] [^\s()&;{}<>\`\"]* \@
- [^\s()&;{}<>\'\"]* [^\s()&;{}<>.,\'\"])
+ $l =~ s! ((?:\<[bi]\>)*(?:\bmailto:)?)
+ ( [^\s()&;:{}<>,.\`\"] [^\s()&;:{}<>\`\"]* \@
+ [^\s()&;:{}<>\'\"]* [^\s()&;:{}<>.,\'\"])
((?:\</[bi]\>)*)
- !<a href="mailto:$2">$&</a>!gx;
+ !$1<a href="mailto:$2">$&</a>$3!gx;
# --- Done! ---