diff options
| author | Georg Brandl <georg@python.org> | 2010-01-03 19:30:32 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-01-03 19:30:32 +0100 |
| commit | 0afca45dbc97654e489df0367bf92d9b4803cf78 (patch) | |
| tree | 5530fabd691078372fcfc54fe30890a2ec268063 | |
| parent | 0a1aa785f4bb26fd944ef957f67c6e1b630158fb (diff) | |
| download | sphinx-0afca45dbc97654e489df0367bf92d9b4803cf78.tar.gz | |
Make inventory dumping a separate method.
| -rw-r--r-- | sphinx/builders/html.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index acab7518..c19cc4e7 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -23,7 +23,7 @@ except ImportError: from docutils import nodes from docutils.io import DocTreeInput, StringOutput -from docutils.core import Publisher, publish_parts +from docutils.core import Publisher from docutils.utils import new_document from docutils.frontend import OptionParser from docutils.readers.doctree import Reader as DoctreeReader @@ -701,20 +701,7 @@ class StandaloneHTMLBuilder(Builder): ensuredir(path.dirname(source_name)) copyfile(self.env.doc2path(pagename), source_name) - def handle_finish(self): - self.info(bold('dumping search index... '), nonl=True) - self.indexer.prune(self.env.all_docs) - searchindexfn = path.join(self.outdir, self.searchindex_filename) - # first write to a temporary file, so that if dumping fails, - # the existing index won't be overwritten - f = open(searchindexfn + '.tmp', 'wb') - try: - self.indexer.dump(f, self.indexer_format) - finally: - f.close() - movefile(searchindexfn + '.tmp', searchindexfn) - self.info('done') - + def dump_inventory(self): self.info(bold('dumping object inventory... '), nonl=True) f = open(path.join(self.outdir, INVENTORY_FILENAME), 'wb') try: @@ -736,6 +723,22 @@ class StandaloneHTMLBuilder(Builder): f.close() self.info('done') + def handle_finish(self): + self.info(bold('dumping search index... '), nonl=True) + self.indexer.prune(self.env.all_docs) + searchindexfn = path.join(self.outdir, self.searchindex_filename) + # first write to a temporary file, so that if dumping fails, + # the existing index won't be overwritten + f = open(searchindexfn + '.tmp', 'wb') + try: + self.indexer.dump(f, self.indexer_format) + finally: + f.close() + movefile(searchindexfn + '.tmp', searchindexfn) + self.info('done') + + self.dump_inventory() + class DirectoryHTMLBuilder(StandaloneHTMLBuilder): """ |
