Skip to content

Commit 57c2d4b

Browse files
committed
Use Twig highlighter instead of Jinja
1 parent 31686aa commit 57c2d4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+235
-235
lines changed

best_practices/configuration.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ from places with access to the Symfony container.
128128
Constants can be used for example in your Twig templates thanks to the
129129
`constant() function`_:
130130

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

133133
<p>
134134
Displaying the {{ constant('NUM_ITEMS', post) }} most recent results.

best_practices/forms.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ This is also an important error, because you are mixing presentation markup
137137
always a good practice to follow, so put all the view-related things in the
138138
view layer:
139139

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

142142
{{ form_start(form) }}
143143
{{ form_widget(form) }}
@@ -157,7 +157,7 @@ One of the simplest ways - which is especially useful during development -
157157
is to render the form tags and use ``form_widget()`` to render all of the
158158
fields:
159159

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

162162
{{ form_start(form, {'attr': {'class': 'my-form-class'} }) }}
163163
{{ form_widget(form) }}

best_practices/web-assets.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ the application assets are in one location.
1616
Templates also benefit from centralizing your assets, because the links are
1717
much more concise:
1818

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

2121
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" />
2222
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
@@ -54,7 +54,7 @@ of compiling assets developed with a lot of different frontend technologies
5454
like LESS, Sass and CoffeeScript. Combining all your assets with Assetic is a
5555
matter of wrapping all the assets with a single Twig tag:
5656

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

5959
{% stylesheets
6060
'css/bootstrap.min.css'

book/controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ the following code will render the ``notice`` message:
642642

643643
.. configuration-block::
644644

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

647647
{% for flashMessage in app.session.flashbag.get('notice') %}
648648
<div class="flash-notice">

book/forms.rst

+14-14
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ helper functions:
142142

143143
.. configuration-block::
144144

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

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

449449
.. configuration-block::
450450

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

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

793793
.. configuration-block::
794794

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

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

835835
.. configuration-block::
836836

837-
.. code-block:: jinja
837+
.. code-block:: twig
838838
839839
{{ form.vars.value.task }}
840840
@@ -856,7 +856,7 @@ used the ``form_row`` helper:
856856

857857
.. configuration-block::
858858

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

861861
{{ form_start(form) }}
862862
{{ form_errors(form) }}
@@ -908,7 +908,7 @@ specify it:
908908

909909
.. configuration-block::
910910

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

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

@@ -924,7 +924,7 @@ field:
924924

925925
.. configuration-block::
926926

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

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

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

941941
.. configuration-block::
942942

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

945945
{{ form.task.vars.id }}
946946

@@ -953,7 +953,7 @@ the ``full_name`` value:
953953

954954
.. configuration-block::
955955

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

958958
{{ form.task.vars.full_name }}
959959

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

10111011
.. configuration-block::
10121012

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

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

13851385
.. configuration-block::
13861386

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

13891389
{# ... #}
13901390

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

14541454
.. configuration-block::
14551455

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

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

14831483
.. configuration-block::
14841484

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

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

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

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

book/from_flat_php_to_symfony2.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ called `Twig`_ that makes templates faster to write and easier to read.
710710
It means that the sample application could contain even less code! Take,
711711
for example, the list template written in Twig:
712712

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

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

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

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

737737
{# app/Resources/views/layout.html.twig #}
738738
<!DOCTYPE html>

book/http_cache.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
10731073

10741074
.. configuration-block::
10751075

1076-
.. code-block:: jinja
1076+
.. code-block:: twig
10771077
10781078
{# app/Resources/views/static/about.html.twig #}
10791079

book/page_creation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ a ``number.html.twig`` file inside of it:
374374

375375
.. configuration-block::
376376

377-
.. code-block:: jinja
377+
.. code-block:: twig
378378
379379
{# app/Resources/views/lucky/number.html.twig #}
380380
{% extends 'base.html.twig' %}

book/routing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ a template helper function:
14581458

14591459
.. configuration-block::
14601460

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

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

14921492
.. configuration-block::
14931493

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

14961496
<a href="{{ url('blog_show', {'slug': 'my-blog-post'}) }}">
14971497
Read this blog post.

book/security.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ the built-in helper function:
846846

847847
.. configuration-block::
848848

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

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

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

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

@@ -1016,7 +1016,7 @@ key:
10161016

10171017
.. configuration-block::
10181018

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

10211021
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
10221022
<p>Username: {{ app.user.username }}</p>

0 commit comments

Comments
 (0)