X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/723a10b5b16d87f118bea4c6afaa8d5f60ba5947..57567f41680b80799037cc47c60a09c9a9e0e724:/IkiWiki/Plugin/inline.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index b28ad27a8..ae3f8f409 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", @@ -95,7 +95,6 @@ sub preprocess_inline (@) { #{{{ my $atom=($config{atom} && exists $params{atom}) ? yesno($params{atom}) : $config{atom}; my $quick=exists $params{quick} ? yesno($params{quick}) : 0; my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick; - $feeds=0 if $params{preview}; my $feedonly=yesno($params{feedonly}); if (! exists $params{show} && ! $archive) { $params{show}=10; @@ -152,7 +151,12 @@ 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("\0", map { $_."\0".$params{$_} } sort keys %params); @@ -173,10 +177,8 @@ sub preprocess_inline (@) { #{{{ } } - if ($feeds) { - 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} || @@ -228,6 +230,8 @@ 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(first => 1) if $page eq $list[0]; + $template->param(last => 1) if $page eq $list[$#list]; if ($actions) { my $file = $pagesources{$page}; @@ -280,7 +284,7 @@ sub preprocess_inline (@) { #{{{ @list=grep { pagespec_match($_, $params{feedpages}, location => $params{page}) } @list; } - if ($rss) { + if ($rss && ! $params{preview}) { my $rssp=rsspage($params{destpage}).$feednum; will_render($params{destpage}, $rssp); writefile($rssp, $config{destdir}, @@ -288,7 +292,7 @@ sub preprocess_inline (@) { #{{{ $toping{$params{destpage}}=1 unless $config{rebuild}; $feedlinks{$params{destpage}}=qq{}; } - if ($atom) { + if ($atom && ! $params{preview}) { my $atomp=atompage($params{destpage}).$feednum; will_render($params{destpage}, $atomp); writefile($atomp, $config{destdir},