Updating _renderTag logic around leftover section tags.

Exceptions are now thrown by _renderSections, so anything left over by the time _renderTag executes should just be discarded.
This commit is contained in:
Justin Hileman
2010-11-26 14:05:20 -05:00
parent 730c3a36e5
commit 225a32d5bf
+6 -15
View File
@@ -475,21 +475,6 @@ class Mustache {
*/ */
protected function _renderTag($modifier, $tag_name) { protected function _renderTag($modifier, $tag_name) {
switch ($modifier) { switch ($modifier) {
case '#':
case '^':
if ($this->_throwsException(MustacheException::UNCLOSED_SECTION)) {
throw new MustacheException('Unclosed section: ' . $tag_name, MustacheException::UNCLOSED_SECTION);
} else {
return '';
}
break;
case '/':
if ($this->_throwsException(MustacheException::UNEXPECTED_CLOSE_SECTION)) {
throw new MustacheException('Unexpected close section: ' . $tag_name, MustacheException::UNEXPECTED_CLOSE_SECTION);
} else {
return '';
}
break;
case '=': case '=':
return $this->_changeDelimiter($tag_name); return $this->_changeDelimiter($tag_name);
break; break;
@@ -508,6 +493,12 @@ class Mustache {
return $this->_renderUnescaped($tag_name); return $this->_renderUnescaped($tag_name);
} }
break; break;
case '#':
case '^':
case '/':
// remove any leftovers from _renderSections
return '';
break;
} }
if ($this->_hasPragma(self::PRAGMA_UNESCAPED)) { if ($this->_hasPragma(self::PRAGMA_UNESCAPED)) {