diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-17 02:11:06 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-17 22:30:43 +0900 |
commit | eb9bd50d689b3982d6efdb434091760cd04f979d (patch) | |
tree | df8f5404474e8803f9dee6c18c633b9e48ff3eb9 | |
parent | 9bef665cb84d4a7ee17fa7b3f6544dae825b170d (diff) | |
download | sphinx-git-eb9bd50d689b3982d6efdb434091760cd04f979d.tar.gz |
validate html_extra_path on config-inited
-rw-r--r-- | sphinx/builders/html.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index a21aeb798..1d52419d2 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -815,10 +815,6 @@ class StandaloneHTMLBuilder(Builder): for extra_path in self.config.html_extra_path: entry = path.join(self.confdir, extra_path) - if not path.exists(entry): - logger.warning(__('html_extra_path entry %r does not exist'), entry) - continue - copy_asset(entry, self.outdir, excluded) logger.info(__('done')) except OSError as err: @@ -1163,6 +1159,14 @@ def validate_math_renderer(app: Sphinx) -> None: raise ConfigError(__('Unknown math_renderer %r is given.') % name) +def validate_html_extra_path(app: Sphinx, config: Config) -> None: + """Check html_extra_paths setting.""" + for entry in config.html_extra_path[:]: + if not path.exists(path.join(app.confdir, entry)): + logger.warning(__('html_extra_path entry %r does not exist'), entry) + config.html_extra_path.remove(entry) + + def validate_html_static_path(app: Sphinx, config: Config) -> None: """Check html_static_paths setting.""" for entry in config.html_static_path[:]: @@ -1226,6 +1230,7 @@ def setup(app: Sphinx) -> Dict[str, Any]: # event handlers app.connect('config-inited', convert_html_css_files) app.connect('config-inited', convert_html_js_files) + app.connect('config-inited', validate_html_extra_path) app.connect('config-inited', validate_html_static_path) app.connect('builder-inited', validate_math_renderer) app.connect('html-page-context', setup_js_tag_helper) |