X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/c4f3d0554a02eba93d94d4c0914f4afddf85274b..be8521ec16e8aa9bfe3d3fd13537c5189aa110ed:/IkiWiki/Plugin/smiley.pm?ds=inline diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 1697a37c1..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; @@ -87,10 +94,10 @@ MATCH: while (m{(?:^|(?<=\s|>))(\\?)$smiley_regexp(?:(?=\s|<)|$)}g) { } else { # Replace the smiley with its expanded value. - substr($_, $spos, length($smiley))= - htmllink($params{page}, $params{destpage}, + my $link=htmllink($params{page}, $params{destpage}, $smileys{$smiley}, linktext => $smiley); - pos=$epos+1; + substr($_, $spos, length($smiley))=$link; + pos=$epos+length($link); } }