|
@@ -151,7 +151,7 @@ class Mustache_Tokenizer
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
|
if ($this->tagChange($this->ctag, $this->ctagLen, $text, $i)) {
|
|
if ($this->tagChange($this->ctag, $this->ctagLen, $text, $i)) {
|
|
|
- $this->tokens[] = array(
|
|
|
|
|
|
|
+ $token = array(
|
|
|
self::TYPE => $this->tagType,
|
|
self::TYPE => $this->tagType,
|
|
|
self::NAME => trim($this->buffer),
|
|
self::NAME => trim($this->buffer),
|
|
|
self::OTAG => $this->otag,
|
|
self::OTAG => $this->otag,
|
|
@@ -160,20 +160,31 @@ class Mustache_Tokenizer
|
|
|
self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen
|
|
self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- $this->buffer = '';
|
|
|
|
|
- $i += $this->ctagLen - 1;
|
|
|
|
|
- $this->state = self::IN_TEXT;
|
|
|
|
|
if ($this->tagType === self::T_UNESCAPED) {
|
|
if ($this->tagType === self::T_UNESCAPED) {
|
|
|
|
|
+ // Clean up `{{{ tripleStache }}}` style tokens.
|
|
|
if ($this->ctag === '}}') {
|
|
if ($this->ctag === '}}') {
|
|
|
- $i++;
|
|
|
|
|
|
|
+ if (($i < $len + 1) && $text[$i+2] == '}') {
|
|
|
|
|
+ $i++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $msg = sprintf(
|
|
|
|
|
+ 'Uneven closing tag encountered: on line %d',
|
|
|
|
|
+ $token[Mustache_Tokenizer::LINE]
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ throw new Mustache_Exception_SyntaxException($msg, $token);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- // Clean up `{{{ tripleStache }}}` style tokens.
|
|
|
|
|
- $lastName = $this->tokens[count($this->tokens) - 1][self::NAME];
|
|
|
|
|
|
|
+ $lastName = $token[self::NAME];
|
|
|
if (substr($lastName, -1) === '}') {
|
|
if (substr($lastName, -1) === '}') {
|
|
|
- $this->tokens[count($this->tokens) - 1][self::NAME] = trim(substr($lastName, 0, -1));
|
|
|
|
|
|
|
+ $token[self::NAME] = trim(substr($lastName, 0, -1));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ $this->buffer = '';
|
|
|
|
|
+ $i += $this->ctagLen - 1;
|
|
|
|
|
+ $this->state = self::IN_TEXT;
|
|
|
|
|
+ $this->tokens[] = $token;
|
|
|
} else {
|
|
} else {
|
|
|
$this->buffer .= $text[$i];
|
|
$this->buffer .= $text[$i];
|
|
|
}
|
|
}
|