Browse Source

Bugfix for wikilink containing an email address not showing up in brokenlinks list.

plusone
Joey Hess 9 years ago
parent
commit
a965e02430
3 changed files with 14 additions and 5 deletions
  1. +3
    -5
      IkiWiki/Plugin/link.pm
  2. +2
    -0
      debian/changelog
  3. +9
    -0
      doc/bugs/emails_should_not_be_considered_as_broken_links.mdwn

+ 3
- 5
IkiWiki/Plugin/link.pm View File

@@ -64,23 +64,21 @@ 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 (! $force && $url =~ /$email_regexp/) {
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/)
}

@@ -140,7 +138,7 @@ sub scan (@) {
my $content=$params{content};

while ($content =~ /(?<!\\)$link_regexp/g) {
if (! is_externallink($page, $2, $3, 1)) {
if (! is_externallink($page, $2, $3)) {
add_link($page, linkpage($2));
}
}


+ 2
- 0
debian/changelog View File

@@ -29,6 +29,8 @@ ikiwiki (3.20110609) UNRELEASED; urgency=low
mode) (smcv)
* inline: Handle obfuscated urls, such as the mailto urls generated by
markdown when forcing urls absolute.
* Bugfix for wikilink containing an email address not showing up in
brokenlinks list.

-- Joey Hess <joeyh@debian.org> Thu, 09 Jun 2011 10:06:44 -0400



+ 9
- 0
doc/bugs/emails_should_not_be_considered_as_broken_links.mdwn View File

@@ -3,3 +3,12 @@ The [[ikiwiki/directive/brokenlinks]] directive lists emails when used inside [[
[[!brokenlinks pages="*@* and !recentchanges"]]

> Weird. The bug, imho, is that `\[[email-address]]` results in a marked-up email address. I think marking up email addresses into hyperlinks should be handled by a markup plugin (e.g. markdown), not by the wikilink parser. I feel the same way for external links, but it appears [this is all by design](http://source.ikiwiki.branchable.com/?p=source.git;a=commitdiff;h=07a08122d926ab6b7741c94bc6c0038ffe0113fb). — [[Jon]]

>> I belive this was done for compatability with the wikicreole plugin.
>> Since in creole, a wikilink can contain an email or full html link,
>> 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]]

Loading…
Cancel
Save