diff options
Diffstat (limited to 'sphinx/builders/htmlhelp.py')
| -rw-r--r-- | sphinx/builders/htmlhelp.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index b1a5d7dda..cdb51b2c6 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -18,6 +18,7 @@ from os import path from docutils import nodes from sphinx import addnodes +from sphinx.util.osutil import make_filename from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.util.pycompat import htmlescape @@ -63,7 +64,7 @@ Binary Index=No Compiled file=%(outname)s.chm Contents file=%(outname)s.hhc Default Window=%(outname)s -Default topic=index.html +Default topic=%(master_doc)s Display compile progress=No Full text search stop list file=%(outname)s.stp Full-text search=Yes @@ -73,7 +74,7 @@ Title=%(title)s [WINDOWS] %(outname)s="%(title)s","%(outname)s.hhc","%(outname)s.hhk",\ -"index.html","index.html",,,,,0x63520,220,0x10384e,[0,0,1024,768],,,,,,,0 +"%(master_doc)s","%(master_doc)s",,,,,0x63520,220,0x10384e,[0,0,1024,768],,,,,,,0 [FILES] ''' @@ -183,6 +184,7 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): StandaloneHTMLBuilder.init(self) # the output files for HTML help must be .html only self.out_suffix = '.html' + self.link_suffix = '.html' # determine the correct locale setting locale = chm_locales.get(self.config.language) if locale is not None: @@ -204,11 +206,14 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): self.info('writing project file...') with self.open_file(outdir, outname+'.hhp') as f: - f.write(project_template % {'outname': outname, - 'title': self.config.html_title, - 'version': self.config.version, - 'project': self.config.project, - 'lcid': self.lcid}) + f.write(project_template % { + 'outname': outname, + 'title': self.config.html_title, + 'version': self.config.version, + 'project': self.config.project, + 'lcid': self.lcid, + 'master_doc': self.config.master_doc + self.out_suffix + }) if not outdir.endswith(os.sep): outdir += os.sep olen = len(outdir) @@ -225,7 +230,7 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): f.write(contents_header) # special books f.write('<LI> ' + object_sitemap % (self.config.html_short_title, - 'index.html')) + self.config.master_doc + self.out_suffix)) for indexname, indexcls, content, collapse in self.domain_indices: f.write('<LI> ' + object_sitemap % (indexcls.localname, '%s.html' % indexname)) @@ -292,3 +297,10 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): for title, (refs, subitems, key_) in group: write_index(title, refs, subitems) f.write('</UL>\n') + + +def setup(app): + app.setup_extension('sphinx.builders.html') + app.add_builder(HTMLHelpBuilder) + + app.add_config_value('htmlhelp_basename', lambda self: make_filename(self.project), None) |
