diff options
Diffstat (limited to 'sphinx/builders/htmlhelp.py')
-rw-r--r-- | sphinx/builders/htmlhelp.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index ec86740e1..9ba7ae9b0 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -22,13 +22,14 @@ from sphinx.config import string_classes from sphinx.environment.adapters.indexentries import IndexEntries from sphinx.locale import __ from sphinx.util import logging -from sphinx.util.osutil import make_filename +from sphinx.util.osutil import make_filename_from_project from sphinx.util.pycompat import htmlescape if False: # For type annotation from typing import Any, Dict, IO, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA + from sphinx.config import Config # NOQA from sphinx.util.typing import unicode # NOQA @@ -337,12 +338,18 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): f.write('</UL>\n') +def default_htmlhelp_basename(config): + # type: (Config) -> unicode + """Better default htmlhelp_basename setting.""" + return make_filename_from_project(config.project) + 'doc' + + def setup(app): # type: (Sphinx) -> Dict[unicode, Any] app.setup_extension('sphinx.builders.html') app.add_builder(HTMLHelpBuilder) - app.add_config_value('htmlhelp_basename', lambda self: make_filename(self.project), None) + app.add_config_value('htmlhelp_basename', default_htmlhelp_basename, None) app.add_config_value('htmlhelp_file_suffix', None, 'html', string_classes) app.add_config_value('htmlhelp_link_suffix', None, 'html', string_classes) |