Skip to content

Commit

Permalink
Item12285: Don't escape the whole string
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@16188 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Dec 10, 2012
1 parent 4599281 commit dfb1366
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/lib/Foswiki/Macros/MAKETEXT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ sub MAKETEXT {
# unescape parameters and calculate highest parameter number:
$str =~ s/~\[(\_(\d+))~\]/_validate($1, $2, \$max, \$min, \$param_error)/ge;
$str =~
s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ _validate($1, $2, \$max, \$min, \$param_error)/ge;
s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ _validate($1, $2, \$max, \$min, \$param_error, $escape)/ge;
return $str if ($param_error);

# Escape any escapes.
$str =~ s#\\#\\\\#g if $escape;

# get the args to be interpolated.
my $argsStr = $params->{args} || "";

Expand Down Expand Up @@ -78,7 +75,18 @@ sub _validate {
return
"<span class=\"foswikiAlert\">Invalid parameter <code>\"$_[0]\"</code>, MAKETEXT rejected.</span>";
}
return "[$_[0]]"; # Return the complete bracket parameter without escapes

if ( $_[5] ) {

# Escape any escapes.
my $str = $_[0]; # copy to allow modification
$str =~ s#\\#\\\\#g; # escape any escapes
return "[$str]";
}
else {
return
"[$_[0]]"; # Return the complete bracket parameter without escapes
}
}

1;
Expand Down

0 comments on commit dfb1366

Please sign in to comment.