2

I want to create a link that refers to a section defined in another file.

I have found a similar question on "Python-Sphinx: Link to Section in external File" and I noticed there is an extension called "intersphinx". So I tried this extension, but it doesn't work (Probably my usage is wrong).

I have tried the following.

conf.py

extensions = ['sphinx.ext.todo', 'sphinx.ext.intersphinx']
...
intersphinx_mapping = {'myproject': ('../build/html', None)}

foo.rst

...
****************
Install Bar
****************
Please refer :ref:`Bar Installation Instruction<myproject:bar_installation>`

I want to create a link like 'Bar Installation Instruction' with above markup.

bar.rst

...
**************************
Installation Instruction
**************************
.. _bar_installation:

some text...

When I run make html, I get the following warning and the link is not created.

foo.rst: WARNING: undefined label: myproject:bar_installation (if the link has no caption the label must precede a section header)

Thanks in advance.

4

1 回答 1

0

看起来它无法找到您的映射库存文件。元组的第一部分用作链接的基本 URL,而第二部分是库存文件的路径。我相信库存文件的自动下载(当您通过时None)仅适用于 URI 而不是文件路径。

在这个例子中,我可以在本地构建文档,但它会链接到http://example.com/docs/bar.html

'myproject': (
    'http://example.com/docs/',
    '../html/objects.inv'
)
于 2013-08-19T16:08:27.180 回答