diff --git a/CHANGES b/CHANGES index 52a962d2d..07b543783 100644 --- a/CHANGES +++ b/CHANGES @@ -83,6 +83,8 @@ Release 1.1 (in development) * #590: Added ``caption`` option to graphviz directives. +* #537: Added :confval:`nitpick_ignore`. + * C++ domain now supports array definitions. diff --git a/doc/config.rst b/doc/config.rst index a1f550ddf..368674692 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -232,6 +232,14 @@ General configuration .. versionadded:: 1.0 +.. confval:: nitpick_ignore + + A list of ``(type, target)`` tuples (by default empty) that should be ignored + when generating warnings in "nitpicky mode". Note that ``type`` should + include the domain name. An example entry would be ``('py:func', 'int')``. + + .. versionadded:: 1.1 + Project information ------------------- diff --git a/sphinx/config.py b/sphinx/config.py index 90c4b5627..f4c0946b5 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -71,6 +71,7 @@ class Config(object): primary_domain = ('py', 'env'), needs_sphinx = (None, None), nitpicky = (False, 'env'), + nitpick_ignore = ([], 'env'), # HTML options html_theme = ('default', 'html'), diff --git a/sphinx/environment.py b/sphinx/environment.py index 1f8e00f56..0867eb74e 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -69,7 +69,7 @@ default_settings = { # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 40 +ENV_VERSION = 41 default_substitutions = set([ @@ -340,6 +340,9 @@ class BuildEnvironment: # this is to invalidate old pickles self.version = ENV_VERSION + # make this a set for faster testing + self._nitpick_ignore = set(self.config.nitpick_ignore) + # All "docnames" here are /-separated and relative and exclude # the source suffix. @@ -1465,7 +1468,11 @@ class BuildEnvironment: def _warn_missing_reference(self, fromdoc, typ, target, node, domain): warn = node.get('refwarn') if self.config.nitpicky: - warn = True # XXX process exceptions here + warn = True + if self._nitpick_ignore: + dtype = domain and '%s:%s' % (domain.name, typ) or typ + if (dtype, target) in self._nitpick_ignore: + warn = False if not warn: return refdoc = node.get('refdoc', fromdoc)