mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
removed obsolete raw tag
This commit is contained in:
+5
-5
@@ -61,10 +61,10 @@ class Twig_Lexer
|
||||
$this->regexes = array(
|
||||
'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A',
|
||||
'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A',
|
||||
'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s',
|
||||
'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:endverbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s',
|
||||
'operator' => $this->getOperatorRegex(),
|
||||
'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s',
|
||||
'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As',
|
||||
'lex_block_raw' => '/\s*verbatim\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As',
|
||||
'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As',
|
||||
'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s',
|
||||
'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A',
|
||||
@@ -175,7 +175,7 @@ class Twig_Lexer
|
||||
// raw data?
|
||||
if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) {
|
||||
$this->moveCursor($match[0]);
|
||||
$this->lexRawData($match[1]);
|
||||
$this->lexRawData();
|
||||
// {% line \d+ %}
|
||||
} elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) {
|
||||
$this->moveCursor($match[0]);
|
||||
@@ -285,9 +285,9 @@ class Twig_Lexer
|
||||
}
|
||||
}
|
||||
|
||||
protected function lexRawData($tag)
|
||||
protected function lexRawData()
|
||||
{
|
||||
if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
|
||||
if (!preg_match($this->regexes['lex_raw_data'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
|
||||
throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block', $tag), $this->lineno, $this->filename);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
"raw" tag
|
||||
--TEMPLATE--
|
||||
{% raw %}
|
||||
{{ foo }}
|
||||
{% endraw %}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
{{ foo }}
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
"raw" tag
|
||||
--TEMPLATE--
|
||||
{% raw %}
|
||||
{{ foo }}
|
||||
{% endverbatim %}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXCEPTION--
|
||||
Twig_Error_Syntax: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2
|
||||
@@ -1,56 +0,0 @@
|
||||
--TEST--
|
||||
"raw" tag
|
||||
--TEMPLATE--
|
||||
1***
|
||||
|
||||
{%- raw %}
|
||||
{{ 'bla' }}
|
||||
{% endraw %}
|
||||
|
||||
1***
|
||||
2***
|
||||
|
||||
{%- raw -%}
|
||||
{{ 'bla' }}
|
||||
{% endraw %}
|
||||
|
||||
2***
|
||||
3***
|
||||
|
||||
{%- raw -%}
|
||||
{{ 'bla' }}
|
||||
{% endraw -%}
|
||||
|
||||
3***
|
||||
4***
|
||||
|
||||
{%- raw -%}
|
||||
{{ 'bla' }}
|
||||
{%- endraw %}
|
||||
|
||||
4***
|
||||
5***
|
||||
|
||||
{%- raw -%}
|
||||
{{ 'bla' }}
|
||||
{%- endraw -%}
|
||||
|
||||
5***
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
1***
|
||||
{{ 'bla' }}
|
||||
|
||||
|
||||
1***
|
||||
2***{{ 'bla' }}
|
||||
|
||||
|
||||
2***
|
||||
3***{{ 'bla' }}
|
||||
3***
|
||||
4***{{ 'bla' }}
|
||||
|
||||
4***
|
||||
5***{{ 'bla' }}5***
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
"verbatim" tag
|
||||
--TEMPLATE--
|
||||
{% verbatim %}
|
||||
{{ foo }}
|
||||
{% endraw %}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXCEPTION--
|
||||
Twig_Error_Syntax: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2
|
||||
Reference in New Issue
Block a user