X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4ccb9be7c644c6ecc691a6eb666607e39ce8d9d2..e15e3202eb04048feb302b39d946f1ae1a15c306:/IkiWiki.pm
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 0b9790d8a..c078a0055 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -39,7 +39,7 @@ sub defaultconfig () { #{{{
wiki_link_regexp => qr{
\[\[ # beginning of link
(?:
- ([^\]\|\n]+) # 1: link text
+ ([^\]\|\n\s]+) # 1: link text
\| # followed by '|'
)? # optional
@@ -407,6 +407,7 @@ sub bestlink ($$) { #{{{
# absolute links
$cwd="";
}
+ $link=~s/\/$//;
do {
my $l=$cwd;
@@ -498,19 +499,24 @@ sub abs2rel ($$) { #{{{
return $ret;
} #}}}
-sub displaytime ($) { #{{{
+sub displaytime ($;$) { #{{{
my $time=shift;
+ my $format=shift;
+ if (! defined $format) {
+ $format=$config{timeformat};
+ }
# strftime doesn't know about encodings, so make sure
# its output is properly treated as utf8
- return decode_utf8(POSIX::strftime(
- $config{timeformat}, localtime($time)));
+ return decode_utf8(POSIX::strftime($format, localtime($time)));
} #}}}
sub beautify_url ($) { #{{{
my $url=shift;
- $url =~ s!/index.$config{htmlext}$!/!;
+ if ($config{usedirs}) {
+ $url =~ s!/index.$config{htmlext}$!/!;
+ }
$url =~ s!^$!./!; # Browsers don't like empty links...
return $url;
@@ -539,6 +545,8 @@ sub htmllink ($$$;@) { #{{{
my $link=shift;
my %opts=@_;
+ $link=~s/\/$//;
+
my $bestlink;
if (! $opts{forcesubpage}) {
$bestlink=bestlink($lpage, $link);
@@ -556,14 +564,15 @@ sub htmllink ($$$;@) { #{{{
}
return "$linktext"
- if length $bestlink && $page eq $bestlink;
+ if length $bestlink && $page eq $bestlink &&
+ ! defined $opts{anchor};
if (! $destsources{$bestlink}) {
$bestlink=htmlpage($bestlink);
if (! $destsources{$bestlink}) {
return $linktext unless length $config{cgiurl};
- return " "create",
page => pagetitle(lc($link), 1),
@@ -826,6 +835,11 @@ sub enable_commit_hook () { #{{{
} #}}}
sub loadindex () { #{{{
+ %oldrenderedfiles=%pagectime=();
+ if (! $config{rebuild}) {
+ %pagesources=%pagemtime=%oldlinks=%links=%depends=
+ %destsources=%renderedfiles=%pagecase=();
+ }
open (my $in, "<", "$config{wikistatedir}/index") || return;
while (<$in>) {
$_=possibly_foolish_untaint($_);