2 package IkiWiki::Plugin::smiley;
12 hook(type => "checkconfig", id => "smiley", call => \&setup);
16 my $list=readfile(srcfile("smileys.mdwn"));
17 while ($list =~ m/^\s*\*\s+\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) {
22 debug("failed to parse any smileys, disabling plugin");
26 hook(type => "filter", id => "smiley", call => \&filter);
27 # sort and reverse so that substrings come after longer strings
28 # that contain them, in most cases.
29 $smiley_regexp='('.join('|', map { quotemeta }
30 reverse sort keys %smileys).')';
31 #debug($smiley_regexp);
37 $params{content} =~ s{(?<=\s)(\\?)$smiley_regexp(?=\s)}{
38 $1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, 0, 0, $2)
41 return $params{content};