diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-07-18 20:56:36 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-07-23 11:19:55 +0200 |
| commit | 8d40b9ea6c253b58fcc28af5eaaf55d44b6ee165 (patch) | |
| tree | e4579900be59498ee9dd1e2085184c0fd68f0505 /src/librustdoc/html/templates | |
| parent | 49649bf3c5538531ade6834b9b308a6c8a5f3e8e (diff) | |
Replace askama with rinja
Diffstat (limited to 'src/librustdoc/html/templates')
| -rw-r--r-- | src/librustdoc/html/templates/STYLE.md | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/librustdoc/html/templates/STYLE.md b/src/librustdoc/html/templates/STYLE.md index 38aac2a60e9..32bacb11475 100644 --- a/src/librustdoc/html/templates/STYLE.md +++ b/src/librustdoc/html/templates/STYLE.md @@ -1,15 +1,13 @@ # Style for Templates -This directory has templates in the [Tera templating language][teradoc], which is very -similar to [Jinja2][jinjadoc] and [Django][djangodoc] templates, and also to [Askama][askamadoc]. +This directory has templates in the [Rinja templating language][rinjadoc], which is very +similar to [Jinja2][jinjadoc]. -[teradoc]: https://tera.netlify.app/docs/#templates [jinjadoc]: https://jinja.palletsprojects.com/en/3.1.x/templates/ -[djangodoc]: https://docs.djangoproject.com/en/4.1/topics/templates/ -[askamadoc]: https://docs.rs/askama/latest/askama/ +[rinjadoc]: https://docs.rs/rinja/latest/rinja/ We want our rendered output to have as little unnecessary whitespace as -possible, so that pages load quickly. To achieve that we use Tera's +possible, so that pages load quickly. To achieve that we use Rinja's [whitespace control] features. By default, whitespace characters are removed around jinja tags (`{% %}` for example). At the end of most lines, we put an empty comment tag: `{# #}`. This causes all whitespace between the end of the @@ -20,7 +18,7 @@ remove following whitespace but not preceding. We also use the whitespace control characters in most instances of tags with control flow, for example `{% if foo %}`. -[whitespace control]: https://tera.netlify.app/docs/#whitespace-control +[whitespace control]: https://rinja.readthedocs.io/en/stable/configuration.html#whitespace-control We want our templates to be readable, so we use indentation and newlines liberally. We indent by four spaces after opening an HTML tag _or_ a Jinja @@ -28,11 +26,11 @@ tag. In most cases an HTML tag should be followed by a newline, but if the tag has simple contents and fits with its close tag on a single line, the contents don't necessarily need a new line. -Askama templates support quite sophisticated control flow. To keep our templates +Rinja templates support quite sophisticated control flow. To keep our templates simple and understandable, we use only a subset: `if` and `for`. In particular -we avoid [assignments in the template logic][assignments] and [Askama +we avoid [assignments in the template logic][assignments] and [Rinja macros][macros]. This also may make things easier if we switch to a different Jinja-style template system in the future. -[assignments]: https://djc.github.io/askama/template_syntax.html#assignments -[macros]: https://djc.github.io/askama/template_syntax.html#macros +[assignments]: https://rinja.readthedocs.io/en/stable/template_syntax.html#assignments +[macros]: https://rinja.readthedocs.io/en/stable/template_syntax.html#macros |
