X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/f888ceafee5aef67824c808667d6f2df02286968..aed42eb34ac50912a995dee41ce7dd6e3c3b7f81:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 02c9cbdc0..7fe5a4dcf 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -114,12 +114,12 @@ sub format (@) { #{{{ return $params{content}; } #}}} -sub sessioncgi () { #{{{ +sub sessioncgi ($$) { #{{{ my $q=shift; my $session=shift; if ($q->param('do') eq 'blog') { - my $page=IkiWiki::titlepage(decode_utf8($q->param('title'))); + my $page=titlepage(decode_utf8($q->param('title'))); $page=~s/(\/)/"__".ord($1)."__"/eg; # don't create subdirs # if the page already exists, munge it to be unique my $from=$q->param('from'); @@ -201,7 +201,7 @@ sub preprocess_inline (@) { #{{{ @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; } else { - return sprintf(gettext("unknown sort type %s"), $params{sort}); + error sprintf(gettext("unknown sort type %s"), $params{sort}); } if (yesno($params{reverse})) { @@ -263,8 +263,17 @@ sub preprocess_inline (@) { #{{{ # Add a blog post form, with feed buttons. my $formtemplate=template("blogpost.tmpl", blind_cache => 1); $formtemplate->param(cgiurl => $config{cgiurl}); - $formtemplate->param(rootpage => - exists $params{rootpage} ? $params{rootpage} : $params{page}); + my $rootpage; + if (exists $params{rootpage}) { + $rootpage=bestlink($params{page}, $params{rootpage}); + if (!length $rootpage) { + $rootpage=$params{rootpage}; + } + } + else { + $rootpage=$params{page}; + } + $formtemplate->param(rootpage => $rootpage); $formtemplate->param(rssurl => $rssurl) if $feeds && $rss; $formtemplate->param(atomurl => $atomurl) if $feeds && $atom; if (exists $params{postformtext}) { @@ -289,7 +298,7 @@ sub preprocess_inline (@) { #{{{ require HTML::Template; my @params=IkiWiki::template_params($params{template}.".tmpl", blind_cache => 1); if (! @params) { - return sprintf(gettext("nonexistant template %s"), $params{template}); + error sprintf(gettext("nonexistant template %s"), $params{template}); } my $template=HTML::Template->new(@params) unless $raw; @@ -307,6 +316,7 @@ sub preprocess_inline (@) { #{{{ $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(title => pagetitle(basename($page))); $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat})); + $template->param(mtime => displaytime($pagemtime{$page}, $params{timeformat})); $template->param(first => 1) if $page eq $list[0]; $template->param(last => 1) if $page eq $list[$#list]; @@ -366,7 +376,7 @@ sub preprocess_inline (@) { #{{{ genfeed("rss", $config{url}."/".$rssp, $desc, $params{guid}, $params{destpage}, @feedlist)); $toping{$params{destpage}}=1 unless $config{rebuild}; - $feedlinks{$params{destpage}}=qq{}; + $feedlinks{$params{destpage}}.=qq{}; } } if ($atom) { @@ -376,7 +386,7 @@ sub preprocess_inline (@) { #{{{ writefile($atomp, $config{destdir}, genfeed("atom", $config{url}."/".$atomp, $desc, $params{guid}, $params{destpage}, @feedlist)); $toping{$params{destpage}}=1 unless $config{rebuild}; - $feedlinks{$params{destpage}}=qq{}; + $feedlinks{$params{destpage}}.=qq{}; } } }