Commit 8700c90
committed
bug #859 [TwigComponent] Fixing bug where traditional blocks aren't handled correctly (weaverryan)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[TwigComponent] Fixing bug where traditional blocks aren't handled correctly
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Tickets | Fixes part of #844 (comment)
| License | MIT
Using `{% block traditional_block %}` inside of a `<twig:Component` syntax should now work. However, even though I tried to make the TwigPreLexer a bit more intelligent than just a regex parser, it's reaching its limits of complexity. Even this fix will break down if the user adds extra whitespace - e.g. `{% block traditional_block %}`. It's likely that `TwigPreLexer` will need to be converted to an actual Lexer -> token stream -> parser type of a system. On the bright side, that would make it easier to integrate into Twig core if we ever chose to do that (the parser wouldn't convert over directly, but the lexer & tokens in theory would).
Cheers!
Commits
-------
2ca9430 [TwigComponent] Fixing bug where traditional blocks aren't handled correctlyFile tree
2 files changed
+40
-3
lines changed- src/TwigComponent
- src/Twig
- tests/Unit
2 files changed
+40
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
66 | 77 | | |
67 | 78 | | |
68 | 79 | | |
| |||
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
122 | | - | |
| 133 | + | |
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
| |||
128 | 139 | | |
129 | 140 | | |
130 | 141 | | |
| 142 | + | |
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
134 | 146 | | |
135 | 147 | | |
| 148 | + | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
| |||
374 | 387 | | |
375 | 388 | | |
376 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
377 | 400 | | |
378 | 401 | | |
379 | 402 | | |
380 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
381 | 408 | | |
382 | 409 | | |
383 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
0 commit comments