summaryrefslogtreecommitdiff
path: root/sphinx/builders/htmlhelp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-09-06 23:41:24 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-02 11:30:40 +0900
commit5e1c45355e795f3e695c61fbc1ddfc3fe3df3484 (patch)
tree87ebc5ec6616bab71ec04f3c6cffc88eacbd4764 /sphinx/builders/htmlhelp.py
parente527be396a761a8d3a2c8788d766363a01bc1810 (diff)
downloadsphinx-git-5e1c45355e795f3e695c61fbc1ddfc3fe3df3484.tar.gz
quickstart: Simplify generated conf.py (for htmlhelp)
Diffstat (limited to 'sphinx/builders/htmlhelp.py')
-rw-r--r--sphinx/builders/htmlhelp.py11
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)