9494}
9595
9696
97- def make_xref (param_type , xref_aliases , xref_ignore , wrap_unknown = True ):
97+ def make_xref (param_type , xref_aliases , xref_ignore ):
9898 """Parse and apply appropriate sphinx role(s) to `param_type`.
9999
100100 The :obj: role is the default.
@@ -106,27 +106,36 @@ def make_xref(param_type, xref_aliases, xref_ignore, wrap_unknown=True):
106106 xref_aliases : dict
107107 Mapping used to resolve common abbreviations and aliases
108108 to fully qualified names that can be cross-referenced.
109- xref_ignore : set
110- Words not to cross-reference.
111- wrap_unknown : bool, default=True
112- Toggle whether to wrap unrecognized terms in the default :obj: role,
113- default is `True`. Unrecognized terms include those that are in
114- neither `xref_aliases` nor `xref_ignore` and are not already wrapped
115- in an rST role.
109+ xref_ignore : set or "all"
110+ A set containing words not to cross-reference. Instead of a set, the
111+ string 'all' can be given to ignore all unrecognized terms.
112+ Unrecognized terms include those that are not in `xref_aliases` and
113+ are not already wrapped in a reST role.
116114
117115 Returns
118116 -------
119117 out : str
120118 Text with fully-qualified names and terms that may be wrapped in a
121119 ``:obj:`` role.
122120 """
121+ ignore_set = xref_ignore
122+ wrap_unknown = True
123+ if isinstance (xref_ignore , str ):
124+ if xref_ignore .lower () == "all" :
125+ wrap_unknown = False
126+ ignore_set = set ()
127+ else :
128+ raise TypeError (
129+ "xref_ignore must be a set or 'all', got {}" .format (xref_ignore )
130+ )
131+
123132 if param_type in xref_aliases :
124133 link , title = xref_aliases [param_type ], param_type
125134 param_type = link
126135 else :
127136 link = title = param_type
128137
129- if QUALIFIED_NAME_RE .match (link ) and link not in xref_ignore :
138+ if QUALIFIED_NAME_RE .match (link ) and link not in ignore_set :
130139 if link != title :
131140 return ':obj:`%s <%s>`' % (title , link )
132141 if wrap_unknown :
@@ -147,9 +156,7 @@ def _split_and_apply_re(s, pattern):
147156 if pattern .match (tok ):
148157 results .append (tok )
149158 else :
150- res = make_xref (
151- tok , xref_aliases , xref_ignore , wrap_unknown
152- )
159+ res = make_xref (tok , xref_aliases , xref_ignore )
153160 # Opening brackets immediately after a role is
154161 # bad markup. Detect that and add backslash.
155162 # :role:`type`( to :role:`type`\(
0 commit comments