@@ -64,9 +64,7 @@ def _resolve_reference_in_domain_by_target(
64
64
inv_name : str | None , inventory : Inventory ,
65
65
domain : Domain , objtypes : Iterable [str ],
66
66
target : str ,
67
- node : pending_xref , contnode : TextElement ,
68
- app : Sphinx | None = None
69
- ) -> nodes .reference | None :
67
+ node : pending_xref , contnode : TextElement ) -> nodes .reference | None :
70
68
for objtype in objtypes :
71
69
if objtype not in inventory :
72
70
# Continue if there's nothing of this kind in the inventory
@@ -83,13 +81,8 @@ def _resolve_reference_in_domain_by_target(
83
81
insensitive_matches = list (filter (lambda k : k .lower () == target_lower ,
84
82
inventory [objtype ].keys ()))
85
83
if len (insensitive_matches ) > 1 :
86
- inventory_location = (
87
- app .config .intersphinx_mapping [inv_name ][1 ][0 ]
88
- if (inv_name and app and inv_name in app .config .intersphinx_mapping ) else
89
- "./objects.inv"
90
- )
91
- LOGGER .warning (__ ("multiple matches found for %s:%s in <%s>" ),
92
- objtype , target , inventory_location ,
84
+ LOGGER .warning (__ ("multiple matches found for %s:%s" ),
85
+ objtype , target ,
93
86
type = 'intersphinx' , subtype = 'external' , location = node )
94
87
if insensitive_matches :
95
88
data = inventory [objtype ][insensitive_matches [0 ]]
@@ -110,7 +103,6 @@ def _resolve_reference_in_domain(env: BuildEnvironment,
110
103
honor_disabled_refs : bool ,
111
104
domain : Domain , objtypes : Iterable [str ],
112
105
node : pending_xref , contnode : TextElement ,
113
- app : Sphinx | None = None ,
114
106
) -> nodes .reference | None :
115
107
obj_types : dict [str , None ] = {}.fromkeys (objtypes )
116
108
@@ -137,7 +129,7 @@ def _resolve_reference_in_domain(env: BuildEnvironment,
137
129
138
130
# without qualification
139
131
res = _resolve_reference_in_domain_by_target (inv_name , inventory , domain , objtypes ,
140
- node ['reftarget' ], node , contnode , app )
132
+ node ['reftarget' ], node , contnode )
141
133
if res is not None :
142
134
return res
143
135
@@ -146,14 +138,12 @@ def _resolve_reference_in_domain(env: BuildEnvironment,
146
138
if full_qualified_name is None :
147
139
return None
148
140
return _resolve_reference_in_domain_by_target (inv_name , inventory , domain , objtypes ,
149
- full_qualified_name , node , contnode , app )
141
+ full_qualified_name , node , contnode )
150
142
151
143
152
144
def _resolve_reference (env : BuildEnvironment , inv_name : str | None , inventory : Inventory ,
153
145
honor_disabled_refs : bool ,
154
- node : pending_xref , contnode : TextElement ,
155
- app : Sphinx | None = None
156
- ) -> nodes .reference | None :
146
+ node : pending_xref , contnode : TextElement ) -> nodes .reference | None :
157
147
# disabling should only be done if no inventory is given
158
148
honor_disabled_refs = honor_disabled_refs and inv_name is None
159
149
@@ -170,7 +160,7 @@ def _resolve_reference(env: BuildEnvironment, inv_name: str | None, inventory: I
170
160
res = _resolve_reference_in_domain (env , inv_name , inventory ,
171
161
honor_disabled_refs ,
172
162
domain , objtypes ,
173
- node , contnode , app )
163
+ node , contnode )
174
164
if res is not None :
175
165
return res
176
166
return None
@@ -189,7 +179,7 @@ def _resolve_reference(env: BuildEnvironment, inv_name: str | None, inventory: I
189
179
return _resolve_reference_in_domain (env , inv_name , inventory ,
190
180
honor_disabled_refs ,
191
181
domain , objtypes ,
192
- node , contnode , app )
182
+ node , contnode )
193
183
194
184
195
185
def inventory_exists (env : BuildEnvironment , inv_name : str ) -> bool :
@@ -199,7 +189,6 @@ def inventory_exists(env: BuildEnvironment, inv_name: str) -> bool:
199
189
def resolve_reference_in_inventory (env : BuildEnvironment ,
200
190
inv_name : str ,
201
191
node : pending_xref , contnode : TextElement ,
202
- app : Sphinx | None = None ,
203
192
) -> nodes .reference | None :
204
193
"""Attempt to resolve a missing reference via intersphinx references.
205
194
@@ -209,26 +198,24 @@ def resolve_reference_in_inventory(env: BuildEnvironment,
209
198
"""
210
199
assert inventory_exists (env , inv_name )
211
200
return _resolve_reference (env , inv_name , InventoryAdapter (env ).named_inventory [inv_name ],
212
- False , node , contnode , app )
201
+ False , node , contnode )
213
202
214
203
215
204
def resolve_reference_any_inventory (env : BuildEnvironment ,
216
205
honor_disabled_refs : bool ,
217
206
node : pending_xref , contnode : TextElement ,
218
- app : Sphinx | None = None ,
219
207
) -> nodes .reference | None :
220
208
"""Attempt to resolve a missing reference via intersphinx references.
221
209
222
210
Resolution is tried with the target as is in any inventory.
223
211
"""
224
212
return _resolve_reference (env , None , InventoryAdapter (env ).main_inventory ,
225
213
honor_disabled_refs ,
226
- node , contnode , app )
214
+ node , contnode )
227
215
228
216
229
217
def resolve_reference_detect_inventory (env : BuildEnvironment ,
230
218
node : pending_xref , contnode : TextElement ,
231
- app : Sphinx | None = None
232
219
) -> nodes .reference | None :
233
220
"""Attempt to resolve a missing reference via intersphinx references.
234
221
@@ -238,7 +225,7 @@ def resolve_reference_detect_inventory(env: BuildEnvironment,
238
225
is tried in that inventory with the new target.
239
226
"""
240
227
# ordinary direct lookup, use data as is
241
- res = resolve_reference_any_inventory (env , True , node , contnode , app )
228
+ res = resolve_reference_any_inventory (env , True , node , contnode )
242
229
if res is not None :
243
230
return res
244
231
@@ -250,15 +237,15 @@ def resolve_reference_detect_inventory(env: BuildEnvironment,
250
237
if not inventory_exists (env , inv_name ):
251
238
return None
252
239
node ['reftarget' ] = newtarget
253
- res_inv = resolve_reference_in_inventory (env , inv_name , node , contnode , app )
240
+ res_inv = resolve_reference_in_inventory (env , inv_name , node , contnode )
254
241
node ['reftarget' ] = target
255
242
return res_inv
256
243
257
244
258
245
def missing_reference (app : Sphinx , env : BuildEnvironment , node : pending_xref ,
259
246
contnode : TextElement ) -> nodes .reference | None :
260
247
"""Attempt to resolve a missing reference via intersphinx references."""
261
- return resolve_reference_detect_inventory (env , node , contnode , app )
248
+ return resolve_reference_detect_inventory (env , node , contnode )
262
249
263
250
264
251
class IntersphinxDispatcher (CustomReSTDispatcher ):
@@ -497,9 +484,9 @@ def run(self, **kwargs: Any) -> None:
497
484
inv_name = node ['inventory' ]
498
485
if inv_name is not None :
499
486
assert inventory_exists (self .env , inv_name )
500
- newnode = resolve_reference_in_inventory (self .env , inv_name , node , contnode , self . app )
487
+ newnode = resolve_reference_in_inventory (self .env , inv_name , node , contnode )
501
488
else :
502
- newnode = resolve_reference_any_inventory (self .env , False , node , contnode , self . app )
489
+ newnode = resolve_reference_any_inventory (self .env , False , node , contnode )
503
490
if newnode is None :
504
491
typ = node ['reftype' ]
505
492
msg = (__ ('external %s:%s reference target not found: %s' ) %
0 commit comments