Skip to content

Commit

Permalink
Fix sphinx-doc#5246: Add :confval:singlehtml_sidebars to configure …
Browse files Browse the repository at this point in the history
…sidebars for singlehtml
  • Loading branch information
tk0miya committed Aug 4, 2018
1 parent e5a3f67 commit fc44de5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ Features added
* #5140: linkcheck: Add better Accept header to HTTP client
* #4614: sphinx-build: Add ``--keep-going`` option to show all warnings
* Add :rst:role:`math:numref` role to refer equations (Same as :rst:role:`eq`)
* #5246: Add :confval:`singlehtml_sidebars` to configure sidebars for singlehtml
builder

Bugs fixed
----------
Expand Down
9 changes: 9 additions & 0 deletions doc/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,15 @@ that use Sphinx's HTMLWriter class.

.. versionadded:: 1.6

Options for Single HTML output
-------------------------------

.. confval:: singlehtml_sidebars

Custom sidebar templates, must be a dictionary that maps document names to
template names. For more information, refer to :confval:`html_sidebars`.
By default, it is same as :confval:`html_sidebars`.


.. _htmlhelp-options:

Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,8 @@ def has_wildcard(pattern):
sidebars = [name.strip() for name in theme_default_sidebars.split(',')]

# user sidebar settings
for pattern, patsidebars in iteritems(self.config.html_sidebars):
html_sidebars = self.get_builder_config('sidebars', 'html')
for pattern, patsidebars in iteritems(html_sidebars):
if patmatch(pagename, pattern):
if matched:
if has_wildcard(pattern):
Expand Down Expand Up @@ -1714,6 +1715,8 @@ def setup(app):
app.add_config_value('html_baseurl', '', 'html')
app.add_config_value('html_math_renderer', None, 'env')

app.add_config_value('singlehtml_sidebars', lambda self: self.html_sidebars, 'html')

# event handlers
app.connect('config-inited', convert_html_css_files)
app.connect('config-inited', convert_html_js_files)
Expand Down

0 comments on commit fc44de5

Please sign in to comment.