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] using verbatim
tag to pass in content causes an SyntaxError
#1786
Comments
You should use endverbatim .. is this a typo in this message ? |
Ha yes.. good catch - just a typo in the issues |
Ya, the Referencing if you were to remove everything and just have a template with: // tmp.html.twig
<twig:Code>
{% verbatim %}
{{ include('a-file') }}
{% endverbatim %}
</twig:Code> We'd still get the error |
So this is the same with embed, you'd have to use {% embed 'components/Code.html.twig' %}
{% block content %}
{% verbatim %}
AA
{% endverbatim %}
{% endblock %}
{% endembed %} So clearly something is not interpreted correctly in the lexer, but i suggest you indeed use the weird but safe option in the meantime :) // tmp.html.twig
<twig:Code>
{% block content %}
{% verbatim %}
{{ include('a-file') }}
{% endverbatim %}
{% endblock %}
</twig:Code> |
Reproducer: https://github.com/jrushlow/bug-demo-verbatim-in-twig
Stacktrace: https://github.com/jrushlow/bug-demo-verbatim-in-twig/blob/9c7e2df445193d2fa5ffd415763e57ed82d961f5/templates/base.html.twig#L70
Anonymous Component
🆗 We can render that component by
⛔ We can trigger a
Twig\Error\SyntaxError
by doing:A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?
❗ This works - but counterintuitive to how we use components
What context is the
{% block content %}
? E.g. are we creating a newcontent
block inbase.html.twig
or are we redefining the existingcontent
block that already exists in the component? Beats me... I'm still trying to sort that out..I'm not sure if this is a
twig/twig
problem or aux
problem. Logically thinking - I would expect that when I useverbatim
tags - under the hood:verbatim
is passed to the component.string
provided in thecontent
contextThoughts?
The text was updated successfully, but these errors were encountered: