+ }x;
+ }
+}
+
+sub is_externallink ($$) {
+ my $page = shift;
+ my $url = shift;
+ if ($url =~ /$email_regexp/) {
+ # url looks like an email address, so we assume it
+ # is supposed to be an external link if there is no
+ # page with that name.
+ $url =~ s/#.*//;
+ return (! (bestlink($page, linkpage($url))))
+ }
+ return ($url =~ /$url_regexp/)
+}
+
+sub externallink ($;@) {
+ my $url = shift;
+ my $pagetitle = shift;
+
+ # build pagetitle
+ if (!($pagetitle)) {
+ $pagetitle = $url;
+ # use only the email address as title for mailto: urls
+ if ($pagetitle =~ /^mailto:.*/) {
+ $pagetitle =~ s/^mailto:([^?]+).*/$1/;
+ }
+ }
+
+ # handle email-addresses (without mailto:):
+ if ($url =~ /$email_regexp/) {
+ $url = "mailto:" . $url;