X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/268a2dd54cd47d6ec39c22d61baa5f6f9d40b7f5..73f4a8835876c8cb07808367cd72d9ae972893e8:/IkiWiki.pm?ds=sidebyside diff --git a/IkiWiki.pm b/IkiWiki.pm index 611ba6f65..5d5c7f0d0 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -881,7 +881,7 @@ sub bestlink ($$) { $l.="/" if length $l; $l.=$link; - if (exists $links{$l}) { + if (exists $pagesources{$l}) { return $l; } elsif (exists $pagecase{lc $l}) { @@ -891,7 +891,7 @@ sub bestlink ($$) { if (length $config{userdir}) { my $l = "$config{userdir}/".lc($link); - if (exists $links{$l}) { + if (exists $pagesources{$l}) { return $l; } elsif (exists $pagecase{lc $l}) { @@ -1026,6 +1026,13 @@ sub urlto ($$;$) { return beautify_urlpath($link); } +sub isselflink ($$) { + my $page=shift; + my $link=shift; + + return $page eq $link; +} + sub htmllink ($$$;@) { my $lpage=shift; # the page doing the linking my $page=shift; # the page that will contain the link (different for inline) @@ -1051,7 +1058,7 @@ sub htmllink ($$$;@) { } return "<span class=\"selflink\">$linktext</span>" - if length $bestlink && $page eq $bestlink && + if length $bestlink && isselflink($page, $bestlink) && ! defined $opts{anchor}; if (! $destsources{$bestlink}) { @@ -1083,7 +1090,7 @@ sub htmllink ($$$;@) { my @attrs; foreach my $attr (qw{rel class title}) { if (defined $opts{$attr}) { - push @attrs, " $attr=\"".$opts{attr}.'"'; + push @attrs, " $attr=\"$opts{$attr}\""; } } @@ -1407,7 +1414,7 @@ sub check_content (@) { my %old=map { $_ => 1 } split("\n", readfile(srcfile($pagesources{$params{page}}))); foreach my $line (split("\n", $params{content})) { - push @diff, $line if ! exists $old{$_}; + push @diff, $line if ! exists $old{$line}; } $params{diff}=join("\n", @diff); }