-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is your feature request related to a problem? Please describe.
I'm generating multiple overlapping documents from a shared set of source rst files like in #9596 and I would like to use warnings-as-errors. I also have only one shared conf.py and control which documents to exclude by passing tags to sphinx-build:
# somewhere in conf.py
exclude_patterns = []
if tags.eval_condition('not include_statistics'):
exclude_patterns.append('kernel/statistics.rst')The problem is that I include statistics.rst in toctree and sphinx triggers a warning 'toctree contains reference to excluded document', but this warning doesn't have type and subtype so I can supress it. It is not an error, it was excluded intentionally, I want statistics.rst to be in toctree because there is another document which uses include_statistics tag and I that's why I don't want warning here.
Describe the solution you'd like
It could be special metadata field :maybe_excluded: which you can set for toctree entry to supress warning inplace only:
.. toctree::
:maybe_excluded:statistics
first_doc
second_doc
Describe alternatives you've considered
Passing a type and subtype argument to logger.warning so I can supress it in conf.py globally (not so good, because they can be useful).
Now I have to patch toctree directive and override it in my extrension to supress this warning (very bad).