问题
I'm getting two warning messages when trying to build my docs with Sphinx v2.1.2
and sphinx-rtd-theme 0.4.3
.
The first one is:
/docs/numsec.py:50: RemovedInSphinx30Warning: app.override_domain() is deprecated. Use app.add_domain() with override option instead.
app.override_domain(CustomStandardDomain)
That section of my numsec.py
looks like:
def setup(app):
app.override_domain(CustomStandardDomain)
app.connect('doctree-resolved', doctree_resolved)
I don't know what override option
means. I've tried replacing that line with app.add_domain()
and app.add_domain(CustomStandardDomain)
but neither works.
The second warning message is:
/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() }}
and I have no idea of to fix this one. Should I just remove the {{ super() }}
line?
回答1:
For now, it is possible to just ignore the warnings. Everything will still work. But in Sphinx 3.0 (not yet released), the deprecated features will stop working.
The first warning goes away if you replace
app.override_domain(CustomStandardDomain)
with
app.add_domain(CustomStandardDomain, override=True)
in numsec.py (which I presume is the same as https://github.com/jterrace/sphinxtr/blob/master/extensions/numsec.py).
The second warning is about a deprecated feature in search.html in sphinx-rtd-theme. This has already been fixed in the GitHub repository, but the fix is not in the latest release (0.4.3).
See https://github.com/readthedocs/sphinx_rtd_theme/commit/a49a812c8821123091166fae1897d702cdc2d627#diff-b3d4a9c32d5abd89b9214dcfbb2ece79.
来源:https://stackoverflow.com/questions/57401254/fix-sphinx-removedinsphinx30warning