Jinja2 correctly indent included block

前端 未结 3 1644
深忆病人
深忆病人 2021-02-02 07:35

I have two files:

base.html



    
       
       

        
3条回答
  •  北海茫月
    2021-02-02 07:53

    I know, the question is rather old but I found a nice solution to this problem. You can apply filters to whole text blocks: Template Designer Documentation / Filters

    {% filter indent(width=4) %}
    {% include "./sub-template.yml.j2" %}
    {% endfilter %}
    

提交回复
热议问题