【发布时间】:2016-08-25 16:50:42
【问题描述】:
我有两个项目 A 和 B,项目 A 的文档针对不同的版本托管,因此文档 url 的格式为
http://example.org/A/1.0.0/+d/index.html
http://example.org/A/1.0.1/+d/index.html
http://example.org/A/1.2.3/+d/index.html
项目 B 取决于 A 的特定版本。在 B 的文档中,我想留下一个指向 A 文档的链接,如下所示:
“另见A's documentation (v 1.0.1)”
这是否可以将版本变量传递给 URL?我尝试使用rst_prolog:
conf.py:
rst_prolog = '''
.. |a-ver| replace:: {ver}
'''.format(
ver=meta.__a_dep_version__,
)
index.rst:
A's version: |a-ver| # this produces the correct output
See also `framework docs <http://example.com/A/|a-ver|/index.html>`_.
但在构建文档后获取 URL https://example.com/A/%7Ca-ver%7C/+d/index.html。
【问题讨论】:
标签: python-sphinx substitution restructuredtext