-sub setup () { #{{{
- my $list=IkiWiki::readfile(IkiWiki::srcfile("smileys.mdwn"));
- while ($list =~ m/^\s*\*\s+\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) {
- $smileys{$1}=$2;
+sub getsetup () {
+ return
+ plugin => {
+ safe => 1,
+ # force a rebuild because turning it off
+ # removes the smileys, which would break links
+ rebuild => 1,
+ },
+}
+
+sub build_regexp () {
+ 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;
+
+ $smileys{$smiley}=$file;
+
+ # Add a version with < and > escaped, since they probably
+ # will be (by markdown) by the time the sanitize hook runs.
+ $smiley=~s/</</g;
+ $smiley=~s/>/>/g;
+ $smileys{$smiley}=$file;