Debian Codegraph @

README.md

raw
1 # Jinja
2
3 Jinja is a fast, expressive, extensible templating engine. Special
4 placeholders in the template allow writing code similar to Python
5 syntax. Then the template is passed data to render the final document.
6
7 It includes:
8
9 - Template inheritance and inclusion.
10 - Define and import macros within templates.
11 - HTML templates can use autoescaping to prevent XSS from untrusted
12 user input.
13 - A sandboxed environment can safely render untrusted templates.
14 - AsyncIO support for generating templates and calling async
15 functions.
16 - I18N support with Babel.
17 - Templates are compiled to optimized Python code just-in-time and
18 cached, or can be compiled ahead-of-time.
19 - Exceptions point to the correct line in templates to make debugging
20 easier.
21 - Extensible filters, tests, functions, and even syntax.
22
23 Jinja's philosophy is that while application logic belongs in Python if
24 possible, it shouldn't make the template designer's job difficult by
25 restricting functionality too much.
26
27
28 ## In A Nutshell
29
30 ```jinja
31 {% extends "base.html" %}
32 {% block title %}Members{% endblock %}
33 {% block content %}
34 <ul>
35 {% for user in users %}
36 <li><a href="{{ user.url }}">{{ user.username }}</a></li>
37 {% endfor %}
38 </ul>
39 {% endblock %}
40 ```
41
42 ## Donate
43
44 The Pallets organization develops and supports Jinja and other popular
45 packages. In order to grow the community of contributors and users, and
46 allow the maintainers to devote more time to the projects, [please
47 donate today][].
48
49 [please donate today]: https://palletsprojects.com/donate
50
51 ## Contributing
52
53 See our [detailed contributing documentation][contrib] for many ways to
54 contribute, including reporting issues, requesting features, asking or answering
55 questions, and making PRs.
56
57 [contrib]: https://palletsprojects.com/contributing/