X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9f1cd89bc2f33b1783bc300bc5eaebe4abcf393c..0f95adbd1d33e267b9654c80ef2d38ca06407ecb:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 3d1458081..796cf2cf6 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -14,7 +14,7 @@ my %page_numfeeds; sub import { #{{{ hook(type => "getopt", id => "inline", call => \&getopt); hook(type => "checkconfig", id => "inline", call => \&checkconfig); - hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi); + hook(type => "sessioncgi", id => "inline", call => \&sessioncgi); hook(type => "preprocess", id => "inline", call => \&IkiWiki::preprocess_inline); hook(type => "pagetemplate", id => "inline", @@ -152,25 +152,34 @@ sub preprocess_inline (@) { #{{{ # that if they are removed or otherwise changed, the inline will be # sure to be updated. add_depends($params{page}, join(" or ", @list)); - + # Force a scan of this page so any metadata that appears after this + # inline directive is available when inlining. The page normally + # wouldn't be scanned if it's only being rebuilt because of a + # depedency. + IkiWiki::scan($pagesources{$params{page}}); + my $feednum=""; - my $feedid=join(",", map { "$_=$params{$_}" } sort keys %params); + my $feedid=join("\0", map { $_."\0".$params{$_} } sort keys %params); if (exists $knownfeeds{$feedid}) { $feednum=$knownfeeds{$feedid}; } else { if (exists $page_numfeeds{$params{destpage}}) { - $feednum=$knownfeeds{$feedid}=++$page_numfeeds{$params{destpage}}; + if ($feeds) { + $feednum=$knownfeeds{$feedid}=++$page_numfeeds{$params{destpage}}; + } } else { $feednum=$knownfeeds{$feedid}=""; - $page_numfeeds{$params{destpage}}=1; + if ($feeds) { + $page_numfeeds{$params{destpage}}=1; + } } } - my $rssurl=basename(rsspage($params{destpage}).$feednum); - my $atomurl=basename(atompage($params{destpage}).$feednum); + my $rssurl=basename(rsspage($params{destpage}).$feednum) if $feeds && $rss; + my $atomurl=basename(atompage($params{destpage}).$feednum) if $feeds && $atom; my $ret=""; if ($config{cgiurl} && (exists $params{rootpage} || @@ -221,7 +230,9 @@ 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})); + $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat})); + $template->param(first => 1) if $page eq $list[0]; + $template->param(last => 1) if $page eq $list[$#list]; if ($actions) { my $file = $pagesources{$page};