]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
linkify
[ikiwiki.git] / IkiWiki.pm
index 68047b9b94c9c187122fd3a5b61fb25c57c03c75..f5cf8ba96bbc8d61a6e801d9058e13955e5108c6 100644 (file)
@@ -282,14 +282,15 @@ sub htmlpage ($) { #{{{
        return targetpage($page, $config{htmlext});
 } #}}}
 
-sub srcfile ($) { #{{{
+sub srcfile ($;$) { #{{{
        my $file=shift;
+       my $nothrow=shift;
 
        return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
        foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
                return "$dir/$file" if -e "$dir/$file";
        }
-       error("internal error: $file cannot be found in $config{srcdir} or underlay");
+       error("internal error: $file cannot be found in $config{srcdir} or underlay") unless $nothrow;
        return;
 } #}}}
 
@@ -1247,6 +1248,10 @@ sub pagespec_translate ($) { #{{{
                }
        }
 
+       if (! length $code) {
+               $code=0;
+       }
+
        return eval 'sub { my $page=shift; '.$code.' }';
 } #}}}