Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release 9.1.1 (in development)
==============================

Features added
--------------

* #9093: Import ``basic.css`` in the ``agogo``, ``epub``, ``nonav``,
``scrolls``, and ``traditional`` themes.
Patch by joyboy

Bugs fixed
----------

Expand Down
2 changes: 2 additions & 0 deletions sphinx/themes/agogo/static/agogo.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Sphinx stylesheet -- agogo theme.
*/

@import url("basic.css");

* {
margin: 0px;
padding: 0px;
Expand Down
2 changes: 2 additions & 0 deletions sphinx/themes/epub/static/epub.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Sphinx stylesheet -- epub theme.
*/

@import url("basic.css");

/* -- main layout ----------------------------------------------------------- */

{% if theme_writing_mode is defined %}
Expand Down
2 changes: 2 additions & 0 deletions sphinx/themes/nonav/static/nonav.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Sphinx stylesheet -- nonav theme.
*/

@import url("basic.css");

/* -- main layout ----------------------------------------------------------- */

div.clearer {
Expand Down
2 changes: 2 additions & 0 deletions sphinx/themes/scrolls/static/scrolls.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Sphinx stylesheet -- scrolls theme.
*/

@import url("basic.css");

body {
background-color: #222;
margin: 0;
Expand Down
2 changes: 2 additions & 0 deletions sphinx/themes/traditional/static/traditional.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Sphinx stylesheet -- traditional docs.python.org theme.
*/

@import url("basic.css");

body {
color: #000;
margin: 0;
Expand Down
28 changes: 28 additions & 0 deletions tests/test_theming/test_theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,34 @@ def test_theme_builds(
pytest.fail(f'Failed to parse {html_file.relative_to(app.outdir)}: {exc}')


@pytest.mark.parametrize(
('theme_name', 'css_name'),
[
('agogo', 'agogo.css'),
('epub', 'epub.css'),
('nonav', 'nonav.css'),
('scrolls', 'scrolls.css'),
('traditional', 'traditional.css'),
],
)
def test_bundled_themes_import_basic_css(
make_app: Callable[..., SphinxTestApp],
rootdir: Path,
sphinx_test_tempdir: Path,
theme_name: str,
css_name: str,
) -> None:
"""Bundled themes that inherit ``basic`` should import ``basic.css``."""
testroot_path = rootdir / 'test-basic'
srcdir = sphinx_test_tempdir / f'test-theme-{theme_name}-css'
shutil.copytree(testroot_path, srcdir)

app = make_app(srcdir=srcdir, confoverrides={'html_theme': theme_name})
app.build()
css = (app.outdir / '_static' / css_name).read_text(encoding='utf8')
assert '@import url("basic.css");' in css


def test_config_file_toml() -> None:
config_path = HERE / 'theme.toml'
cfg = _load_theme_toml(config_path)
Expand Down
Loading