On Monday, 13 June 2016 04:33:09 UTC+3, 项楠 wrote:
I'm looking for something similar to the directive `{% extends "base.html" %}` in Jinja2 template engine. I've read the docs of
tt2, but `block`,`process`, `include` and `wrapper` are all seems not to be for template inheritance.
I don't mean to hijack this thread, but everything you describe is supported in lua-resty-template:
https://github.com/bungle/lua-resty-template
Syntax os a bit different though:
1.
{% extends "layout2.html" %}
=>
{% layout = "layout2.html" %}
2.
{% block nav %}<div class="nav"></div>{% endblock %}
=>
{-nav-}<div class="nav"></div>{-nav-}
3.
{% block nav %} {% endblock %}
=>
{* blocks.nav *}
etc.