Upgrade doT-php to fix the problems with bootstrap template. fix #171

This commit is contained in:
Sébastien Lucas 2014-08-27 10:02:42 +02:00
parent 7ae6041c29
commit a3b29a11a1
1 changed files with 14 additions and 11 deletions

View File

@ -40,7 +40,8 @@ class doT {
public function template ($string, $def) { public function template ($string, $def) {
$me = $this; $me = $this;
$func = preg_replace ("/'|\\\/", "\\$&", $string);
$func = $string;
// deps // deps
if (empty ($def)) { if (empty ($def)) {
@ -49,6 +50,9 @@ class doT {
$this->def = $def; $this->def = $def;
$func = $this->resolveDefs ($func); $func = $this->resolveDefs ($func);
} }
$func = preg_replace ("/'|\\\/", "\\$&", $func);
// interpolate // interpolate
$func = preg_replace_callback ("/\{\{=([\s\S]+?)\}\}/", function ($m) use ($me) { $func = preg_replace_callback ("/\{\{=([\s\S]+?)\}\}/", function ($m) use ($me) {
return "' . " . $me->handleDotNotation ($m[1]) . " . '"; return "' . " . $me->handleDotNotation ($m[1]) . " . '";
@ -87,7 +91,6 @@ class doT {
$this->functionBody = $func; $this->functionBody = $func;
//$this->functionCode = create_function ('$it', $func);
return create_function ('$it', $func); return create_function ('$it', $func);
} }