=====================
call.html
=====================
{% macro render_dialog(title, class='dialog')-%}
<div class = "{{ class }}">
<h2>{{title}}</h2>
<div class = "contents">
{{caller()}}
</div>
</div>
{%- endmacro %}
{% call render_dialog('Call Blocl') %}
call block과 매크로 동시 사용
{% endcall%}
===========
execution.py
===========
from jinja2 import Environment, FileSystemLoader
file_loader = FileSystemLoader('templates')
env = Environment(loader=file_loader)
template = env.get_template("call.html")
template.render()
print(template.render())
==============================
실행결과
==============================
'Python > Flask' 카테고리의 다른 글
Python : Flask: jinja2 :특수문자,줄바꿈지우기 (2) | 2020.06.21 |
---|---|
python : include 및 super 코드 (0) | 2020.06.17 |
Flask 학습자료 source code1 : 부스트트랩을 이용한 메뉴바 (0) | 2020.05.29 |