Allow subdirs in html_static_path.

This commit is contained in:
Georg Brandl 2008-05-24 16:40:11 +00:00
parent 5eaf2eb29a
commit 28c3199018
3 changed files with 13 additions and 2 deletions

View File

@ -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
----------

View File

@ -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

View File

@ -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')