Skip to content

Commit 51741ae

Browse files
committed
Fixed issues
1 parent 21e528f commit 51741ae

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

templates.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Rendering a Template in Services
418418
Inject the ``twig`` Symfony service into your own services and use its
419419
``render()`` method. When using :doc:`service autowiring </service_container/autowiring>`
420420
you only need to add an argument in the service constructor and type-hint it with
421-
the :class:`Twig\Environment` class::
421+
the :class:`Twig\\Environment` class::
422422

423423
// src/Service/SomeService.php
424424
use Twig\Environment;
@@ -643,7 +643,7 @@ following code to display the user information is repeated in several places:
643643

644644
{# ... #}
645645
<div class="user-profile">
646-
<img src="{{ user.profileImageUrl }}" />
646+
<img src="{{ user.profileImageUrl }}"/>
647647
<p>{{ user.fullName }} - {{ user.email }}</p>
648648
</div>
649649

@@ -654,7 +654,7 @@ between full templates and template fragments).
654654
Then, remove that content from the original ``blog/index.html.twig`` template
655655
and add the following to include the template fragment:
656656

657-
.. code-block:: html+twig
657+
.. code-block:: twig
658658
659659
{# templates/blog/index.html.twig #}
660660
@@ -670,7 +670,7 @@ to rename variables. Imagine that your template stores the user information in a
670670
variable called ``blog_post.author`` instead of the ``user`` variable that the
671671
template fragment expects. Use the following to *rename* the variable:
672672

673-
.. code-block:: html+twig
673+
.. code-block:: twig
674674
675675
{# templates/blog/index.html.twig #}
676676
@@ -915,11 +915,11 @@ which have special meaning (e.g. replace ``<`` by the ``&lt;`` HTML entity).
915915
Symfony applications are safe by default because they perform automatic output
916916
escaping thanks to the :ref:`Twig autoescape option <config-twig-autoescape>`:
917917

918-
.. code-block:: twig
918+
.. code-block:: html+twig
919919

920-
Hello {{ name }}
920+
<p>Hello {{ name }}</p>
921921
{# if 'name' is '<script>alert('hello!')</script>', Twig will output this:
922-
'Hello &lt;script&gt;alert(&#39;hello!&#39;)&lt;/script&gt;' #}
922+
'<p>Hello &lt;script&gt;alert(&#39;hello!&#39;)&lt;/script&gt;</p>' #}
923923

924924
If you are rendering a variable that is trusted and contains HTML contents,
925925
use the `Twig raw filter`_ to disable the output escaping for that variable:

0 commit comments

Comments
 (0)