mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix handling of the default role: it needs to be looked up after patching the role/directive lookup functions.
This commit is contained in:
parent
3d01c2c95f
commit
1d5894a35a
@ -608,15 +608,6 @@ class BuildEnvironment:
|
||||
if src_path is None:
|
||||
src_path = self.doc2path(docname)
|
||||
|
||||
if self.config.default_role:
|
||||
role_fn, messages = roles.role(self.config.default_role, english,
|
||||
0, dummy_reporter)
|
||||
if role_fn:
|
||||
roles._roles[''] = role_fn
|
||||
else:
|
||||
self.warn(docname, 'default role %s not found' %
|
||||
self.config.default_role)
|
||||
|
||||
self.temp_data['docname'] = docname
|
||||
# defaults to the global default, but can be re-set in a document
|
||||
self.temp_data['default_domain'] = \
|
||||
@ -628,6 +619,15 @@ class BuildEnvironment:
|
||||
|
||||
self.patch_lookup_functions()
|
||||
|
||||
if self.config.default_role:
|
||||
role_fn, messages = roles.role(self.config.default_role, english,
|
||||
0, dummy_reporter)
|
||||
if role_fn:
|
||||
roles._roles[''] = role_fn
|
||||
else:
|
||||
self.warn(docname, 'default role %s not found' %
|
||||
self.config.default_role)
|
||||
|
||||
codecs.register_error('sphinx', self.warn_and_replace)
|
||||
|
||||
class SphinxSourceClass(FileInput):
|
||||
|
Loading…
Reference in New Issue
Block a user