-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Reference][Twig] Fix typos and formatting #3159
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
Conversation
@@ -218,8 +218,7 @@ object: | |||
|
|||
.. code-block:: html+jinja | |||
|
|||
<label for="{{ form.name.vars.id }}" | |||
class="{{ form.name.vars.required ? 'required' : '' }}"> | |||
<label for="{{ form.name.vars.id }}" class="{{ form.name.vars.required ? 'required' : '' }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't help. The syntax highlighting doesn't work because of the twig condition inside the class attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but what's wrong with the ternary operator - seems to be valid Twig syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that Pygments does not support highlighting Twig. It supports highlighting Jinja (a Python templating language).
And being written for Python devs, Jinja does not support this ternary operator. Instead, it has inline if expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this info. So either I revert this change or I fix it with an regular if
statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest keeping it as it was. This is valid Twig markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for keeping the original
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored.
[Reference][Twig] Fix typos and formatting
Thanks! |
The line numbers are missing for the Twig+HTML code block in
reference/forms/twig_reference.rst
. I hope this gets fixed by removing the line feed within the HTML tag. Please let me know if this needs to get fixed in a different way.