diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-03-21 02:57:34 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-03-21 02:57:34 -0400 |
commit | cd6055a893287c0f6505f7ade7fb1ab61621a373 (patch) | |
tree | ab5afa09707cbf933593a1dd9e71b2d4aeba666a | |
parent | 88b5a0ece54c63129733adc2a4bb9c89df46a5f0 (diff) |
another fix
I'm suprised that the second m//g didn't seem to clobber @-, but I don't
want to rely on that, so preserve it beforehand.
-rw-r--r-- | IkiWiki/Plugin/smiley.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index fcf3048b2..124245b68 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -43,6 +43,8 @@ sub filter (@) { #{{{ MATCH: while (m{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}g) { my $escape=$1; my $smiley=$2; + my $epos=$-[1]; + my $spos=$-[2]; # Smilies are not allowed inside <pre> or <code>. # For each tag in turn, match forward to find the next <tag> @@ -60,11 +62,11 @@ MATCH: while (m{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}g) { if ($escape) { # Remove escape. - substr($_, $-[1], 1)=""; + substr($_, $epos, 1)=""; } else { # Replace the smiley with its expanded value. - substr($_, $-[2], length($smiley))= + substr($_, $spos, length($smiley))= htmllink($params{page}, $params{destpage}, $smileys{$smiley}, linktext => $smiley); } |