X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/99261148fe12255b5825a4d07d754424ee876c78..80d16f80bf2e6a4edbef91d0f055e812537823d5:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 0c1df8b47..eb003a1fb 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 @@ -498,13 +498,16 @@ 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 ($) { #{{{ @@ -538,6 +541,7 @@ sub htmllink ($$$;@) { #{{{ my $page=shift; # the page that will contain the link (different for inline) my $link=shift; my %opts=@_; + $link=~s/\/$//; my $bestlink; if (! $opts{forcesubpage}) { @@ -563,7 +567,7 @@ sub htmllink ($$$;@) { #{{{ if (! $destsources{$bestlink}) { return $linktext unless length $config{cgiurl}; - return " "create", page => pagetitle(lc($link), 1), @@ -588,6 +592,9 @@ sub htmllink ($$$;@) { #{{{ if (defined $opts{rel}) { push @attrs, ' rel="'.$opts{rel}.'"'; } + if (defined $opts{class}) { + push @attrs, ' class="'.$opts{class}.'"'; + } return "$linktext"; } #}}} @@ -823,6 +830,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($_); @@ -903,7 +915,7 @@ sub template_params (@) { #{{{ my @ret=( filter => sub { my $text_ref = shift; - ${$text_ref} = Encode::decode_utf8(${$text_ref}); + ${$text_ref} = decode_utf8(${$text_ref}); }, filename => $filename, loop_context_vars => 1, @@ -1220,7 +1232,7 @@ sub match_link ($$;@) { #{{{ if $bestlink eq IkiWiki::bestlink($page, $p); } else { - return IkiWiki::SuccessReason->new("$page links to page matching $link") + return IkiWiki::SuccessReason->new("$page links to page $p matching $link") if match_glob($p, $link, %params); } }