From 9b5566dddbc4f09a615a46cc174bcfe6c0375ae4 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 3 May 2008 20:45:43 +0000 Subject: [PATCH] Remove unused files from the HTML help build. --- sphinx/builder.py | 7 ++++--- sphinx/htmlhelp.py | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sphinx/builder.py b/sphinx/builder.py index 8c201727a..550178ad9 100644 --- a/sphinx/builder.py +++ b/sphinx/builder.py @@ -468,15 +468,16 @@ class StandaloneHTMLBuilder(Builder): self.handle_page('modindex', modindexcontext, 'modindex.html') # the search page - self.info(' search', nonl=1) - self.handle_page('search', {}, 'search.html') + if self.name != 'htmlhelp': + self.info(' search', nonl=1) + self.handle_page('search', {}, 'search.html') # additional pages from conf.py for pagename, template in self.config.html_additional_pages.items(): self.info(' '+pagename, nonl=1) self.handle_page(pagename, {}, template) - if self.config.html_use_opensearch: + if self.config.html_use_opensearch and self.name != 'htmlhelp': self.info(' opensearch', nonl=1) fn = path.join(self.outdir, '_static', 'opensearch.xml') self.handle_page('opensearch', {}, 'opensearch.xml', outfilename=fn) diff --git a/sphinx/htmlhelp.py b/sphinx/htmlhelp.py index dfdba9c68..05bc851e1 100644 --- a/sphinx/htmlhelp.py +++ b/sphinx/htmlhelp.py @@ -135,9 +135,10 @@ def build_hhx(builder, outdir, outname): outdir += os.sep olen = len(outdir) for root, dirs, files in os.walk(outdir): + staticdir = (root == path.join(outdir, '_static')) for fn in files: - if fn.endswith('.html') or fn.endswith('.css') or fn.endswith('.js'): - print >>f, path.join(root, fn)[olen:].replace('/', '\\') + if (staticdir and not fn.endswith('.js')) or fn.endswith('.html'): + print >>f, path.join(root, fn)[olen:].replace(os.sep, '\\') finally: f.close()