Skip to content

Commit

Permalink
Fix broken ECODE
Browse files Browse the repository at this point in the history
  • Loading branch information
pudge committed Mar 30, 2005
1 parent 545785e commit d439009
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Slash/Utility/Data/Data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1355,23 +1355,22 @@ sub processCustomTags {
if (grep /^ECODE$/, @{$constants->{approvedtags}}) {
my $ecode = 'ecode';
my $open = qr[\n* <\s* (?:$ecode) (?: \s+ END="(\w+)")? \s*> \n*]xsio;
my $close_1 = qr[$open (.*?) \n* <\s* /\2 \s*> \n*]xsio; # if END is used
my $close_2 = qr[$open (.*?) \n* <\s* /ECODE \s*> \n*]xsio; # if END is not used
my $close_1 = qr[($open (.*?) \n* <\s* /\2 \s*> \n*)]xsio; # if END is used
my $close_2 = qr[($open (.*?) \n* <\s* /ECODE \s*> \n*)]xsio; # if END is not used

while ($str =~ m[($open)]g) {
my $len = length($1);
my $end = $2;
my $pos = pos($str) - $len;

my $newlen = 25; # length('<BLOCKQUOTE></BLOCKQUOTE>')
my $close = $end ? $close_1 : $close_2;

my $substr = substr($str, $pos);
if ($substr =~ m/^$close/si) {
my $code = strip_code($2);
$newlen += length($code);
substr($str, $pos, $newlen) = "<blockquote>$code</blockquote>";
pos($str) = $pos + $newlen;
my $len = length($1);
my $code = strip_code($3);
my $newstr = "<blockquote>$code</blockquote>";
substr($str, $pos, $len) = $newstr;
pos($str) = $pos + length($newstr);
}
}
}
Expand Down

0 comments on commit d439009

Please sign in to comment.