Python sphinx URL中的斯芬克斯替换

Python sphinx URL中的斯芬克斯替换,python-sphinx,substitution,restructuredtext,Python Sphinx,Substitution,Restructuredtext,我有两个项目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文档的链接,如下所示: “另见(第1.0.1节)” 是否可以将版本变量传递到URL?我尝试使用rst\u prolog

我有两个项目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文档的链接,如下所示:

“另见(第1.0.1节)”

是否可以将版本变量传递到URL?我尝试使用
rst\u prolog

conf.py

rst_prolog=''
.. |a-ver |替换:{ver}
''。格式(
版本=元版本,
)
index.rst

A's version: |a-ver| # this produces the correct output
See also `framework docs <http://example.com/A/|a-ver|/index.html>`_.
A的版本:| A-ver |#这将生成正确的输出
另请参见“框架文档”。
但是获取URL
https://example.com/A/%7Ca-文档生成后的版本%7C/+d/index.html

您可以为此使用扩展名

例子 斯芬克斯构型 您的文档
:docs:`1.0.1`
.. 结果->框架文档1.0.1
:docs:`文件(1.2.3)`
.. 结果->文件(1.2.3)
extlinks = {'docs': ('http://example.org/A/%s/+d/index.html', 'framework docs ')}
:docs:`1.0.1`
.. Result -> framework docs 1.0.1

:docs:`documentation (1.2.3) <1.2.3>`
.. Result -> documentation (1.2.3)