Browse Source

Remove unused `escape` param from `renderInternal`

Justin Hileman 13 years ago
parent
commit
cf76a4b8f9
3 changed files 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

+ 5 - 13
src/Mustache/Compiler.php

@@ -126,17 +126,13 @@ class Mustache_Compiler
         {
         {
             private $lambdaHelper;
             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);
                 $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
                 $buffer = \'\';
                 $buffer = \'\';
         %s
         %s
 
 
-                if ($escape) {
-                    return %s;
-                } else {
-                    return $buffer;
-                }
+                return $buffer;
             }
             }
         %s
         %s
         }';
         }';
@@ -145,16 +141,12 @@ class Mustache_Compiler
 
 
         class %s extends Mustache_Template
         class %s extends Mustache_Template
         {
         {
-            public function renderInternal(Mustache_Context $context, $indent = \'\', $escape = false)
+            public function renderInternal(Mustache_Context $context, $indent = \'\')
             {
             {
                 $buffer = \'\';
                 $buffer = \'\';
         %s
         %s
 
 
-                if ($escape) {
-                    return %s;
-                } else {
-                    return $buffer;
-                }
+                return $buffer;
             }
             }
         %s
         %s
         }';
         }';
@@ -173,7 +165,7 @@ class Mustache_Compiler
         $sections = implode("\n", $this->sections);
         $sections = implode("\n", $this->sections);
         $klass    = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS;
         $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 = '
     const SECTION_CALL = '

+ 3 - 2
src/Mustache/Template.php

@@ -67,13 +67,14 @@ abstract class Mustache_Template
      *
      *
      * This is where the magic happens :)
      * This is where the magic happens :)
      *
      *
+     * NOTE: This method is not part of the Mustache.php public API.
+     *
      * @param Mustache_Context $context
      * @param Mustache_Context $context
      * @param string           $indent  (default: '')
      * @param string           $indent  (default: '')
-     * @param bool             $escape  (default: false)
      *
      *
      * @return string Rendered template
      * @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).
      * Tests whether a value should be iterated over (e.g. in a section context).

+ 0 - 4
test/Mustache/Test/CompilerTest.php

@@ -33,13 +33,11 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
         return array(
         return array(
             array('', array(), 'Banana', false, 'ISO-8859-1', array(
             array('', array(), 'Banana', false, 'ISO-8859-1', array(
                 "\nclass Banana extends Mustache_Template",
                 "\nclass Banana extends Mustache_Template",
-                'return htmlspecialchars($buffer, ENT_COMPAT, \'ISO-8859-1\');',
                 'return $buffer;',
                 'return $buffer;',
             )),
             )),
 
 
             array('', array($this->createTextToken('TEXT')), 'Monkey', false, 'UTF-8', array(
             array('', array($this->createTextToken('TEXT')), 'Monkey', false, 'UTF-8', array(
                 "\nclass Monkey extends Mustache_Template",
                 "\nclass Monkey extends Mustache_Template",
-                'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');',
                 '$buffer .= $indent . \'TEXT\';',
                 '$buffer .= $indent . \'TEXT\';',
                 'return $buffer;',
                 'return $buffer;',
             )),
             )),
@@ -47,7 +45,6 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
             array('', array($this->createTextToken('TEXT')), 'Monkey', true, 'ISO-8859-1', array(
             array('', array($this->createTextToken('TEXT')), 'Monkey', true, 'ISO-8859-1', array(
                 "\nclass Monkey extends Mustache_Template",
                 "\nclass Monkey extends Mustache_Template",
                 '$buffer .= $indent . \'TEXT\';',
                 '$buffer .= $indent . \'TEXT\';',
-                'return call_user_func($this->mustache->getEscape(), $buffer);',
                 'return $buffer;',
                 'return $buffer;',
             )),
             )),
 
 
@@ -77,7 +74,6 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
                     '$buffer .= htmlspecialchars($value, ENT_COMPAT, \'UTF-8\');',
                     '$buffer .= htmlspecialchars($value, ENT_COMPAT, \'UTF-8\');',
                     '$value = $context->last();',
                     '$value = $context->last();',
                     '$buffer .= \'\\\'bar\\\'\';',
                     '$buffer .= \'\\\'bar\\\'\';',
-                    'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');',
                     'return $buffer;',
                     'return $buffer;',
                 )
                 )
             ),
             ),