diff options
author | Joey Hess <joey@kitenet.net> | 2007-12-12 14:43:35 -0500 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2007-12-12 14:43:35 -0500 |
commit | 849f65a3437391562b88fef9c450d0931676342f (patch) | |
tree | 524a7730d4ef6d79f3e1bddb97264ed24f8aee22 /IkiWiki | |
parent | c06643a43555ba9d2a24b1177c2c9f68cf994432 (diff) | |
download | ikiwiki-849f65a3437391562b88fef9c450d0931676342f.tar ikiwiki-849f65a3437391562b88fef9c450d0931676342f.tar.gz |
* Avoid unnecessary stat calls to get mtime when rendering pages, use
cached value.
* Preserve input file modification times in output files.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Render.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index e4ff2b39b..047ab8212 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -64,10 +64,9 @@ sub parentlinks ($) { #{{{ return @ret; } #}}} -sub genpage ($$$) { #{{{ +sub genpage ($$) { #{{{ my $page=shift; my $content=shift; - my $mtime=shift; my $templatefile; run_hooks(templatefile => sub { @@ -129,7 +128,7 @@ sub genpage ($$$) { #{{{ content => $content, backlinks => $backlinks, more_backlinks => $more_backlinks, - mtime => displaytime($mtime), + mtime => displaytime($pagemtime{$page}), baseurl => baseurl($page), ); @@ -204,8 +203,9 @@ sub render ($) { #{{{ filter($page, $page, readfile($srcfile))))); - writefile(htmlpage($page), $config{destdir}, - genpage($page, $content, mtime($srcfile))); + my $output=htmlpage($page); + writefile($output, $config{destdir}, genpage($page, $content)); + utime($pagemtime{$page}, $pagemtime{$page}, $config{destdir}."/".$output); } else { my $srcfd=readfile($srcfile, 1, 1); @@ -231,6 +231,7 @@ sub render ($) { #{{{ } } }); + utime($pagemtime{$file}, $pagemtime{$file}, $config{destdir}."/".$file); } } #}}} @@ -485,8 +486,9 @@ sub commandline_render () { #{{{ $content=preprocess($page, $page, $content); $content=linkify($page, $page, $content); $content=htmlize($page, $type, $content); + $pagemtime{$page}=mtime($srcfile); - print genpage($page, $content, mtime($srcfile)); + print genpage($page, $content); exit 0; } #}}} |