【问题标题】:Disabling individual Sphinx warning messages禁用个别 Sphinx 警告消息
【发布时间】:2012-10-07 12:30:38
【问题描述】:

我的 Sphinx 树中有许多 .rst 文件,这些文件被有意从任何索引树中排除。我收到类似的警告

 /filename.rst:: WARNING: document isn't included in any toctree

如何抑制 Sphinx 中的特定警告?

【问题讨论】:

    标签: python-sphinx toctree


    【解决方案1】:
    1. 您的 Sphinx 项目中是否有 .rst 文件,您不希望其内容出现在输出中?

      使用exclude_patterns 配置变量。对于与指定模式匹配的文件,不会生成任何输出(也不会生成警告消息)。见http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-exclude_patterns

    2. 您的 Sphinx 项目中是否存在不属于任何目录树但其内容应在输出中的 .rst 文件?

      在每个 .rst 文件的顶部添加 :orphan: 以禁止显示警告消息。见http://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html#file-wide-metadata

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-26
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 2017-08-18
      • 1970-01-01
      • 2016-03-09
      • 2018-03-31
      相关资源
      最近更新 更多