]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Render.pm
bugfix
[git.ikiwiki.info.git] / IkiWiki / Render.pm
index f81e373b73ad37dcdfc988f0f08a08eb2122012d..233d093eda602387902cfade75573ee62760a3ed 100644 (file)
@@ -232,7 +232,7 @@ sub render ($$) {
                        linkify($page, $page,
                        preprocess($page, $page,
                        filter($page, $page,
-                       readfile($srcfile)))));
+                       readfile($srcfile), 'fullpage'))));
                
                my $output=htmlpage($page);
                writefile($output, $config{destdir}, genpage($page, $content));
@@ -335,21 +335,22 @@ sub find_src_files () {
                }
        };
 
-       chdir($config{srcdir}) || die "chdir: $!";
+       chdir($config{srcdir}) || die "chdir $config{srcdir}: $!";
        find({
                no_chdir => 1,
                wanted => $helper,
        }, '.');
-       chdir($origdir) || die "chdir: $!";
+       chdir($origdir) || die "chdir $origdir: $!";
 
        $underlay=1;
        foreach (@{$config{underlaydirs}}, $config{underlaydir}) {
-               chdir($_) || die "chdir: $!";
-               find({
-                       no_chdir => 1,
-                       wanted => $helper,
-               }, '.');
-               chdir($origdir) || die "chdir: $!";
+               if (chdir($_)) {
+                       find({
+                               no_chdir => 1,
+                               wanted => $helper,
+                       }, '.');
+                       chdir($origdir) || die "chdir: $!";
+               }
        };
 
        return \@files, \%pages;
@@ -364,6 +365,35 @@ sub find_new_files ($) {
 
        foreach my $file (@$files) {
                my $page=pagename($file);
+
+               if ($config{rcs} && $config{gettime} &&
+                   -e "$config{srcdir}/$file") {
+                       if (! $times_noted) {
+                               debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs}));
+                               $times_noted=1;
+                       }
+
+                       eval {
+                               my $ctime=rcs_getctime($file);
+                               if ($ctime > 0) {
+                                       $pagectime{$page}=$ctime;
+                               }
+                       };
+                       if ($@) {
+                               print STDERR $@;
+                       }
+                       my $mtime;
+                       eval {
+                               $mtime=rcs_getmtime($file);
+                       };
+                       if ($@) {
+                               print STDERR $@;
+                       }
+                       elsif ($mtime > 0) {
+                               utime($mtime, $mtime, "$config{srcdir}/$file");
+                       }
+               }
+
                if (exists $pagesources{$page} && $pagesources{$page} ne $file) {
                        # the page has changed its type
                        $forcerebuild{$page}=1;
@@ -373,34 +403,8 @@ sub find_new_files ($) {
                        if (isinternal($page)) {
                                push @internal_new, $file;
                        }
-                       elsif ($config{rcs}) {
+                       else {
                                push @new, $file;
-                               if ($config{gettime} && -e "$config{srcdir}/$file") {
-                                       if (! $times_noted) {
-                                               debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs}));
-                                               $times_noted=1;
-                                       }
-
-                                       eval {
-                                               my $ctime=rcs_getctime("$config{srcdir}/$file");
-                                               if ($ctime > 0) {
-                                                       $pagectime{$page}=$ctime;
-                                               }
-                                       };
-                                       if ($@) {
-                                               print STDERR $@;
-                                       }
-                                       my $mtime;
-                                       eval {
-                                               $mtime=rcs_getmtime("$config{srcdir}/$file");
-                                       };
-                                       if ($@) {
-                                               print STDERR $@;
-                                       }
-                                       elsif ($mtime > 0) {
-                                               utime($mtime, $mtime, "$config{srcdir}/$file");
-                                       }
-                               }
                        }
                        $pagecase{lc $page}=$page;
                        if (! exists $pagectime{$page}) {
@@ -833,7 +837,7 @@ sub commandline_render () {
        my $content=readfile($srcfile);
        my $page=pagename($file);
        $pagesources{$page}=$file;
-       $content=filter($page, $page, $content);
+       $content=filter($page, $page, $content, 'fullpage');
        $content=preprocess($page, $page, $content);
        $content=linkify($page, $page, $content);
        $content=htmlize($page, $page, $type, $content);