diff --git a/CHANGES b/CHANGES index 7c448d04bd7..40c1fb20f23 100644 --- a/CHANGES +++ b/CHANGES @@ -47,8 +47,8 @@ Features added ``__all__`` attribute if :confval:`autosummary_ignore_module_all` is set to ``False``. The default behaviour is unchanged. Autogen also now supports this behavior with the ``--respect-module-all`` switch. -* #9894: linkcheck: add option `linkcheck_exclude_documents` to disable link checking in matched documents. - link check in matched documents. +* #9894: linkcheck: add option `linkcheck_exclude_documents` to disable link + checking in matched documents. Bugs fixed ---------- diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 1bc1c5b01bc..212f84e07b6 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -551,6 +551,7 @@ def setup(app: Sphinx) -> Dict[str, Any]: app.add_post_transform(HyperlinkCollector) app.add_config_value('linkcheck_ignore', [], None) + app.add_config_value('linkcheck_exclude_documents', [], None) app.add_config_value('linkcheck_allowed_redirects', {}, None) app.add_config_value('linkcheck_auth', [], None) app.add_config_value('linkcheck_request_headers', {}, None) @@ -561,7 +562,6 @@ def setup(app: Sphinx) -> Dict[str, Any]: # Anchors starting with ! are ignored since they are # commonly used for dynamic pages app.add_config_value('linkcheck_anchors_ignore', ["^!"], None) - app.add_config_value('linkcheck_exclude_documents', [], None) app.add_config_value('linkcheck_rate_limit_timeout', 300.0, None) app.add_event('linkcheck-process-uri') diff --git a/tests/roots/test-linkcheck-documents_exclude/conf.py b/tests/roots/test-linkcheck-documents_exclude/conf.py index 327b1b91080..65ecbfb3629 100644 --- a/tests/roots/test-linkcheck-documents_exclude/conf.py +++ b/tests/roots/test-linkcheck-documents_exclude/conf.py @@ -2,4 +2,4 @@ linkcheck_exclude_documents = [ '^broken_link$', 'br[0-9]ken_link', -] \ No newline at end of file +] diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index afadc069309..0520fb016a7 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -634,4 +634,4 @@ def test_linkcheck_exclude_documents(app): with open(app.outdir / 'output.json') as fp: for record in fp: content = json.loads(record) - assert content['status'] == 'unchecked' + assert content['status'] == 'ignored'