]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/inline.pm
note about will_render and preview
[git.ikiwiki.info.git] / IkiWiki / Plugin / inline.pm
index 53b051816740db8a2448ac76c04192e887843eb1..ae3f8f409d81d9ba65bc680b60f0cb167a1ecc5c 100644 (file)
@@ -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);
@@ -226,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};
@@ -278,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},
@@ -286,7 +292,7 @@ sub preprocess_inline (@) { #{{{
                        $toping{$params{destpage}}=1 unless $config{rebuild};
                        $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
                }
-               if ($atom) {
+               if ($atom && ! $params{preview}) {
                        my $atomp=atompage($params{destpage}).$feednum;
                        will_render($params{destpage}, $atomp);
                        writefile($atomp, $config{destdir},