diff --git a/CHANGES b/CHANGES index 357831afe..0dfb9529b 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Changes in trunk * sphinx.htmlwriter, sphinx.latexwriter: Support the ``.. image::`` directive by copying image files to the output directory. +* sphinx.builder: Consistently name "special" HTML output directories + with a leading underscore; this means ``_sources`` and ``_static``. + * sphinx.environment: Take dependent files into account when collecting the set of outdated sources. diff --git a/sphinx/builder.py b/sphinx/builder.py index 2ecdeb1d2..dc305012f 100644 --- a/sphinx/builder.py +++ b/sphinx/builder.py @@ -496,7 +496,7 @@ class StandaloneHTMLBuilder(Builder): # copy static files self.info(bold('copying static files...')) - ensuredir(path.join(self.outdir, 'static')) + ensuredir(path.join(self.outdir, '_static')) staticdirnames = [path.join(path.dirname(__file__), 'static')] + \ [path.join(self.srcdir, spath) for spath in self.config.html_static_path] @@ -504,9 +504,9 @@ class StandaloneHTMLBuilder(Builder): for filename in os.listdir(staticdirname): if not filename.startswith('.'): shutil.copyfile(path.join(staticdirname, filename), - path.join(self.outdir, 'static', filename)) + path.join(self.outdir, '_static', filename)) # add pygments style file - f = open(path.join(self.outdir, 'static', 'pygments.css'), 'w') + f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w') f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet()) f.close() @@ -514,7 +514,10 @@ class StandaloneHTMLBuilder(Builder): self.handle_finish() def get_outdated_docs(self): - template_mtime = max(mtimes_of_files(self.templates_path, '.html')) + if self.templates_path: + template_mtime = max(mtimes_of_files(self.templates_path, '.html')) + else: + template_mtime = 0 for docname in self.env.found_docs: if docname not in self.env.all_docs: yield docname @@ -603,6 +606,8 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder): def init(self): self.init_translator_class() + # no templates used, but get_outdated_docs() needs this attribute + self.templates_path = [] def get_target_uri(self, docname, typ=None): if docname == 'index': @@ -627,7 +632,7 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder): # if there is a source file, copy the source file for the # "show source" link if ctx.get('sourcename'): - source_name = path.join(self.outdir, 'sources', + source_name = path.join(self.outdir, '_sources', os_path(ctx['sourcename'])) ensuredir(path.dirname(source_name)) shutil.copyfile(self.env.doc2path(pagename), source_name) diff --git a/sphinx/templates/layout.html b/sphinx/templates/layout.html index b2862c236..d820f329c 100644 --- a/sphinx/templates/layout.html +++ b/sphinx/templates/layout.html @@ -46,8 +46,8 @@ {%- endfor %} {%- else %} - - + + {%- endif %} {%- if builder != 'htmlhelp' %} - - - + + + {%- endif %} {%- block rellinks %} {%- if hasdoc('about') %} diff --git a/sphinx/templates/modindex.html b/sphinx/templates/modindex.html index b33b7fd9d..b54f289f7 100644 --- a/sphinx/templates/modindex.html +++ b/sphinx/templates/modindex.html @@ -32,7 +32,7 @@ {%- else -%}