Open xiyoulaoyuanjia opened 11 years ago
demo
jinja2 convert int to string ?
Jinja2 also defines the ~ operator, which automatically converts arguments to string first, as an alternative to the + operator.
Example:
{% set p = year ~ '/' ~ month ~ '/' ~ day ~ '/' ~ post.slug %}
how can i test jinja2 template in console ?
here is an example:
import jinja2 t = jinja2.Template("{% for i in items[:3] %}{{ i }}\n{% endfor %}") items = range(10) print(t.render(items=items)) 0 1 2
about 评论系统
这里采用 disqus 第三方评论系统。。。 关于其它的第三方 评论系统可以考虑看这篇文章
demo
jinja2 convert int to string ?
Jinja2 also defines the ~ operator, which automatically converts arguments to string first, as an alternative to the + operator.
Example:
{% set p = year ~ '/' ~ month ~ '/' ~ day ~ '/' ~ post.slug %}
how can i test jinja2 template in console ?
here is an example:
about 评论系统
这里采用 disqus 第三方评论系统。。。 关于其它的第三方 评论系统可以考虑看这篇文章