如何通过sphinx链接到Python 3文档中的typecontextmanager标签
我正在尝试将对以下链接的引用放入我的一个reST文档中:。我试图使用如何通过sphinx链接到Python 3文档中的typecontextmanager标签,python,python-sphinx,restructuredtext,Python,Python Sphinx,Restructuredtext,我正在尝试将对以下链接的引用放入我的一个reST文档中:。我试图使用:ref:内联指令而不是链接 我运行了python-msphinx.ext.intersphinxhttps://docs.python.org/3/objects.inv。结果表明,除其他外: ... std:label 23acks Acknowledgements : whatsnew/2.3.html#acks 23section-other
:ref:
内联指令而不是链接
我运行了python-msphinx.ext.intersphinxhttps://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
...
我使用以下指令:
:ref:`context manager <python:typecontextmanager>`
:ref:
被字符串上下文管理器替换,但没有链接
我错过了什么
我正在Python 3.6.2的Anaconda安装中使用Sphinx1.6.3
注1
根据库存行(也在std:label
下),我在使用:ref:`with`
时也遇到了同样的问题:
我猜,解决主要问题的办法很可能也能解决这个问题
注2
可能不是100%相关,但我可以链接到:py:meth:`~contextmanager.\u在同一节中输入\uuuu`
,没有任何问题。这两种方法对我都有效
:ref:`python:typecontextmanager`
:ref:`typecontextmanager <python:typecontextmanager>`
:ref:`python:typecontextmanager`
:ref:`typecontextmanager`
请注意,如果在目标周围使用尖括号,则必须包含标题
下面是他们如何为我呈现的:
另外,我最近在its中向Pyramid的文档中添加了上下文管理器,我认为这很好地解释了它们是什么。以下是其他来源:
:ref:`With Statement Context Managers <python:context-managers>`
:ref:`with <python:with>`
:ref:`With语句上下文管理器`
:ref:`with`
我看不出我们的参考文献之间有任何根本性的区别。我将做一个makeclean
,看看这是否有帮助。amakeclean
修复了它。但是,您的答案中有一些有价值的提示,因此我将选择它来保持代表的流动。在我对另一个问题的回答中,有几个其他选项:。Sphinx将解析的reST文件缓存为“doctree pickles”,而不是Python源代码文件,然后写入输出。它只查找新的和更改的文件。因此,如果在上次运行后没有更改reST文件并保存它,那么输出中的更改将永远不会显示。有时我只是添加一个换行符并保存它,以强制运行当前文件。
with The with statement : reference/compound_stmts.html#with
:ref:`python:typecontextmanager`
:ref:`typecontextmanager <python:typecontextmanager>`
:ref:`With Statement Context Managers <python:context-managers>`
:ref:`with <python:with>`