mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added the epub theme options relbar1 and footer.
This commit is contained in:
parent
f107cf7787
commit
0da0c03b53
@ -770,6 +770,12 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
output is usually not wise. This defaults to ``'epub'``, a theme designed to
|
output is usually not wise. This defaults to ``'epub'``, a theme designed to
|
||||||
save visual space.
|
save visual space.
|
||||||
|
|
||||||
|
.. confval:: epub_theme_options
|
||||||
|
|
||||||
|
A dictionary of options that influence the look and feel of the selected
|
||||||
|
theme. These are theme-specific. For the options understood by the builtin
|
||||||
|
themes, see :ref:`this section <builtin-themes>`.
|
||||||
|
|
||||||
.. confval:: epub_title
|
.. confval:: epub_title
|
||||||
|
|
||||||
The title of the document. It defaults to the :confval:`html_title` option
|
The title of the document. It defaults to the :confval:`html_title` option
|
||||||
|
@ -200,10 +200,14 @@ These themes are:
|
|||||||
* **traditional** -- A theme resembling the old Python documentation. There are
|
* **traditional** -- A theme resembling the old Python documentation. There are
|
||||||
currently no options beyond *nosidebar* and *sidebarwidth*.
|
currently no options beyond *nosidebar* and *sidebarwidth*.
|
||||||
|
|
||||||
* **epub** -- A theme for the epub builder. There are currently no options.
|
* **epub** -- A theme for the epub builder. This theme tries to save visual
|
||||||
This theme tries to save visual space which is a sparse resource on ebook
|
space which is a sparse resource on ebook readers. The following options
|
||||||
readers.
|
are supported:
|
||||||
|
|
||||||
|
- **relbar1** (true or false, default true): If this is true, the
|
||||||
|
`relbar1` block is inserted in the epub output, otherwise it is omitted.
|
||||||
|
- **footer** (true or false, default true): If this is true, the
|
||||||
|
`footer` block is inserted in the epub output, otherwise it is ommitted.
|
||||||
|
|
||||||
Creating themes
|
Creating themes
|
||||||
---------------
|
---------------
|
||||||
|
@ -174,7 +174,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
|||||||
self.playorder = 0
|
self.playorder = 0
|
||||||
|
|
||||||
def get_theme_config(self):
|
def get_theme_config(self):
|
||||||
return self.config.epub_theme, {}
|
return self.config.epub_theme, self.config.epub_theme_options
|
||||||
|
|
||||||
# generic support functions
|
# generic support functions
|
||||||
def make_id(self, name):
|
def make_id(self, name):
|
||||||
|
@ -122,6 +122,7 @@ class Config(object):
|
|||||||
# Epub options
|
# Epub options
|
||||||
epub_basename = (lambda self: make_filename(self.project), None),
|
epub_basename = (lambda self: make_filename(self.project), None),
|
||||||
epub_theme = ('epub', 'html'),
|
epub_theme = ('epub', 'html'),
|
||||||
|
epub_theme_options = ({}, 'html'),
|
||||||
epub_title = (lambda self: self.html_title, 'html'),
|
epub_title = (lambda self: self.html_title, 'html'),
|
||||||
epub_author = ('unknown', 'html'),
|
epub_author = ('unknown', 'html'),
|
||||||
epub_language = (lambda self: self.language or 'en', 'html'),
|
epub_language = (lambda self: self.language or 'en', 'html'),
|
||||||
|
@ -14,3 +14,12 @@
|
|||||||
{% block sidebar2 %}{% endblock %}
|
{% block sidebar2 %}{% endblock %}
|
||||||
{% block relbar2 %}{% endblock %}
|
{% block relbar2 %}{% endblock %}
|
||||||
{% block linktags %}{% endblock %}
|
{% block linktags %}{% endblock %}
|
||||||
|
|
||||||
|
{# redefine relbar1 and footer to only call super if options are true #}
|
||||||
|
{%- block relbar1 %}
|
||||||
|
{% if theme_relbar1|tobool %}{{ super() }}{% endif %}
|
||||||
|
{%- endblock %}
|
||||||
|
{%- block footer %}
|
||||||
|
{% if theme_footer|tobool %}{{ super() }}{% endif %}
|
||||||
|
{%- endblock %}
|
||||||
|
|
||||||
|
@ -2,3 +2,7 @@
|
|||||||
inherit = basic
|
inherit = basic
|
||||||
stylesheet = epub.css
|
stylesheet = epub.css
|
||||||
pygments_style = none
|
pygments_style = none
|
||||||
|
|
||||||
|
[options]
|
||||||
|
relbar1 = true
|
||||||
|
footer = true
|
||||||
|
Loading…
Reference in New Issue
Block a user