我把网站底部文件作为一个宏文件,底部需要实现 Copyright © 2022 字样 ,2022是动态生成的,我试图引入time库,但是提示错误,请问该怎么布局代码呢?
{% macro foot( page_title ='' ) %}
{% import time %}
<footer class="bg-dark text-light p-5">
<div class="container">
<p class="lead">Copyright © {{ time.strftime("%Y", time.localtime()) }}</p>
</div>
</footer>
</body>
</html>
{% endmacro %}
报错:
jinja2.exceptions.TemplateSyntaxError
jinja2.exceptions.TemplateSyntaxError: expected token 'as', got 'end of statement block'