jinja2 how to remove trailing newline

后端 未结 6 1477
轮回少年
轮回少年 2021-01-31 01:36

I\'m using jinja 2 to output a yaml file but can\'t seem to get rid of a trailing newline and the end of a for loop. Eg the below

 - request:
        path: {{ p         


        
6条回答
  •  一向
    一向 (楼主)
    2021-01-31 02:39

    For those using Flask who arrive here, these lines did the trick for me:

    app = Flask(__name__)
    app.jinja_env.lstrip_blocks = True
    app.jinja_env.trim_blocks = True
    

提交回复
热议问题