修复Sphinx RemovedInSphinx30警告 [英] Fix Sphinx RemovedInSphinx30Warning
本文介绍了修复Sphinx RemovedInSphinx30警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用Sphinx v2.1.2
和sphinx-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)中没有这个修复。
这篇关于修复Sphinx RemovedInSphinx30警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文