mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#537: Added :confval:nitpick_ignore
.
This commit is contained in:
parent
1d6d183193
commit
f5ecd62d05
2
CHANGES
2
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.
|
||||
|
||||
|
||||
|
@ -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
|
||||
-------------------
|
||||
|
@ -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'),
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user