README.rst 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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/getting-started/
  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. Donate
  42. ------
  43. The Pallets organization develops and supports Jinja and other popular
  44. packages. In order to grow the community of contributors and users, and
  45. allow the maintainers to devote more time to the projects, `please
  46. donate today`_.
  47. .. _please donate today: https://palletsprojects.com/donate
  48. Links
  49. -----
  50. - Documentation: https://jinja.palletsprojects.com/
  51. - Changes: https://jinja.palletsprojects.com/changes/
  52. - PyPI Releases: https://pypi.org/project/Jinja2/
  53. - Source Code: https://github.com/pallets/jinja/
  54. - Issue Tracker: https://github.com/pallets/jinja/issues/
  55. - Website: https://palletsprojects.com/p/jinja/
  56. - Twitter: https://twitter.com/PalletsTeam
  57. - Chat: https://discord.gg/pallets