Skip to content

Commit 511d262

Browse files
Update documentation for HTML templates style
1 parent a776c17 commit 511d262

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/librustdoc/html/templates/STYLE.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@ similar to [Jinja2](jinjadoc) and [Django](djangodoc) templates, and also to [As
1010

1111
We want our rendered output to have as little unnecessary whitespace as
1212
possible, so that pages load quickly. To achieve that we use Tera's
13-
[whitespace control] features. At the end of most lines, we put an empty comment
14-
tag with the whitespace control characters: `{#- -#}`. This causes all
15-
whitespace between the end of the line and the beginning of the next, including
16-
indentation, to be omitted on render. Sometimes we want to preserve a single
17-
space. In those cases we put the space at the end of the line, followed by
18-
`{# -#}`, which is a directive to remove following whitespace but not preceding.
19-
We also use the whitespace control characters in most instances of tags with
20-
control flow, for example `{%- if foo -%}`.
13+
[whitespace control] features. By default, whitespace characters are removed
14+
around jinja tags (`{% %}` for example). At the end of most lines, we put an
15+
empty comment tag: `{# #}`. This causes all whitespace between the end of the
16+
line and the beginning of the next, including indentation, to be omitted on
17+
render. Sometimes we want to preserve a single space. In those cases we put the
18+
space at the end of the line, followed by `{#+ #}`, which is a directive to
19+
remove following whitespace but not preceding. We also use the whitespace
20+
control characters in most instances of tags with control flow, for example
21+
`{% if foo %}`.
2122

2223
[whitespace control]: https://tera.netlify.app/docs/#whitespace-control
2324

2425
We want our templates to be readable, so we use indentation and newlines
25-
liberally. We indent by four spaces after opening an HTML tag _or_ a Tera
26+
liberally. We indent by four spaces after opening an HTML tag _or_ a Jinja
2627
tag. In most cases an HTML tag should be followed by a newline, but if the
2728
tag has simple contents and fits with its close tag on a single line, the
2829
contents don't necessarily need a new line.
2930

30-
Tera templates support quite sophisticated control flow. To keep our templates
31+
Askama templates support quite sophisticated control flow. To keep our templates
3132
simple and understandable, we use only a subset: `if` and `for`. In particular
32-
we avoid [assignments in the template logic](assignments) and [Tera
33+
we avoid [assignments in the template logic](assignments) and [Askama
3334
macros](macros). This also may make things easier if we switch to a different
3435
Jinja-style template system, like Askama, in the future.
3536

36-
[assignments]: https://tera.netlify.app/docs/#assignments
37-
[macros]: https://tera.netlify.app/docs/#macros
37+
[assignments]: https://djc.github.io/askama/template_syntax.html#assignments
38+
[macros]: https://djc.github.io/askama/template_syntax.html#macros

0 commit comments

Comments
 (0)