mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Explicitly ignore legacy file reference errors in sphinx -n mode
This commit is contained in:
parent
de965c2bf5
commit
7ebfface22
@ -40,6 +40,7 @@ extensions = [
|
|||||||
'exception_hierarchy',
|
'exception_hierarchy',
|
||||||
'attributetable',
|
'attributetable',
|
||||||
'resourcelinks',
|
'resourcelinks',
|
||||||
|
'nitpick_file_ignorer',
|
||||||
]
|
]
|
||||||
|
|
||||||
autodoc_member_order = 'bysource'
|
autodoc_member_order = 'bysource'
|
||||||
@ -140,6 +141,13 @@ pygments_style = 'friendly'
|
|||||||
#keep_warnings = False
|
#keep_warnings = False
|
||||||
|
|
||||||
|
|
||||||
|
# Nitpicky mode options
|
||||||
|
nitpick_ignore_files = [
|
||||||
|
"migrating_to_async",
|
||||||
|
"migrating",
|
||||||
|
"whats_new",
|
||||||
|
]
|
||||||
|
|
||||||
# -- Options for HTML output ----------------------------------------------
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
html_experimental_html5_writer = True
|
html_experimental_html5_writer = True
|
||||||
|
22
docs/extensions/nitpick_file_ignorer.py
Normal file
22
docs/extensions/nitpick_file_ignorer.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
from sphinx.application import Sphinx
|
||||||
|
from sphinx.util import logging as sphinx_logging
|
||||||
|
|
||||||
|
|
||||||
|
class NitpickFileIgnorer(logging.Filter):
|
||||||
|
|
||||||
|
def __init__(self, app: Sphinx) -> None:
|
||||||
|
self.app = app
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def filter(self, record: sphinx_logging.SphinxLogRecord) -> bool:
|
||||||
|
if getattr(record, 'type', None) == 'ref':
|
||||||
|
return record.location.get('refdoc') not in self.app.config.nitpick_ignore_files
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def setup(app: Sphinx):
|
||||||
|
app.add_config_value('nitpick_ignore_files', [], '')
|
||||||
|
f = NitpickFileIgnorer(app)
|
||||||
|
sphinx_logging.getLogger('sphinx.transforms.post_transforms').logger.addFilter(f)
|
Loading…
x
Reference in New Issue
Block a user