jinja

The Jinja2 template engine

Github星跟踪图

Jinja

Jinja is a fast, expressive, extensible templating engine. Special
placeholders in the template allow writing code similar to Python
syntax. Then the template is passed data to render the final document.

It includes:

  • Template inheritance and inclusion.
  • Define and import macros within templates.
  • HTML templates can use autoescaping to prevent XSS from untrusted
    user input.
  • A sandboxed environment can safely render untrusted templates.
  • AsyncIO support for generating templates and calling async
    functions.
  • I18N support with Babel.
  • Templates are compiled to optimized Python code just-in-time and
    cached, or can be compiled ahead-of-time.
  • Exceptions point to the correct line in templates to make debugging
    easier.
  • Extensible filters, tests, functions, and even syntax.

Jinja's philosophy is that while application logic belongs in Python if
possible, it shouldn't make the template designer's job difficult by
restricting functionality too much.

Installing

Install and update using pip_:

.. code-block:: text

$ pip install -U Jinja2

.. _pip: https://pip.pypa.io/en/stable/quickstart/

In A Nutshell

.. code-block:: jinja

{% extends "base.html" %}
{% block title %}Members{% endblock %}
{% block content %}
  <ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
  </ul>
{% endblock %}

主要指标

概览
名称与所有者pallets/jinja
主编程语言Python
编程语言Python (语言数: 3)
平台
许可证BSD 3-Clause "New" or "Revised" License
所有者活动
创建于2010-10-17 13:41:17
推送于2025-03-05 20:15:47
最后一次提交
发布数55
最新版本名称3.1.6 (发布于 2025-03-05 11:59:41)
第一版名称2.0rc1 (发布于 )
用户参与
星数10.8k
关注者数252
派生数1.6k
提交数2.9k
已启用问题?
问题数1053
打开的问题数63
拉请求数637
打开的拉请求数18
关闭的拉请求数298
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?