2

別のファイルで定義されたセクションを参照するリンクを作成したい。

「 Python-Sphinx: Link to Section in external File 」で同様の質問を見つけましたが、「intersphinx」という拡張子があることに気付きました。そこで、この拡張機能を試してみましたが、うまくいきません (おそらく私の使い方が間違っているのでしょう)。

私は以下を試しました。

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>`

上記のマークアップで「Bar Installation Instruction」のようなリンクを作りたいです。

bar.rst

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

some text...

を実行するmake htmlと、次の警告が表示され、リンクが作成されません。

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

前もって感謝します。

4

1 に答える 1

0

マッピング インベントリ ファイルが見つからないようです。タプルの最初の部分はリンクのベース URL として機能し、2 番目の部分はインベントリ ファイルへのパスです。インベントリ ファイルの自動ダウンロード ( を渡す場合None) は、URI でのみ機能し、ファイル パスでは機能しないと思います。

この例では、ドキュメントをローカルでビルドできますが、リンク先は次のとおりです。http://example.com/docs/bar.html

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