【问题标题】:Sphinx 1.4+ and block literals in Returns with sphinx-napoleon don't work anymoreSphinx 1.4+ 和带有 sphinx-napoleon 的 Returns 中的块文字不再起作用
【发布时间】:2016-05-13 15:00:00
【问题描述】:

我正在为遵循本指南的 python 项目编写文档:

http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html

确切地说是指南的这一部分:

Returns 部分支持任何 reStructuredText 格式,包括文字块::

我的代码如下:

Returns:
    None:

    ::

        {
            "status": "update",
            "success": True,
        }

对于 sphinx 1.3.5-1.3.6,它按预期工作。

对于 sphinx 1.4.0-1.4.1,它会抛出这样的错误:

api/v0_0/views.py:docstring of api.v0_0.views.add_gallery:19: ERROR: Unexpected indentation.
api/v0_0/views.py:docstring of api.v0_0.views.add_gallery:21: WARNING: Block quote ends without a blank line; unexpected unindent.

【问题讨论】:

  • 那你不应该把它报告为一个错误吗?
  • 我不确定这是错误还是某种变化。 :-D
  • 但我的脑海里闪过这个想法,也许这是一个错误。
  • 如果更改破坏了您的代码,它要么是回归,要么应该在发行说明中列为重大更改 - 无论哪种方式,这都不是 SO 真正可以帮助的。跨度>
  • 我在 python-sphinx 上放了一个错误报告,如果我有更新,会在这里发布。如果是bug我会记下,如果是我缺乏知识,我会解释该怎么做。

标签: python python-sphinx sphinx-napoleon


【解决方案1】:

这是错误。我创建了一张带有工作示例的票证如何重现它。研究 Sphinx 的人在一周(左右)之后修复了它。颠簸版本将解决它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-10
    • 1970-01-01
    • 2018-09-27
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多