Skip to content

Use Twig highlighter instead of Jinja #5859

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

Merged
merged 2 commits into from
Nov 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion best_practices/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

<p>
Displaying the {{ constant('NUM_ITEMS', post) }} most recent results.
Expand Down
4 changes: 2 additions & 2 deletions best_practices/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand All @@ -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) }}
Expand Down
4 changes: 2 additions & 2 deletions best_practices/web-assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" />
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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') %}
<div class="flash-notice">
Expand Down
28 changes: 14 additions & 14 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ helper functions:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form_start(form) }}
Expand Down Expand Up @@ -448,7 +448,7 @@ corresponding errors printed out with the form.

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form(form, {'attr': {'novalidate': 'novalidate'}}) }}
Expand Down Expand Up @@ -792,7 +792,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form_start(form) }}
Expand Down Expand Up @@ -834,7 +834,7 @@ output can be customized on many different levels.

.. configuration-block::

.. code-block:: jinja
.. code-block:: twig

{{ form.vars.value.task }}

Expand All @@ -856,7 +856,7 @@ used the ``form_row`` helper:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{{ form_start(form) }}
{{ form_errors(form) }}
Expand Down Expand Up @@ -908,7 +908,7 @@ specify it:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{{ form_label(form.task, 'Task Description') }}

Expand All @@ -924,7 +924,7 @@ field:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{{ form_widget(form.task, {'attr': {'class': 'task_field'}}) }}

Expand All @@ -940,7 +940,7 @@ to get the ``id``:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{{ form.task.vars.id }}

Expand All @@ -953,7 +953,7 @@ the ``full_name`` value:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{{ form.task.vars.full_name }}

Expand Down Expand Up @@ -1010,7 +1010,7 @@ to the ``form()`` or the ``form_start()`` helper:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form_start(form, {'action': path('target_route'), 'method': 'GET'}) }}
Expand Down Expand Up @@ -1384,7 +1384,7 @@ Render the ``Category`` fields in the same way as the original ``Task`` fields:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# ... #}

Expand Down Expand Up @@ -1453,7 +1453,7 @@ do this, create a new template file that will store the new markup:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/form/fields.html.twig #}
{% block form_row %}
Expand Down Expand Up @@ -1482,7 +1482,7 @@ renders the form:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{% form_theme form 'form/fields.html.twig' %}
Expand Down Expand Up @@ -1671,7 +1671,7 @@ to define form output.
In Twig, you can also customize a form block right inside the template
where that customization is needed:

.. code-block:: html+jinja
.. code-block:: html+twig

{% extends 'base.html.twig' %}

Expand Down
4 changes: 2 additions & 2 deletions book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ called `Twig`_ that makes templates faster to write and easier to read.
It means that the sample application could contain even less code! Take,
for example, the list template written in Twig:

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/blog/list.html.twig #}
{% extends "layout.html.twig" %}
Expand All @@ -732,7 +732,7 @@ for example, the list template written in Twig:

The corresponding ``layout.html.twig`` template is also easier to write:

.. code-block:: html+jinja
.. code-block:: html+twig

{# app/Resources/views/layout.html.twig #}
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:

.. configuration-block::

.. code-block:: jinja
.. code-block:: twig

{# app/Resources/views/static/about.html.twig #}

Expand Down
2 changes: 1 addition & 1 deletion book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ a ``number.html.twig`` file inside of it:

.. configuration-block::

.. code-block:: jinja
.. code-block:: twig

{# app/Resources/views/lucky/number.html.twig #}
{% extends 'base.html.twig' %}
Expand Down
4 changes: 2 additions & 2 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ a template helper function:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

<a href="{{ path('blog_show', {'slug': 'my-blog-post'}) }}">
Read this blog post.
Expand Down Expand Up @@ -1491,7 +1491,7 @@ to ``generate()``:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

<a href="{{ url('blog_show', {'slug': 'my-blog-post'}) }}">
Read this blog post.
Expand Down
6 changes: 3 additions & 3 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ the built-in helper function:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{% if is_granted('ROLE_ADMIN') %}
<a href="...">Delete</a>
Expand All @@ -868,7 +868,7 @@ covers all URLs (as shown before in this chapter).
some internal Symfony details, to avoid broken error pages in the ``prod``
environment, wrap calls in these templates with a check for ``app.user``:

.. code-block:: html+jinja
.. code-block:: html+twig

{% if app.user and is_granted('ROLE_ADMIN') %}

Expand Down Expand Up @@ -1016,7 +1016,7 @@ key:

.. configuration-block::

.. code-block:: html+jinja
.. code-block:: html+twig

{% if is_granted('IS_AUTHENTICATED_FULLY') %}
<p>Username: {{ app.user.username }}</p>
Expand Down
Loading