跳转到主要内容

pybtex的docutils后端。

项目描述

概述

pybtex docutils后端允许将BibTeX引用插入到由docutils生成的文档中。

安装

与Sphinx一起使用,只需安装sphinxcontrib-bibtex

与纯docutils一起使用,使用pip install pybtex_docutils安装模块,或使用源代码使用pip install -e .

最小示例

与Sphinx一起使用,请参阅sphinxcontrib-bibtex文档。

与纯docutils一起使用,该模块公开了一个新的simplebibliography指令,该指令将为指定的bib文件中的每个条目生成引用。这个新指令仅适用于简单的单个文档工作流程,不需要Sphinx的全部功能。您需要在文档中确切地使用这些指令之一,放置在您希望引用出现的位置(通常是结尾)。

例如

See  [Nelson1987]_ for an introduction to non-standard analysis.

.. simplebibliography:: refs.bib

其中 refs.bib 可能包含

@Book{Nelson1987,
  author = {Edward Nelson},
  title = {Radically Elementary Probability Theory},
  publisher = {Princeton University Press},
  year = {1987}
}

注意,引用键用作标签。为了使其正常工作,因此需要确保你的 bib 文件中所有键都是 docutils 的有效引用标签。特别是,它们不能包含冒号。在 sphinxcontrib-bibtex 中取消了这个限制,它还提供了许多更多的引用功能。

要使用此指令,你必须编写自己的命令脚本(目前似乎没有其他方法可以扩展 docutils)。例如

#!/usr/bin/env python3
from docutils.parsers.rst import directives, Directive
from docutils.core import publish_cmdline, default_description

from pybtex_docutils import SimpleBibliography

description = ('Like rst2html5.py, but with .. simplebibliography support'
               + default_description)

if __name__ == '__main__':
    directives.register_directive("simplebibliography", SimpleBibliography)
    publish_cmdline(writer_name='html5', description=description)

然后你可以像运行 rst2html5 一样运行这个命令。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分发

pybtex-docutils-1.0.3.tar.gz (18.3 kB 查看哈希值)

上传时间

构建分发

pybtex_docutils-1.0.3-py3-none-any.whl (6.4 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面