diff --git a/CHANGES b/CHANGES index b61dd1285..aff10e9a3 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,8 @@ New features added * The new `exclude_trees` config option can be used to exclude whole subtrees from the search for source files. +* The directories in the `html_static_path` can now contain subdirectories. + Bugs fixed ---------- diff --git a/doc/config.rst b/doc/config.rst index 50628c17a..ed1b7b149 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -202,6 +202,9 @@ that use Sphinx' HTMLWriter class. files, so a file named :file:`default.css` will overwrite the builtin :file:`default.css`. + .. versionchanged:: 0.4 + The paths in :confval:`html_static_path` can now contain subdirectories. + .. confval:: html_last_updated_fmt If this is not the empty string, a 'Last updated on:' timestamp is inserted diff --git a/sphinx/builder.py b/sphinx/builder.py index 0fd838481..b7ab1bf4d 100644 --- a/sphinx/builder.py +++ b/sphinx/builder.py @@ -507,8 +507,14 @@ class StandaloneHTMLBuilder(Builder): for spath in self.config.html_static_path] for staticdirname in staticdirnames: for filename in os.listdir(staticdirname): - if not filename.startswith('.'): - shutil.copyfile(path.join(staticdirname, filename), + if filename.startswith('.'): + continue + fullname = path.join(staticdirname, filename) + if path.isfile(fullname): + shutil.copyfile(fullname, + path.join(self.outdir, '_static', filename)) + elif path.isdir(fullname): + shutil.copytree(fullname, path.join(self.outdir, '_static', filename)) # add pygments style file f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')