diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-05-02 13:02:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-05-02 13:02:07 -0400 |
commit | b2dea99417ebfee3d448ab6b49ca58cb2780258d (patch) | |
tree | 2ef858a5bd85d9fb500554933c002eb805e43d94 /IkiWiki.pm | |
parent | 9fca7f2f8b64f4caded4a0099cef1f4d152dabee (diff) |
Fix ugly display when editing a page that has vanished.
srcfile now has an optional second parameter to avoid it throwing an error
if the source file does not exist.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 3802559a5..f5cf8ba96 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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; } #}}} |