8000 minor #11357 use html+twig instead of twig for some examples (OskarSt… · symfony/symfony-docs@b9fc90b · GitHub
[go: up one dir, main page]

Skip to content

Commit b9fc90b

Browse files
committed
minor #11357 use html+twig instead of twig for some examples (OskarStark)
This PR was merged into the 3.4 branch. Discussion ---------- use html+twig instead of twig for some examples <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 2f96d39 use html+twig instead of twig for some examples
2 parents c4d01b8 + 2f96d39 commit b9fc90b

11 files changed

+28
-29
lines changed

form/bootstrap4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ configuration:
6666
If you prefer to apply the Bootstrap styles on a form to form basis, include the
6767
``form_theme`` tag in the templates where those forms are used:
6868

69-
.. code-block:: twig
69+
.. code-block:: html+twig
7070

7171
{# ... #}
7272
{# this tag only applies to the forms defined in this template #}

frontend/encore/server-data.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In Symfony applications, you may find that you need to pass some dynamic data
66
dynamic configuration is by storing information in ``data`` attributes and reading
77
them later in JavaScript. For example:
88

9-
.. code-block:: twig
9+
.. code-block:: html-twig
1010
1111
<div class="js-user-rating" data-is-authenticated="{{ app.user ? 'true' : 'false' }}">
1212
<!-- ... -->
@@ -36,7 +36,7 @@ store any content. In Twig, use the ``html_attr`` escaping strategy to avoid mes
3636
with HTML attributes. For example, if your ``User`` object has some ``getProfileData()``
3737
method that returns an array, you could do the following:
3838

39-
.. code-block:: twig
39+
.. code-block:: html+twig
4040

4141
<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html_attr') }}">
4242
<!-- ... -->

frontend/encore/simple-example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Congrats! You now have three new files:
8383
Next, include these in your base layout file. Two Twig helpers from WebpackEncoreBundle
8484
can do most of the work for you:
8585

86-
.. code-block:: twig
86+
.. code-block:: html+twig
8787

8888
{# app/Resources/views/base.html.twig #}
8989
<!DOCTYPE html>

frontend/encore/split-chunks.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Twig functions from WebpackEncoreBundle, you don't need to do anything else! The
3333
functions automatically read this file and render as many ``script`` or ``link``
3434
tags as needed:
3535

36-
.. code-block:: twig
36+
.. code-block:: html+twig
3737

3838
{#
3939
May now render multiple script tags:

frontend/encore/versioning.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ an ``img`` tag) to certain assets. If you're using Symfony, just activate the
6565
That's it! Just be sure to wrap each path in the Twig ``asset()`` function
6666
like normal:
6767

68-
.. code-block:: twig
68+
.. code-block:: html+twig
6969

7070
<img src="{{ asset('build/images/logo.png') }}">
7171

quick_tour/the_view.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ One of the best features of Twig is its extensibility via tags, filters
146146
and functions. Take a look at the following sample template that uses filters
147147
extensively to modify the information before displaying it to the user:
148148

149-
.. code-block:: twig
149+
.. code-block:: html+twig
150150

151151
<h1>{{ article.title|capitalize }}</h1>
152152

@@ -170,7 +170,7 @@ create a new template fragment that can then be included from other templates.
170170
Imagine that we want to display ads on some pages of our application. First,
171171
create a ``banner.html.twig`` template:
172172

173-
.. code-block:: twig
173+
.. code-block:: html+twig
174174

175175
{# app/Resources/views/ads/banner.html.twig #}
176176
<div id="ad-banner">
@@ -256,7 +256,7 @@ Including Assets: Images, JavaScripts and Stylesheets
256256
What would the Internet be without images, JavaScripts and stylesheets?
257257
Symfony provides the ``asset()`` function to deal with them easily:
258258

259-
.. code-block:: twig
259+
.. code-block:: html+twig
260260

261261
<link href="{{ asset('css/blog.css') }}" rel="stylesheet" type="text/css"/>
262262

reference/dic_tags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Second, define a service:
178178
179179
Finally, apply the filter:
180180

181-
.. code-block:: twig
181+
.. code-block:: html+twig
182182

183183
{% javascripts
184184
'@AcmeBaseBundle/Resources/public/js/global.js'

reference/forms/twig_reference.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ This test will check if the current choice is equal to the ``selected_value``
195195
or if the current choice is in the array (when ``selected_value`` is an
196196
array).
197197

198-
.. code-block:: twig
198+
.. code-block:: html+twig
199199

200200
<option {% if choice is selectedchoice(value) %} selected="selected"{% endif %} ...>
201201

@@ -247,7 +247,7 @@ of variables. By default, these blocks live inside `form_div_layout.html.twig`_.
247247

248248
Look at the ``form_label`` as an example:
249249

250-
.. code-block:: twig
250+
.. code-block:: html+twig
251251

252252
{% block form_label %}
253253
{% if not compound %}

templating.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,11 @@ Suppose ``description`` equals ``I <3 this product``:
763763

764764
.. code-block:: twig
765765
766-
<!-- output escaping is on automatically -->
767-
{{ description }} <!-- I &lt;3 this product -->
766+
{# output escaping is on automatically #}
767+
{{ description }} {# I &lt;3 this product #}
768768
769-
<!-- disable output escaping with the raw filter -->
770-
{{ description|raw }} <!-- I <3 this product -->
769+
{# disable output escaping with the raw filter #}
770+
{{ description|raw }} {# I <3 this product #}
771771
772772
.. caution::
773773

translation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ texts* and complex expressions:
286286
that your translated message is *not* output escaped, you must apply
287287
the ``raw`` filter after the translation filter:
288288

289-
.. code-block:: twig
289+
.. code-block:: html+twig
290290

291291
{# text translated between tags is never escaped #}
292292
{% trans %}

web_link.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ Preloading Assets
2727

2828
Imagine that your application includes a web page like this:
2929

30-
.. code-block:: twig
30+
.. code-block:: html
3131

32-
{# templates/homepage.html.twig #}
3332
<!DOCTYPE html>
3433
<html>
3534
<head>
@@ -39,7 +38,7 @@ Imagine that your application includes a web page like this:
3938
</head>
4039
<body>
4140
<main role="main" class="container">
42-
{# ... some content here ... #}
41+
<!-- ... -->
4342
</main>
4443
</body>
4544
</html>
@@ -58,10 +57,10 @@ To do that, first install the WebLink component:
5857
Now, update the template to use the ``preload()`` Twig function provided by
5958
WebLink:
6059

61-
.. code-block:: twig
60+
.. code-block:: html+twig
6261

6362
<head>
64-
{# ... #}
63+
<!-- ... -->
6564
<link rel="stylesheet" href="{{ preload('/app.css') }}">
6665
</head>
6766

@@ -72,10 +71,10 @@ requested the HTML page.
7271
Additionally, according to `the Priority Hints specification`_, you can signal
7372
the priority of the resource to download using the ``importance`` attribute:
7473

75-
.. code-block:: twig
74+
.. code-block:: html+twig
7675

7776
<head>
78-
{# ... #}
77+
<!-- ... -->
7978
<link rel="stylesheet" href="{{ preload('/app.css', { importance: 'low' }) }}">
8079
</head>
8180

@@ -102,10 +101,10 @@ improve performance of your applications in production right now.
102101
If you want to prevent the push but let the browser preload the resource by
103102
issuing an early separate HTTP request, use the ``nopush`` option:
104103

105-
.. code-block:: twig
104+
.. code-block:: html+twig
106105

107106
<head>
108-
{# ... #}
107+
<!-- ... -->
109108
<link rel="stylesheet" href="{{ preload('/app.css', { nopush: true }) }}">
110109
</head>
111110

@@ -135,12 +134,12 @@ The component also supports sending HTTP links not related to performance and
135134
any link implementing the `PSR-13`_ standard. For instance, any
136135
`link defined in the HTML specification`_:
137136

138-
.. code-block:: twig
137+
.. code-block:: html+twig
139138

140139
<head>
141-
{# ... #}
140+
<!-- ... -->
142141
<link rel="alternate" href="{{ link('/index.jsonld', 'alternate') }}">
143-
<link rel="stylesheet" href="{{ preload('/app.css', {nopush: true}) }}">
142+
<link rel="stylesheet" href="{{ preload('/app.css', { nopush: true }) }}">
144143
</head>
145144

146145
The previous snippet will result in this HTTP header being sent to the client:

0 commit comments

Comments
 (0)
0