mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5393 from tk0miya/refactor_app
refactor: Check primary_domain on config-inited event
This commit is contained in:
commit
c57853923f
@ -250,11 +250,6 @@ class Sphinx(object):
|
||||
self.config.init_values()
|
||||
self.emit('config-inited', self.config)
|
||||
|
||||
# check primary_domain if requested
|
||||
primary_domain = self.config.primary_domain
|
||||
if primary_domain and not self.registry.has_domain(primary_domain):
|
||||
logger.warning(__('primary_domain %r not found, ignored.'), primary_domain)
|
||||
|
||||
# create the builder
|
||||
self.builder = self.create_builder(buildername)
|
||||
# set up the build environment
|
||||
|
@ -483,12 +483,21 @@ def check_unicode(config):
|
||||
'Please use Unicode strings, e.g. %r.'), name, u'Content')
|
||||
|
||||
|
||||
def check_primary_domain(app, config):
|
||||
# type: (Sphinx, Config) -> None
|
||||
primary_domain = config.primary_domain
|
||||
if primary_domain and not app.registry.has_domain(primary_domain):
|
||||
logger.warning(__('primary_domain %r not found, ignored.'), primary_domain)
|
||||
config.primary_domain = None # type: ignore
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.connect('config-inited', convert_source_suffix)
|
||||
app.connect('config-inited', init_numfig_format)
|
||||
app.connect('config-inited', correct_copyright_year)
|
||||
app.connect('config-inited', check_confval_types)
|
||||
app.connect('config-inited', check_primary_domain)
|
||||
|
||||
return {
|
||||
'version': 'builtin',
|
||||
|
Loading…
Reference in New Issue
Block a user