summaryrefslogtreecommitdiff
path: root/sphinx/builders/html.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-17 22:27:13 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-17 22:42:45 +0900
commitdd8ae7e2edbe820ff76f3a836da620f0f0712516 (patch)
tree531a43365e7b5a28c844f211a249c21c0c255382 /sphinx/builders/html.py
parenteb9bd50d689b3982d6efdb434091760cd04f979d (diff)
downloadsphinx-git-dd8ae7e2edbe820ff76f3a836da620f0f0712516.tar.gz
validate html_logo on config-inited
Diffstat (limited to 'sphinx/builders/html.py')
-rw-r--r--sphinx/builders/html.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index 1d52419d2..6e63a22d2 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -789,9 +789,7 @@ class StandaloneHTMLBuilder(Builder):
if self.config.html_logo:
logobase = path.basename(self.config.html_logo)
logotarget = path.join(self.outdir, '_static', logobase)
- if not path.isfile(path.join(self.confdir, self.config.html_logo)):
- logger.warning(__('logo file %r does not exist'), self.config.html_logo)
- elif not path.isfile(logotarget):
+ if not path.isfile(logotarget):
copyfile(path.join(self.confdir, self.config.html_logo),
logotarget)
if self.config.html_favicon:
@@ -1175,6 +1173,13 @@ def validate_html_static_path(app: Sphinx, config: Config) -> None:
config.html_static_path.remove(entry)
+def validate_html_logo(app: Sphinx, config: Config) -> None:
+ """Check html_logo setting."""
+ if config.html_logo and not path.isfile(path.join(app.confdir, config.html_logo)):
+ logger.warning(__('logo file %r does not exist'), config.html_logo)
+ config.html_logo = None # type: ignore
+
+
# for compatibility
import sphinx.builders.dirhtml # NOQA
import sphinx.builders.singlehtml # NOQA
@@ -1232,6 +1237,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
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('config-inited', validate_html_logo)
app.connect('builder-inited', validate_math_renderer)
app.connect('html-page-context', setup_js_tag_helper)