Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwigComponent] Fixing bug where traditional blocks aren't handled correctly #859

Merged
merged 1 commit into from May 12, 2023

Conversation

weaverryan
Copy link
Member

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!

@weaverryan weaverryan force-pushed the twig-block-fix-traditional-block branch from 5b4cb88 to 2ca9430 Compare May 12, 2023 18:13
@weaverryan weaverryan merged commit 8700c90 into symfony:2.x May 12, 2023
@weaverryan
Copy link
Member Author

As I mentioned, this isn't the most robust code, but the test suite is passing. So let's merge and see if any edge-cases spring up.

@weaverryan weaverryan deleted the twig-block-fix-traditional-block branch May 12, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant