File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ public function preLexComponents(string $input): string
37
37
$ output = '' ;
38
38
39
39
while ($ this ->position < $ this ->length ) {
40
+ // ignore content inside verbatim block #947
41
+ if ($ this ->consume ('{% verbatim %} ' )) {
42
+ $ output .= '{% verbatim %} ' ;
43
+ $ output .= $ this ->consumeUntil ('{% endverbatim %} ' );
44
+ $ this ->consume ('{% endverbatim %} ' );
45
+ $ output .= '{% endverbatim %} ' ;
46
+
47
+ if ($ this ->position === $ this ->length ) {
48
+ break ;
49
+ }
50
+ }
51
+
40
52
// ignore content inside twig comments, see #838
41
53
if ($ this ->consume ('{# ' )) {
42
54
$ output .= '{# ' ;
Original file line number Diff line number Diff line change @@ -206,5 +206,10 @@ public function getLexTests(): iterable
206
206
'<twig:Alert/> {# <twig:Alert/> #} ' ,
207
207
'{{ component( \'Alert \') }} {# <twig:Alert/> #} ' ,
208
208
];
209
+
210
+ yield 'ignore_content_of_verbatim_block ' => [
211
+ '{% verbatim %}<twig:Alert/>{% endverbatim %} ' ,
212
+ '{% verbatim %}<twig:Alert/>{% endverbatim %} ' ,
213
+ ];
209
214
}
210
215
}
You can’t perform that action at this time.
0 commit comments