protected static function rawblock(&$token, &$context)
{
$inner = $token[Token::POS_INNERTAG];
trim($inner);
// skip parse when inside raw block
if ($context['rawblock'] && !($token[Token::POS_BEGINRAW] === '{{' && $token[Token::POS_OP] === '/' && $context['rawblock'] === $inner)) {
return true;
}
$token[Token::POS_INNERTAG] = $inner;
// Handle raw block
if ($token[Token::POS_BEGINRAW] === '{{') {
if ($token[Token::POS_ENDRAW] !== '}}') {
$context['error'][] = 'Bad token ' . Token::toString($token) . ' ! Do you mean ' . Token::toString($token, array(Token::POS_ENDRAW => '}}')) . ' ?';
}
if ($context['rawblock']) {
Parser::setDelimiter($context);
$context['rawblock'] = false;
} else {
if ($token[Token::POS_OP]) {
$context['error'][] = "Wrong raw block begin with " . Token::toString($token) . ' ! Remove "' . $token[Token::POS_OP] . '" to fix this issue.';
}
$context['rawblock'] = $token[Token::POS_INNERTAG];
Parser::setDelimiter($context);
$token[Token::POS_OP] = '#';
}
$token[Token::POS_ENDRAW] = '}}';
}
}