问题
Is it possible to get line of source code for each line of rendered template?
For example if we have template like below:
some_expr
{% if true %}
other_expr
{% endif %}
So, after template rendering following text is produced:
some_expr
other_expr
I want to get information that 'some_expr' is produced from 1st line of template source code, and 'other_expr' if produced from 3rd line. Even better if I can get file name and line from which rendered line is produced (in case of including other templates).
If it is possible with some other template engine (not necessary python) it is also a good solution for me.
来源:https://stackoverflow.com/questions/33823159/jinja-get-line-of-source-code-after-template-rendering