【发布时间】:2017-06-28 17:26:14
【问题描述】:
我有一个使用Sphinx 制作的文档项目。我通过配置键rst_epilog 使用全局变量。我的conf.py 文件包含以下内容:
rst_epilog = """
.. |MY_VERSION| replace:: 2.1.0
"""
然后,在第一页中,我使用之前定义的变量 (VERSION),如下所示:
The version of my repo is: |MY_VERSION|
.. sourcecode:: bash
git clone https://github.com/my-organization/my-repo.git
cd my-repo
git checkout |MY_VERSION|
构建文档后,在生成的 HTML 中,第一个变量被正确替换,但第二个变量没有:
显然,替换在格式化的源代码块中不起作用,这非常不方便。
是否可以解决这个问题?
PS:我也试过rst_prolog,结果相同。
【问题讨论】:
标签: python versioning python-sphinx substitution restructuredtext