11# Style for Templates  
22
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 ] .
55
6- [ teradoc ] : https://tera.netlify.app/docs/#templates 
76[ 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/ 
108
119We 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
1311[ whitespace control]  features. By default, whitespace characters are removed
1412around jinja tags (` {% %} `  for example). At the end of most lines, we put an
1513empty 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
2018control characters in most instances of tags with control flow, for example
2119` {% if foo %} ` .
2220
23- [ whitespace control ] : https://tera.netlify.app/docs/ #whitespace-control 
21+ [ whitespace control ] : https://rinja.readthedocs.io/en/stable/configuration.html #whitespace-control 
2422
2523We want our templates to be readable, so we use indentation and newlines
2624liberally. We indent by four spaces after opening an HTML tag _ or_  a Jinja
2725tag. In most cases an HTML tag should be followed by a newline, but if the
2826tag has simple contents and fits with its close tag on a single line, the
2927contents don't necessarily need a new line.
3028
31- Askama  templates support quite sophisticated control flow. To keep our templates
29+ Rinja  templates support quite sophisticated control flow. To keep our templates
3230simple 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 
3432macros] [ macros ] . This also may make things easier if we switch to a different
3533Jinja-style template system in the future.
3634
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