mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
HTML themes can set up default sidebars through `theme.conf`
This commit is contained in:
@@ -12,6 +12,9 @@ Sphinx uses reStructuredText as its markup language, and many of its strengths
|
||||
come from the power and straightforwardness of reStructuredText and its parsing
|
||||
and translating suite, the Docutils.
|
||||
|
||||
features
|
||||
--------
|
||||
|
||||
Among its features are the following:
|
||||
|
||||
* Output formats: HTML (including derivative formats such as HTML Help, Epub
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
[theme]
|
||||
inherit = classic
|
||||
sidebars = globaltoc.html, searchbox.html
|
||||
|
||||
@@ -1245,3 +1245,21 @@ def test_html_remote_images(app, status, warning):
|
||||
assert ('<img alt="https://www.python.org/static/img/python-logo.png" '
|
||||
'src="https://www.python.org/static/img/python-logo.png" />' in result)
|
||||
assert not (app.outdir / 'python-logo.png').exists()
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='basic')
|
||||
def test_html_sidebar(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'index.html').text(encoding='utf8')
|
||||
assert '<h3><a href="#">Table Of Contents</a></h3>' in result
|
||||
assert '<h3>Related Topics</h3>' in result
|
||||
assert '<h3>This Page</h3>' in result
|
||||
assert '<h3>Quick search</h3>' in result
|
||||
|
||||
app.config.html_sidebars = {'**': []}
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'index.html').text(encoding='utf8')
|
||||
assert '<h3><a href="#">Table Of Contents</a></h3>' not in result
|
||||
assert '<h3>Related Topics</h3>' not in result
|
||||
assert '<h3>This Page</h3>' not in result
|
||||
assert '<h3>Quick search</h3>' not in result
|
||||
|
||||
@@ -95,3 +95,15 @@ def test_double_inheriting_theme(app, status, warning):
|
||||
def test_nested_zipped_theme(app, status, warning):
|
||||
assert app.builder.theme.name == 'child'
|
||||
app.build() # => not raises TemplateNotFound
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='theming')
|
||||
def test_theme_sidebars(app, status, warning):
|
||||
app.build()
|
||||
|
||||
# test-theme specifies globaltoc and searchbox as default sidebars
|
||||
result = (app.outdir / 'index.html').text(encoding='utf8')
|
||||
assert '<h3><a href="#">Table Of Contents</a></h3>' in result
|
||||
assert '<h3>Related Topics</h3>' not in result
|
||||
assert '<h3>This Page</h3>' not in result
|
||||
assert '<h3>Quick search</h3>' in result
|
||||
|
||||
Reference in New Issue
Block a user