有限的WordPress短码支持Django
django-template-shortcodes的Python项目详细描述
#django模板快捷方式
这是实验性的东西。别用它。可能。
这个包提供了一些 shortcode](http://en.support.wordpress.com/shortcodes/)支持django 模板。它主要基于[agoodd版本的django shortcode](https://github.com/AGoodId/django-shortcodes)(反过来又基于https://code.google.com/p/django-shortcodes/)以及[wp export parser](https://github.com/RealGeeks/wp_export_parser),用于从wordpress中提取的regex部分。
##支持的快捷方式(种类):
- [caption caption=“foo bar”]<;img src=“alt=”/>;[/caption]
- [标题]<;img src=“”alt=“/>;foo bar[/caption]
- [youtube=https://www.youtube.com/watch?v=dqw4w9wgxcq]
- [youtube url=“https://www.youtube.com/watch?v=dqw4w9wgxcq“]
- [gmaps url=“https://www.youtube.com/watch?v=dqw4w9wgxcq“]
- [vimeo url=”https://www.vimeo.com/watch?v=dqw4w9wgxcq“]
- [iframe url=”https://www.vimeo.com/watch?v=dqw4w9wgxcq“]
##安装
通过pip安装:pip install django template快捷方式 或者克隆[git存储库](https://github.com/emilbjorklund/django-shortcodes)。
##用法
分析快捷方式:
{% load shortcodes_filters %} {{ text|shortcodes|safe }}
删除快捷方式(完全删除,包括内部内容):
{% load shortcodes_filters %} {{ text|removeshortcodes|safe }}