jinja2 template as variable code example
Example 1: jinja inheritance
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block head %}
{{ super() }}
<style type="text/css">
.important { color: #336699; }
</style>
{% endblock %}
{% block content %}
<h1>Index</h1>
<p class="important">
Welcome to my awesome homepage.
</p>
{% endblock %}
Example 2: jinja if
{% if 'priority' in data %}
<p>Priority: {{ data['priority'] }}</p>
{% endif %}