Permalink
Browse files

Remove unused `escape` param from `renderInternal`

  • Loading branch information...
1 parent 05e527f commit cf76a4b8f908507e6a5e25b9ccf3e5106e69a032 @bobthecow committed Jan 26, 2013
Showing with 8 additions and 19 deletions.
  1. +5 −13 src/Mustache/Compiler.php
  2. +3 −2 src/Mustache/Template.php
  3. +0 −4 test/Mustache/Test/CompilerTest.php
@@ -126,17 +126,13 @@ class %s extends Mustache_Template
{
private $lambdaHelper;
- public function renderInternal(Mustache_Context $context, $indent = \'\', $escape = false)
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
{
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
$buffer = \'\';
%s
- if ($escape) {
- return %s;
- } else {
- return $buffer;
- }
+ return $buffer;
}
%s
}';
@@ -145,16 +141,12 @@ public function renderInternal(Mustache_Context $context, $indent = \'\', $escap
class %s extends Mustache_Template
{
- public function renderInternal(Mustache_Context $context, $indent = \'\', $escape = false)
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
{
$buffer = \'\';
%s
- if ($escape) {
- return %s;
- } else {
- return $buffer;
- }
+ return $buffer;
}
%s
}';
@@ -173,7 +165,7 @@ private function writeCode($tree, $name)
$sections = implode("\n", $this->sections);
$klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS;
- return sprintf($this->prepare($klass, 0, false), $name, $code, $this->getEscape('$buffer'), $sections);
+ return sprintf($this->prepare($klass, 0, false), $name, $code, $sections);
}
const SECTION_CALL = '
@@ -67,13 +67,14 @@ public function render($context = array())
*
* This is where the magic happens :)
*
+ * NOTE: This method is not part of the Mustache.php public API.
+ *
* @param Mustache_Context $context
* @param string $indent (default: '')
- * @param bool $escape (default: false)
*
* @return string Rendered template
*/
- abstract public function renderInternal(Mustache_Context $context, $indent = '', $escape = false);
+ abstract public function renderInternal(Mustache_Context $context, $indent = '');
/**
* Tests whether a value should be iterated over (e.g. in a section context).
@@ -33,21 +33,18 @@ public function getCompileValues()
return array(
array('', array(), 'Banana', false, 'ISO-8859-1', array(
"\nclass Banana extends Mustache_Template",
- 'return htmlspecialchars($buffer, ENT_COMPAT, \'ISO-8859-1\');',
'return $buffer;',
)),
array('', array($this->createTextToken('TEXT')), 'Monkey', false, 'UTF-8', array(
"\nclass Monkey extends Mustache_Template",
- 'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');',
'$buffer .= $indent . \'TEXT\';',
'return $buffer;',
)),
array('', array($this->createTextToken('TEXT')), 'Monkey', true, 'ISO-8859-1', array(
"\nclass Monkey extends Mustache_Template",
'$buffer .= $indent . \'TEXT\';',
- 'return call_user_func($this->mustache->getEscape(), $buffer);',
'return $buffer;',
)),
@@ -77,7 +74,6 @@ public function getCompileValues()
'$buffer .= htmlspecialchars($value, ENT_COMPAT, \'UTF-8\');',
'$value = $context->last();',
'$buffer .= \'\\\'bar\\\'\';',
- 'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');',
'return $buffer;',
)
),

0 comments on commit cf76a4b

Please sign in to comment.