尝试使用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() }}
行吗?
答案 0 :(得分:2)
目前,可以仅忽略警告。一切仍然会起作用。但是在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-theme中search.html中已弃用的功能。 GitHub存储库中已对此问题进行了修复,但最新版本(0.4.3)中未修复此问题。