- $line =~ s/\</</g;
- $line =~ s/\>/>/g;
- $line =~ s!(http|ftp)://[^]&)\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!([-_.\w]+)\((\d+\w*)\)!SWMan::subst("$1($2)", $1, $2)!eg;
+ $line =~ s/\</<</g;
+ $line =~ s/\>/>>/g;
+
+ # --- Spot URLs (except `mailto') ---
+
+ $line =~ s! \b (http s? | ftp | file | news) :
+ [^])\s<>]* [^]<>&).,\s\']
+ !SWMan::urlsubst($&, $&)!egx;
+
+ # --- Spot email addresses (including `mailto' URLs) ---
+
+ $line =~ s! (?:\bmailto:)?
+ ([^\s()&;:<>&{}.,\`\'\"] [^\s()&;:<>&{}\`\'\"]*
+ \@
+ [^\s()&;:{}<>&\'\"]* [^\s()&;:{}<>&.,\'\"])
+ !<a href="mailto:$1">$&</a>!gx;
+
+ # --- Spot info references ---
+
+ $line =~ s! \b info: ([^]&)\s<>]* [^]&).,\s<>\'\"])
+ !<a href="$ref?act=info&file=$1&node=Top">$&</a>!gx;
+
+ # --- Spot manpage references ---
+
+ $line =~ s! ([-_.\w]+) \( (\d+\w*) \)
+ !SWMan::subst("$1($2)", $1, $2)!egx;
+
+ # --- Finally fix up the HTML properly ---
+
+ $line =~ s/\<\;\</</g;
+ $line =~ s/\>\>\;/>/g;
+