From: Joey Hess Date: Wed, 23 Jun 2010 18:05:57 +0000 (-0400) Subject: bugfix: record email-like links as page links X-Git-Tag: 3.20100623~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=82789e39aa75a15f3f9020a6f809150d4c8a00f8;p=ikiwiki.git bugfix: record email-like links as page links This way, an email-like link will be a mailto until a matching page is created, then it will link to the page. And removing the page will convert it back to a mailto. --- diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm index 87e06ca89..f6c3573f7 100644 --- a/IkiWiki/Plugin/link.pm +++ b/IkiWiki/Plugin/link.pm @@ -64,21 +64,23 @@ sub checkconfig () { } } -sub is_externallink ($$;$) { +sub is_externallink ($$;$$) { my $page = shift; my $url = shift; my $anchor = shift; + my $force = shift; if (defined $anchor) { $url.="#".$anchor; } - if ($url =~ /$email_regexp/) { + if (! $force && $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. return (! (bestlink($page, linkpage($url)))) } + return ($url =~ /$url_regexp/) } @@ -138,7 +140,7 @@ sub scan (@) { my $content=$params{content}; while ($content =~ /(?