1
1
# Style for Templates
2
2
3
- This directory has templates in the [ Tera templating language] [ teradoc ] , which is very
4
- similar to [ Jinja2] [ jinjadoc ] and [ Django ] [ djangodoc ] templates, and also to [ Askama ] [ askamadoc ] .
3
+ This directory has templates in the [ Rinja templating language] [ rinjadoc ] , which is very
4
+ similar to [ Jinja2] [ jinjadoc ] .
5
5
6
- [ teradoc ] : https://tera.netlify.app/docs/#templates
7
6
[ jinjadoc ] : https://jinja.palletsprojects.com/en/3.1.x/templates/
8
- [ djangodoc ] : https://docs.djangoproject.com/en/4.1/topics/templates/
9
- [ askamadoc ] : https://docs.rs/askama/latest/askama/
7
+ [ rinjadoc ] : https://docs.rs/rinja/latest/rinja/
10
8
11
9
We want our rendered output to have as little unnecessary whitespace as
12
- possible, so that pages load quickly. To achieve that we use Tera 's
10
+ possible, so that pages load quickly. To achieve that we use Rinja 's
13
11
[ whitespace control] features. By default, whitespace characters are removed
14
12
around jinja tags (` {% %} ` for example). At the end of most lines, we put an
15
13
empty comment tag: ` {# #} ` . This causes all whitespace between the end of the
@@ -20,19 +18,19 @@ remove following whitespace but not preceding. We also use the whitespace
20
18
control characters in most instances of tags with control flow, for example
21
19
` {% if foo %} ` .
22
20
23
- [ whitespace control ] : https://tera.netlify.app/docs/ #whitespace-control
21
+ [ whitespace control ] : https://rinja.readthedocs.io/en/stable/configuration.html #whitespace-control
24
22
25
23
We want our templates to be readable, so we use indentation and newlines
26
24
liberally. We indent by four spaces after opening an HTML tag _ or_ a Jinja
27
25
tag. In most cases an HTML tag should be followed by a newline, but if the
28
26
tag has simple contents and fits with its close tag on a single line, the
29
27
contents don't necessarily need a new line.
30
28
31
- Askama templates support quite sophisticated control flow. To keep our templates
29
+ Rinja templates support quite sophisticated control flow. To keep our templates
32
30
simple and understandable, we use only a subset: ` if ` and ` for ` . In particular
33
- we avoid [ assignments in the template logic] [ assignments ] and [ Askama
31
+ we avoid [ assignments in the template logic] [ assignments ] and [ Rinja
34
32
macros] [ macros ] . This also may make things easier if we switch to a different
35
33
Jinja-style template system in the future.
36
34
37
- [ assignments ] : https://djc.github .io/askama /template_syntax.html#assignments
38
- [ macros ] : https://djc.github .io/askama /template_syntax.html#macros
35
+ [ assignments ] : https://rinja.readthedocs .io/en/stable /template_syntax.html#assignments
36
+ [ macros ] : https://rinja.readthedocs .io/en/stable /template_syntax.html#macros
0 commit comments