-
-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ Functions | |
| ``render(path('route', {params}))`` | | | ||
| ``render(url('route', {params}))`` | | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
| ``render_esi(controller('B:C:a', {params}))`` | This will generates an ESI tag when possible or fallback to the ``render`` | | ||
| ``render_esi(controller('B:C:a', {params}))`` | This will generate an ESI tag when possible or fallback to the ``render`` | | ||
| ``render_esi(url('route', {params}))`` | behavior otherwise. For more information, see :ref:`templating-embedding-controller`. | | ||
| ``render_esi(path('route', {params}))`` | | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
|
@@ -75,28 +75,28 @@ Functions | |
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
| ``logout_path(key)`` | This will generate the relative logout URL for the given firewall | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
| ``logout_url(key)`` | Equal to ``logout_path(...)`` but this will generate an absolute url | | ||
| ``logout_url(key)`` | Equal to ``logout_path(...)`` but this will generate an absolute URL | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
| ``path(name, parameters = {})`` | Get a relative url for the given route, more information in | | ||
| ``path(name, parameters = {})`` | Get a relative URL for the given route, more information in | | ||
| | ":ref:`book-templating-pages`". | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
| ``url(name, parameters = {})`` | Equal to ``path(...)`` but it generates an absolute url | | ||
| ``url(name, parameters = {})`` | Equal to ``path(...)`` but it generates an absolute URL | | ||
+----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ||
|
||
Filters | ||
------- | ||
|
||
.. versionadded:: 2.1 | ||
The ``humanize`` filter was added in Symfony2.1 | ||
The ``humanize`` filter was added in Symfony 2.1 | ||
|
||
+---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ||
| Filter Syntax | Usage | | ||
+=================================================================================+===================================================================+ | ||
| ``text|humanize`` | Makes a technical name human readable (replaces underscores by | | ||
| | spaces and capitalizes the string) | | ||
| | spaces and capitalizes the string). | | ||
+---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ||
| ``text|trans(arguments = {}, domain = 'messages', locale = null)`` | This will translate the text into the current language, more | | ||
| | information in . | | ||
| | information in | | ||
| | :ref:`Translation Filters <book-translation-filters>`. | | ||
+---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ||
| ``text|transchoice(count, arguments = {}, domain = 'messages', locale = null)`` | This will translate the text with pluralization, more information | | ||
|
@@ -165,8 +165,8 @@ Global Variables | |
+-------------------------------------------------------+------------------------------------------------------------------------------------+ | ||
| Variable | Usage | | ||
+=======================================================+====================================================================================+ | ||
| ``app`` *Attributes*: ``app.user``, ``app.request`` | The ``app`` variable is available everywhere, and gives you quick | | ||
| ``app.session``, ``app.environment``, ``app.debug`` | access to many commonly needed objects. The ``app`` variable is | | ||
| ``app`` *Attributes*: ``app.user``, ``app.request``, | The ``app`` variable is available everywhere, and gives you quick | | ||
| ``app.session``, ``app.environment``, ``app.debug``, | access to many commonly needed objects. The ``app`` variable is | | ||
| ``app.security`` | instance of :class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables` | | ||
+-------------------------------------------------------+------------------------------------------------------------------------------------+ | ||
|
||
|
@@ -178,10 +178,10 @@ Those bundles can have other Twig extensions: | |
|
||
* **Twig Extension** includes all extensions that do not belong to the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would change this wording. There is potentially lots of interesting Twig extensions which are not in Fabien's repo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have a look at my update, hope that's okay. |
||
Twig core but can be interesting. You can read more in | ||
`the official Twig Extensions documentation`_ | ||
`the official Twig Extensions documentation`_; | ||
* **Assetic** adds the ``{% stylesheets %}``, ``{% javascripts %}`` and | ||
``{% image %}`` tags. You can read more about them in | ||
:doc:`the Assetic Documentation </cookbook/assetic/asset_management>`; | ||
:doc:`the Assetic Documentation </cookbook/assetic/asset_management>`. | ||
|
||
.. _`the official Twig Extensions documentation`: http://twig.sensiolabs.org/doc/extensions/index.html | ||
.. _`http://twig.sensiolabs.org/documentation`: http://twig.sensiolabs.org/documentation |
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.