次のリンクへの参照を私のreST文書の1つに入れようとしています:https://docs.python.org/3/library/stdtypes.html#typecontextmanager。私はリンクの代わりに:ref:
インラインディレクティブを使用しようとしています。Python 3でのtypecontextmanagerラベルへのリンク方法sphinx経由での文書
私はpython -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
を実行しました。とりわけ、結果が示す、:
... std:label 23acks Acknowledgements : whatsnew/2.3.html#acks 23section-other Other Changes and Fixes : whatsnew/2.3.html#section-other ... typebytearray Bytearray Objects : library/stdtypes.html#typebytearray typebytes Bytes Objects : library/stdtypes.html#typebytes typecontextmanager Context Manager Types : library/stdtypes.html#typecontextmanager typeiter Iterator Types : library/stdtypes.html#typeiter typememoryview Memory Views : library/stdtypes.html#typememoryview ...
太字のURLは、私は私のintersphinx_mapping
はこのようになりますので、探しています正確に何である:
:ref:`context manager <python:typecontextmanager>`
:私は次のディレクティブを使用し
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
これは正しいラベルを指しているようですが、次の警告が表示されます。
WARNING: undefined label: python:typecontextmanager (if the link has no caption the label must precede a section header)
:ref:
は文字列context manager
に置き換えられますが、リンクはありません。
私には何が欠けていますか?私はによると、https://docs.python.org/3/reference/compound_stmts.html#withを指すようになっている:ref:`with <python:with>`
を使用して同じ問題を持っているノート
のPython 3.6.2の1
をインストールアナコンダにスフィンクス1.6.3を使用しています
(またstd:label
下)在庫ライン:
with The with statement : reference/compound_stmts.html#with
は私がメインの質問に対する解決策は、最も可能性が高いだけでなく、これを解決することを推測しています。
おそらくない100%関連
注2、私は何の問題もなく同じセクションに:py:meth:`~contextmanager.__enter__`
にリンクすることができます。
ここには参考文献との根本的な違いはありません。私は 'make clean 'を行い、それが役立つかどうか確認します。 –
'make clean 'がそれを修正しました。しかし、あなたは答えにいくつかの貴重なヒントを持っているので、私はそれを担当者が流れ続けるように選択します。 –
別の質問に私の答えにいくつかの他のオプションがあります:https://stackoverflow.com/a/43908388/2214933。 Sphinxは解析されたreSTファイルをPythonソースコードファイルではなく "doctree pickles"としてキャッシュし、出力に書き込みます。新規および変更されたファイルのみを検索します。したがって、以前の実行以降にreSTファイルを変更して保存しなかった場合、出力の変更は表示されません。私はときどき改行を加え、それを保存して強制的に現在のファイルを実行させます。 –