aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-01-21 15:23:25 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-01-21 15:33:20 -0500
commitee9ae0a3149f04e9373a0b7b1fece99f5cc78e9c (patch)
tree8f3165e8727430f7a2feb6e58603f691d71b2763 /IkiWiki
parent8bf2f5a31ae3569b0c1c5b139640f7e8356a90f4 (diff)
downloadikiwiki-ee9ae0a3149f04e9373a0b7b1fece99f5cc78e9c.tar
ikiwiki-ee9ae0a3149f04e9373a0b7b1fece99f5cc78e9c.tar.gz
po: avoid crash when page is empty
Note that there is an associated po4a warning when a page is empty: Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/Locale/Po4a/Text.pm line 205. I've filed a bug with po4a about that, but the important thing is fixing the crash here.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm12
1 files changed, 2 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 02fc4a89e..f8801185e 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -1057,11 +1057,8 @@ sub commit_and_refresh ($$) {
IkiWiki::saveindex();
}
-# on success, returns the filtered content.
-# on error, if $nonfatal, warn and return undef; else, error out.
-sub po_to_markup ($$;$) {
+sub po_to_markup ($$) {
my ($page, $content) = (shift, shift);
- my $nonfatal = shift;
$content = '' unless defined $content;
$content = decode_utf8(encode_utf8($content));
@@ -1084,10 +1081,6 @@ sub po_to_markup ($$;$) {
my $fail = sub ($) {
my $msg = "po(po_to_markup) - $page : " . shift;
- if ($nonfatal) {
- warn $msg;
- return undef;
- }
error($msg, sub { unlink $infile, $outfile});
};
@@ -1108,8 +1101,7 @@ sub po_to_markup ($$;$) {
$doc->write($outfile)
or return $fail->(sprintf(gettext("failed to write %s"), $outfile));
- $content = readfile($outfile)
- or return $fail->(sprintf(gettext("failed to read %s"), $outfile));
+ $content = readfile($outfile);
# Unlinking should happen automatically, thanks to File::Temp,
# but it does not work here, probably because of the way writefile()