1. Jinja2 模版引擎
1.variable 占位符。字典、列表、对象方法均可。
{{ mydict['key'] }} {{ mylist[3] }} {{ mylist[myintvar] }} {{ myobj.somemethod() }}
2.variable 能被filters修饰。
safe 取消自动转义
capitalize 首字母大写其余小写
lower 所有字母小写
upper 全部大写
title 每个单词大写
trim 前后空白去掉
striptags 移除所有HTML tags
tojson This function converts the given object into JSON representation。 记得safe下
更多filters,参见:http://jinja.pocoo.org/docs/templates/?highlight=filters#list-of-builtin-filters。
关于json的处理,参见:AJAX with Jquery。
3. if, for, macro, include, extends, super()
2. Flask-Bootstrap
Bootstrap的Flask插件,集成了。用的时候再看吧,现在不要分散精力。前端的事情交由冷咖处理。
3. Flask-Moment
momentjs的Flask扩展,处理国际化时间的本地化利器。考虑到武汉高校之恋的受众基本在武汉,就不要多载入js浪费流量了吧~