From: Giuseppe Bilotta Date: Fri, 13 Aug 2010 09:21:11 +0000 (+0200) Subject: smiley: warn instead of error for missing smileys X-Git-Tag: 3.20100831~80 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/df5de5b967a1e6e14161fd1269efe5b17d33eec1 smiley: warn instead of error for missing smileys A missing smileys.mdwn caused the plugin to error out interrupting the building process. Instead, we check for the file presence and warn without erroring out in case it's missing, in a similar fashion as it's currently done for the shortcut plugin. --- diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 0d77916d0..6f4f49d18 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -25,7 +25,14 @@ sub getsetup () { } sub build_regexp () { - my $list=readfile(srcfile("smileys.mdwn")); + my $srcfile = srcfile("smileys.mdwn", 1); + if (! defined $srcfile) { + print STDERR sprintf(gettext("smiley plugin will not work without %s"), + "smileys.mdwn")."\n"; + $smiley_regexp=''; + return; + } + my $list=readfile($srcfile); while ($list =~ m/^\s*\*\s+\\\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) { my $smiley=$1; my $file=$2;