README.rst 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. It includes:
  7. - Template inheritance and inclusion.
  8. - Define and import macros within templates.
  9. - HTML templates can use autoescaping to prevent XSS from untrusted
  10. user input.
  11. - A sandboxed environment can safely render untrusted templates.
  12. - AsyncIO support for generating templates and calling async
  13. functions.
  14. - I18N support with Babel.
  15. - Templates are compiled to optimized Python code just-in-time and
  16. cached, or can be compiled ahead-of-time.
  17. - Exceptions point to the correct line in templates to make debugging
  18. easier.
  19. - Extensible filters, tests, functions, and even syntax.
  20. Jinja's philosophy is that while application logic belongs in Python if
  21. possible, it shouldn't make the template designer's job difficult by
  22. restricting functionality too much.
  23. Installing
  24. ----------
  25. Install and update using `pip`_:
  26. .. code-block:: text
  27. $ pip install -U Jinja2
  28. .. _pip: https://pip.pypa.io/en/stable/quickstart/
  29. In A Nutshell
  30. -------------
  31. .. code-block:: jinja
  32. {% extends "base.html" %}
  33. {% block title %}Members{% endblock %}
  34. {% block content %}
  35. <ul>
  36. {% for user in users %}
  37. <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  38. {% endfor %}
  39. </ul>
  40. {% endblock %}
  41. Links
  42. -----
  43. - Website: https://palletsprojects.com/p/jinja/
  44. - Documentation: https://jinja.palletsprojects.com/
  45. - Releases: https://pypi.org/project/Jinja2/
  46. - Code: https://github.com/pallets/jinja
  47. - Issue tracker: https://github.com/pallets/jinja/issues
  48. - Test status: https://dev.azure.com/pallets/jinja/_build
  49. - Official chat: https://discord.gg/t6rrQZH