]> sipb.mit.edu Git - ikiwiki.git/commitdiff
emails in wikilinks are always email addresses
authorJoey Hess <joey@kitenet.net>
Wed, 29 Jun 2011 23:09:23 +0000 (19:09 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 29 Jun 2011 23:09:23 +0000 (19:09 -0400)
If a page that looks like an email address exists, it can't be linked to.
But that's unlikely. Better to be consistent; before this change, a
wikilink with an email address in it could link to the email address or a
page, depending on when the page was created and when the page with the
link was updated.

IkiWiki/Plugin/link.pm
doc/bugs/emails_should_not_be_considered_as_broken_links.mdwn

index 87e06ca899b51868646346a77670835caa7deb07..ef01f110702228fb71356d7d76437161f134b156 100644 (file)
@@ -7,7 +7,7 @@ use IkiWiki 3.00;
 
 my $link_regexp;
 
-my $email_regexp = qr/^.+@.+$/;
+my $email_regexp = qr/^.+@.+\..+$/;
 my $url_regexp = qr/^(?:[^:]+:\/\/|mailto:).*/i;
 
 sub import {
@@ -73,13 +73,7 @@ sub is_externallink ($$;$) {
                $url.="#".$anchor;
        }
 
-       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.
-               return (! (bestlink($page, linkpage($url))))
-       }
-       return ($url =~ /$url_regexp/)
+       return ($url =~ /$url_regexp|$email_regexp/)
 }
 
 sub externallink ($$;$) {
index 353c3653d296ed6b5f3ee34a5be74311f106d469..5aad1292ac5d8553d4bc8617f2a6fdab3d3238b4 100644 (file)
@@ -9,6 +9,4 @@ The [[ikiwiki/directive/brokenlinks]] directive lists emails when used inside [[
 >> and it was easier to make ikiwiki's wikilinks do so too, rather
 >> than put entirely different link handling into creole.
 >>
->> Anyway, I've fixed this, although it leaves some weirdness if a page
->> is created with a name like an email address and that same email address
->> was previously used for external links. [[done]] --[[Joey]] 
+>> Anyway, I've fixed this. [[done]] --[[Joey]]