Skip to content

Commit

Permalink
Fixed issue Remove escape character (\) from any field evaluated by EM.
Browse files Browse the repository at this point in the history
Dev only applies to escaped curly braces
  • Loading branch information
TMSWhite committed Aug 14, 2012
1 parent 4426331 commit d8d9215
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions classes/expressions/ExpressionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ public function sProcessStringContainingExpressions($src, $questionNum=0, $numRe
$errors = array_merge($errors, $this->RDP_errs);
}
$this->prettyPrintSource = $prettyPrint; // ensure that if doing recursive substition, can get original source to pretty print
$result = str_replace(array('\{', '\}',), array('{', '}'), $result);
$this->RDP_errs = $errors;
return $result;
}
Expand Down Expand Up @@ -2414,6 +2415,8 @@ static function UnitTestStringSplitter()
What about an { expression nested {within a string} that has white space after the opening brace}?
This {expression has {a nested curly brace { plus ones with whitespace around them} - they should be properly captured} into an expression with sub-expressions.
This {is a string {since it does not close } all of its curly} braces.
This uses \{escaped curly braces\} which should generate output showing curly braces without the escapes
This uses a double curly brace syntax, like that used for \{\{placeholders\}\} and Yii \{\{tables\}\}
Can {expressions contain 'single' or "double" quoted strings}?
Can an expression contain a perl regular expression like this {'/^\d{3}-\d{2}-\d{4}$/'}?
[img src="images/mine_{Q1}.png"/]
Expand Down
1 change: 1 addition & 0 deletions classes/expressions/LimeExpressionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6882,6 +6882,7 @@ static function UnitTestProcessStringContainingExpressions()
);

$tests = <<<EOD
<b>This example shows escaping of the curly braces</b><br/>\{\{test\}\} {if(1==1,'{{test}}', '1 is not 1?')} should not throw any errors.
<b>Here is an example of OK syntax with tooltips</b><br/>Hello {if(gender=='M','Mr.','Mrs.')} {surname}, it is now {date('g:i a',time())}. Do you know where your {sum(numPets,numKids)} chidren and pets are?
<b>Here are common errors so you can see the tooltips</b><br/>Variables used before they are declared: {notSetYet}<br/>Unknown Function: {iff(numPets>numKids,1,2)}<br/>Unknown Variable: {sum(age,num_pets,numKids)}<br/>Wrong # parameters: {sprintf()},{if(1,2)},{date()}<br/>Assign read-only-vars:{TOKEN:ATTRIBUTE_1+=10},{name='Sally'}<br/>Unbalanced parentheses: {pow(3,4},{(pow(3,4)},{pow(3,4))}
<b>Here is some of the unsupported syntax</b><br/>No support for '++', '--', '%',';': {min(++age, --age,age % 2);}<br/>Nor '|', '&', '^': {(sum(2 | 3,3 & 4,5 ^ 6)}}<br/>Nor arrays: {name[2], name['mine']}
Expand Down

0 comments on commit d8d9215

Please sign in to comment.