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.
master
Giuseppe Bilotta 2010-08-13 11:21:11 +02:00 committed by Joey Hess
parent 07e27bd082
commit df5de5b967
1 changed files with 8 additions and 1 deletions

View File

@ -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;