修复Sphinx RemovedInSphinx30警告 [英] Fix Sphinx RemovedInSphinx30Warning

查看:21
本文介绍了修复Sphinx RemovedInSphinx30警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Sphinx v2.1.2sphinx-rtd-theme 0.4.3生成文档时收到两条警告消息。

第一个是:

/docs/numsec.py:50: RemovedInSphinx30Warning: app.override_domain() is deprecated. Use app.add_domain() with override option instead.
  app.override_domain(CustomStandardDomain)

我的numsec.py部分如下所示:

def setup(app):
    app.override_domain(CustomStandardDomain)
    app.connect('doctree-resolved', doctree_resolved)

我不知道override option是什么意思。我已尝试将该行替换为app.add_domain()app.add_domain(CustomStandardDomain),但都不起作用。

第二条警告消息为:

/miniconda3/envs/py3/lib/python3.7/site-packages/sphinx_rtd_theme/search.html:20: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
  {{ super() }}

我不知道如何解决这个问题。我应该只删除{{ super() }}行吗?

推荐答案

目前,可以只忽略警告。一切都还会好的。但在Sphinx 3.0(尚未发布)中,不推荐使用的功能将停止工作。


如果您替换

app.override_domain(CustomStandardDomain)

app.add_domain(CustomStandardDomain, override=True)

在numsec.py中(我假设与https://github.com/jterrace/sphinxtr/blob/master/extensions/numsec.py相同)。


第二个警告是关于sphinx-rtd-heme中earch.html中的一个不推荐使用的功能。GitHub存储库中已经修复了这个问题,但最新版本(0.4.3)中没有这个修复。

请参阅https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c8821123091166fae1897d702cdc2d627#diff-b3d4a9c32d5abd89b9214dcfbb2ece79

这篇关于修复Sphinx RemovedInSphinx30警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆