一个简单的django应用程序,在模板中包含引文和参考列表。
django-citations的Python项目详细描述
引文是一个简单的django应用程序,允许您使用引文和 模板中的引用列表。
- The source code is available from https://github.com/will-hart/django-citations under an MIT license.
- You can find the package on the Python Packing Index https://pypi.python.org/pypi/django-citations/.
- The latest documentation for the develop branch is available from http://django-citations.readthedocs.org/en/latest/
快速启动
安装时使用:
pip install django-citations
将“引文”添加到已安装的应用程序设置中,如下所示:
INSTALLED_APPS = ( ... 'citations', )
运行python manage.py migrate以创建模型。
用法
您可以使用“管理”面板为站点创建引用。这些罐头 包含一系列详细信息,包括ISBN、URL、标题等。每个参考 一定有独特的子弹。这就是我们在 在模板中引用它。
要引用数据库中的引用,首先需要在 您的模板:
{% load citation_tags %}
然后可以在模板中执行以下操作 出现:
{% cite "my_reference_slug" %}
一次可以引用多个引用,只需添加由空格分隔的新段塞。 请注意,slug周围需要引号,slug名称不应包含 空格:
{% cite "my_first_reference_slug" "my_second_reference_slug" %}
如果试图引用不在引用列表中的工作,则会出现模板语法错误 将显示出有问题的引用段塞。
参考文献将以数字的形式包含在文本中,例如[1],或[1,2]表示多个 参考文献。引用对象也将放在 模板的上下文。
参考列表可以包含在文档底部:
{% show_references reference_list %}
导入引用
如果您安装了程序包bibtexparser,那么您将可以在管理 面板到“上传bibtex”按钮。此功能将上载bibtex文件,扫描 django引用支持并保存新记录的字段。
bibtexparser包在lgpl下提供。
更改日志
- 0.3版
- 改进的文档
- 向数据库中添加新字段
- 添加bibtex上载功能,其中安装了bibtexparser
- 添加show_all_references标记以获得完整的书目
- 0.2.1版
- 修复自述文件中的标记
0.2版
- Improved citation database - more fields available
- Improved reference output (uses a Harvard referencing format)
1.0版
- Initial version