summaryrefslogtreecommitdiff
path: root/sphinx/builders/html.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-18 00:17:15 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-06-18 01:21:08 +0900
commitd8208d406a0c470b34de79c4b054ba05f50ae34c (patch)
tree3746ed793b14c2932a3defe6edec3496b1fc375a /sphinx/builders/html.py
parent3047bd211ff3de173d7af817d84118c8ad776772 (diff)
downloadsphinx-git-d8208d406a0c470b34de79c4b054ba05f50ae34c.tar.gz
Close #1464: html: warn html_static_path is inside outdir
Diffstat (limited to 'sphinx/builders/html.py')
-rw-r--r--sphinx/builders/html.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index c8d330d2d..7c72ed785 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -1157,17 +1157,25 @@ def validate_math_renderer(app: Sphinx) -> None:
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)):
+ extra_path = path.normpath(path.join(app.confdir, entry))
+ if not path.exists(extra_path):
logger.warning(__('html_extra_path entry %r does not exist'), entry)
config.html_extra_path.remove(entry)
+ elif path.commonpath([app.outdir, extra_path]) == app.outdir:
+ logger.warning(__('html_extra_path entry %r is placed inside outdir'), 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[:]:
- if not path.exists(path.join(app.confdir, entry)):
+ static_path = path.normpath(path.join(app.confdir, entry))
+ if not path.exists(static_path):
logger.warning(__('html_static_path entry %r does not exist'), entry)
config.html_static_path.remove(entry)
+ elif path.commonpath([app.outdir, static_path]) == app.outdir:
+ logger.warning(__('html_static_path entry %r is placed inside outdir'), entry)
+ config.html_static_path.remove(entry)
def validate_html_logo(app: Sphinx, config: Config) -> None: