diff --git a/best_practices/configuration.rst b/best_practices/configuration.rst index 160e707048f..7f4d99c204d 100644 --- a/best_practices/configuration.rst +++ b/best_practices/configuration.rst @@ -128,7 +128,7 @@ from places with access to the Symfony container. Constants can be used for example in your Twig templates thanks to the `constant() function`_: -.. code-block:: html+jinja +.. code-block:: html+twig
Displaying the {{ constant('NUM_ITEMS', post) }} most recent results. diff --git a/best_practices/forms.rst b/best_practices/forms.rst index 1c0bd9ba61f..b9343145a88 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -137,7 +137,7 @@ This is also an important error, because you are mixing presentation markup always a good practice to follow, so put all the view-related things in the view layer: -.. code-block:: html+jinja +.. code-block:: html+twig {{ form_start(form) }} {{ form_widget(form) }} @@ -157,7 +157,7 @@ One of the simplest ways - which is especially useful during development - is to render the form tags and use ``form_widget()`` to render all of the fields: -.. code-block:: html+jinja +.. code-block:: html+twig {{ form_start(form, {'attr': {'class': 'my-form-class'} }) }} {{ form_widget(form) }} diff --git a/best_practices/web-assets.rst b/best_practices/web-assets.rst index dd66ce8e2f6..a4160d62e2e 100644 --- a/best_practices/web-assets.rst +++ b/best_practices/web-assets.rst @@ -16,7 +16,7 @@ the application assets are in one location. Templates also benefit from centralizing your assets, because the links are much more concise: -.. code-block:: html+jinja +.. code-block:: html+twig @@ -54,7 +54,7 @@ of compiling assets developed with a lot of different frontend technologies like LESS, Sass and CoffeeScript. Combining all your assets with Assetic is a matter of wrapping all the assets with a single Twig tag: -.. code-block:: html+jinja +.. code-block:: html+twig {% stylesheets 'css/bootstrap.min.css' diff --git a/book/controller.rst b/book/controller.rst index 1d15b914d7b..a092c5a3fd9 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -642,7 +642,7 @@ the following code will render the ``notice`` message: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig {% for flashMessage in app.session.flashbag.get('notice') %}
Username: {{ app.user.username }}
diff --git a/book/templating.rst b/book/templating.rst index 832192aad7e..7a4098269c6 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -57,7 +57,7 @@ But Symfony packages an even more powerful templating language called `Twig`_. Twig allows you to write concise, readable templates that are more friendly to web designers and, in several ways, more powerful than PHP templates: -.. code-block:: html+jinja +.. code-block:: html+twig @@ -94,7 +94,7 @@ Twig also contains **filters**, which modify content before being rendered. The following makes the ``title`` variable all uppercase before rendering it: -.. code-block:: jinja +.. code-block:: twig {{ title|upper }} @@ -111,7 +111,7 @@ and new functions can be easily added. For example, the following uses a standard ``for`` tag and the ``cycle`` function to print ten div tags, with alternating ``odd``, ``even`` classes: -.. code-block:: html+jinja +.. code-block:: html+twig {% for i in 0..10 %}Username: {{ app.user.username }}
{% if app.debug %} @@ -1374,7 +1374,7 @@ covered: functionality would have a template called ``blog/layout.html.twig`` that contains only blog section-specific elements; - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/blog/layout.html.twig #} {% extends 'base.html.twig' %} @@ -1389,7 +1389,7 @@ covered: section template. For example, the "index" page would be called something close to ``blog/index.html.twig`` and list the actual blog posts. - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/blog/index.html.twig #} {% extends 'blog/layout.html.twig' %} @@ -1426,7 +1426,7 @@ this classic example: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig Hello {{ name }} @@ -1479,7 +1479,7 @@ HTML code. By default, Twig will escape the article body. To render it normally, add the ``raw`` filter: -.. code-block:: jinja +.. code-block:: twig {{ article.body|raw }} @@ -1520,7 +1520,7 @@ extension. Template parameters can then be dumped using the ``dump`` function: -.. code-block:: html+jinja +.. code-block:: html+twig {# app/Resources/views/article/recent_list.html.twig #} {{ dump(articles) }} @@ -1591,7 +1591,7 @@ key in the parameter hash: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig PDF Version diff --git a/book/translation.rst b/book/translation.rst index 554c8c8ba72..bb972c256bf 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -230,7 +230,7 @@ Twig Templates Symfony provides specialized Twig tags (``trans`` and ``transchoice``) to help with message translation of *static blocks of text*: -.. code-block:: jinja +.. code-block:: twig {% trans %}Hello %name%{% endtrans %} @@ -254,7 +254,7 @@ works when you use a placeholder following the ``%var%`` pattern. You can also specify the message domain and pass some additional variables: -.. code-block:: jinja +.. code-block:: twig {% trans with {'%name%': 'Fabien'} from "app" %}Hello %name%{% endtrans %} @@ -269,7 +269,7 @@ You can also specify the message domain and pass some additional variables: The ``trans`` and ``transchoice`` filters can be used to translate *variable texts* and complex expressions: -.. code-block:: jinja +.. code-block:: twig {{ message|trans }} @@ -287,7 +287,7 @@ texts* and complex expressions: that your translated message is *not* output escaped, you must apply the ``raw`` filter after the translation filter: - .. code-block:: jinja + .. code-block:: twig {# text translated between tags is never escaped #} {% trans %} @@ -304,7 +304,7 @@ texts* and complex expressions: You can set the translation domain for an entire Twig template with a single tag: - .. code-block:: jinja + .. code-block:: twig {% trans_default_domain "app" %} diff --git a/book/validation.rst b/book/validation.rst index b9b3f276f33..9da5549dfb3 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -175,7 +175,7 @@ Inside the template, you can output the list of errors exactly as needed: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/author/validation.html.twig #}