X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/3945473f8a0284066c8751940299fa9153efd0a7..7e661e1ed3a64728fe31bb9be9aed4d34e2aec21:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 7a189cc8b..d64f4e688 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -141,6 +141,10 @@ sub checkconfig () { #{{{ require IkiWiki::Rcs::Stub; } + if (exists $config{umask}) { + umask(possibly_foolish_untaint($config{umask})); + } + run_hooks(checkconfig => sub { shift->() }); return 1; @@ -407,6 +411,7 @@ sub bestlink ($$) { #{{{ # absolute links $cwd=""; } + $link=~s/\/$//; do { my $l=$cwd; @@ -498,19 +503,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 +549,8 @@ sub htmllink ($$$;@) { #{{{ my $link=shift; my %opts=@_; + $link=~s/\/$//; + my $bestlink; if (! $opts{forcesubpage}) { $bestlink=bestlink($lpage, $link); @@ -556,14 +568,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),