Skip to content

Commit

Permalink
Properly support html_show_sphinx (#206)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <[email protected]>
  • Loading branch information
picnixz and AA-Turner authored Jan 8, 2024
1 parent 285cfcc commit a28affe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions alabaster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ def get_path():
def update_context(app, pagename, templatename, context, doctree):
context["alabaster_version"] = __version__

# Convert 'show_powered_by' in the theme options to
# the preferred option, html_show_sphinx.
html_theme_options = app.config.html_theme_options
if "show_powered_by" in html_theme_options:
show_powered_by = html_theme_options["show_powered_by"]
if isinstance(show_powered_by, str):
context["show_sphinx"] = show_powered_by.lower() == "true"
else:
context["show_sphinx"] = bool(show_powered_by) # to allow int values


def setup(app):
app.require_sphinx("3.4")
Expand Down
4 changes: 2 additions & 2 deletions alabaster/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@
{%- block footer %}
<div class="footer">
{% if show_copyright %}&copy;{{ copyright }}.{% endif %}
{% if theme_show_powered_by|lower == 'true' %}
{% if show_sphinx %}
{% if show_copyright %}|{% endif %}
Powered by <a href="http://sphinx-doc.org/">Sphinx {{ sphinx_version }}</a>
&amp; <a href="https://github.com/sphinx-doc/alabaster">Alabaster {{ alabaster_version }}</a>
{% endif %}
{%- if show_source and has_source and sourcename %}
{% if show_copyright or theme_show_powered_by %}|{% endif %}
{% if show_copyright or show_sphinx %}|{% endif %}
<a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{{ _('Page source') }}</a>
{%- endif %}
Expand Down
4 changes: 4 additions & 0 deletions docs/customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ same.
* ``show_powered_by``: Boolean controlling display of the ``Powered by
Sphinx N.N.N. & Alabaster M.M.M`` section of the footer. When ``true``, is
displayed next to the copyright information; when ``false``, is hidden.

.. deprecated:: 0.17.14
Set ``html_show_sphinx`` to ``True`` or ``False`` in ``conf.py`` instead.

* ``show_relbars``: ``true`` or ``false`` - used to display *next* and
*previous* links above and below the main page content. If you only want to
display one, this setting can be further overridden through the
Expand Down

0 comments on commit a28affe

Please sign in to comment.