]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Render.pm
fix call to getctime
[git.ikiwiki.info.git] / IkiWiki / Render.pm
index 854d5105ebecc793e97d2c3f3a32c8ad3b3e0131..51e7a194f704f0955566fefb7311e588ff18ab78 100644 (file)
@@ -8,8 +8,8 @@ use File::Spec;
 use IkiWiki;
 
 sub linkify ($$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
 
        $content =~ s{(\\?)$config{wiki_link_regexp}}{
                $2 ? ( $1 ? "[[$2|$3]]" : htmllink($page, titlepage($3), 0, 0, pagetitle($2)))
@@ -152,8 +152,8 @@ sub globlist_merge ($$) { #{{{
 } #}}}
 
 sub genpage ($$$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
        my $mtime=shift;
 
        my $title=pagetitle(basename($page));
@@ -177,7 +177,12 @@ sub genpage ($$$) { #{{{
        if ($config{discussion}) {
                $template->param(discussionlink => htmllink($page, "Discussion", 1, 1));
        }
-       $template->param(headercontent => $config{headercontent});
+
+       if (exists $hooks{pagetemplate}) {
+               foreach my $id (keys %{$hooks{pagetemplate}}) {
+                       $hooks{pagetemplate}{$id}{call}->($page, $template);
+               }
+       }
 
        $template->param(
                title => $title,
@@ -213,8 +218,8 @@ sub mtime ($) { #{{{
 } #}}}
 
 sub findlinks ($$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
 
        my @links;
        while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
@@ -249,15 +254,15 @@ sub render ($) { #{{{
                        }
                }
                
-               $links{$page}=[findlinks($content, $page)];
+               $links{$page}=[findlinks($page, $content)];
                
-               $content=linkify($content, $page);
+               $content=linkify($page, $content);
                $content=preprocess($page, $content);
                $content=htmlize($type, $content);
                
                check_overwrite("$config{destdir}/".htmlpage($page), $page);
                writefile(htmlpage($page), $config{destdir},
-                       genpage($content, $page, mtime($srcfile)));
+                       genpage($page, $content, mtime($srcfile)));
                $oldpagemtime{$page}=time;
                $renderedfiles{$page}=htmlpage($page);
        }
@@ -342,8 +347,12 @@ sub refresh () { #{{{
                        push @add, $file;
                        $links{$page}=[];
                        $pagesources{$page}=$file;
-                       $pagectime{$page}=mtime(srcfile($file))
-                               unless exists $pagectime{$page};
+                       if ($config{getctime} && -e "$config{srcdir}/$file") {
+                               $pagectime{$page}=rcs_getctime("$config{srcdir}/$file");
+                       }
+                       elsif (! exists $pagectime{$page}) {
+                               $pagectime{$page}=mtime(srcfile($file));
+                       }
                }
        }
        my @del;