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

Melody doesn't support unassigned Twig set tag #46

Closed
iandevlin opened this issue Aug 14, 2018 · 3 comments
Closed

Melody doesn't support unassigned Twig set tag #46

iandevlin opened this issue Aug 14, 2018 · 3 comments

Comments

@iandevlin
Copy link
Contributor

Explain the problem

Twig's set tag can be used to capture chunks of text (see https://twig.symfony.com/doc/2.x/tags/set.html) but Melody throws an error.

Expected Behaviour

Melody should not throw an error, and the output between the set and endset tags should be contained within the variable name as defined within the set tag.

Actual Behaviour

Melody throws an error: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got undefined

Steps to reproduce

Define a Twig file that contains:

{% set test = 'boo' %}

{% set test %}
hi there
{% endset %}

{{ test }}
@pago
Copy link
Contributor

pago commented Aug 14, 2018

Yes. Its a limitation of how Melody works. We could support plain text or force you to use the raw filter but either way you'd be hit by a performance penalty. And things would get really messy if you were using macros, blocks, includes or loops within such a set block (I can provide more information if you're interested).

@iandevlin
Copy link
Contributor Author

A shame, but understood.

@efegurkan
Copy link
Contributor

Suggestion on the topic, We need to collect those information and document them. We are lacking of these.

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

No branches or pull requests

3 participants