python-3.x - 如何在 Sphinx :class: directive 后添加复数-s

标签 python-3.x python-sphinx

我一直有这个问题,我想写一个这样的文档字符串:

def foo(arg):
   '''Add ``arg`` to the list of :class:`foo.bar.baz.Argument`s.'''
   pass

但是,这不起作用,Sphinx 会警告说
py:class reference target not found: foo.bar.baz.Argument`s

所以它正在治疗 s在结束反引号作为类名的一部分之后。这不会发生在例如标点符号如点 . .
除了在类名和 Plural-s 之间添加一个空格(看起来很疯狂)之外,还有什么可以做的吗?

最佳答案

您应该可以使用 backslash-escaped whitespace .

def foo(arg):
   '''Add ``arg`` to the list of :class:`foo.bar.baz.Argument`\ s.'''
   pass

关于python-3.x - 如何在 Sphinx :class: directive 后添加复数-s,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51891619/

相关文章:

python - 将装饰器的函数传递给 Python RQ

hyperlink - 在 Sphinx/reStructuredText 中添加在新标签页中打开的链接

python - 狮身人面像 : force rebuild of html, 包括 autodoc

python - 如何使用 Pillow 隐藏重叠像素?

python-3.x - 去除图像圆形区域之外的颜色

python - 如何在 Python 3 中设置 sys.stdout 编码?

latex - 使用Sphinx在 latex 文档中制作引用书目

python-sphinx - 从 toctree 隐藏特定文件?

python - 在 Python 中以编程方式将 reStructuredText 转换为纯文本

python - 帮助生成器函数中的逻辑