X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/046ac5fec5534e10b8e34b96014f936bb151d147..73f4a8835876c8cb07808367cd72d9ae972893e8:/IkiWiki.pm?ds=inline
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 1e9d1ca2a..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 "$linktext"
- if length $bestlink && $page eq $bestlink &&
+ if length $bestlink && isselflink($page, $bestlink) &&
! defined $opts{anchor};
if (! $destsources{$bestlink}) {
@@ -1081,11 +1088,10 @@ sub htmllink ($$$;@) {
}
my @attrs;
- if (defined $opts{rel}) {
- push @attrs, ' rel="'.$opts{rel}.'"';
- }
- if (defined $opts{class}) {
- push @attrs, ' class="'.$opts{class}.'"';
+ foreach my $attr (qw{rel class title}) {
+ if (defined $opts{$attr}) {
+ push @attrs, " $attr=\"$opts{$attr}\"";
+ }
}
return "$linktext";
@@ -1408,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);
}