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
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Contributors
* Matthew Woodcraft -- text output improvements
* Matthias Geier -- style improvements
* Michael Droettboom -- inheritance_diagram extension
* Michael Hughes -- Merge inherited stylesheets in HTML themes
* Michael Wilson -- Intersphinx HTTP basic auth support
* Nathan Damon -- bugfix in validation of static paths in html builders
* Nils Kattenbeck -- pygments dark style
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ Bugs fixed
* LaTeX: Fix accidental removal at ``3.5.0`` (#8854) of the documentation of
``literalblockcappos`` key of :ref:`'sphinxsetup' <latexsphinxsetup>`.
Patch by Jean-François B.
* #9093: Merge inherited stylesheets in HTML themes instead of overwriting.
Patch by Michael Hughes
48 changes: 28 additions & 20 deletions sphinx/ext/autosummary/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,19 +873,23 @@ def find_autosummary_in_lines(
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS] <SOURCE_FILE>...',
epilog=__('For more information, visit <https://www.sphinx-doc.org/>.'),
description=__("""
Generate ReStructuredText using autosummary directives.
epilog=str(__('For more information, visit <https://www.sphinx-doc.org/>.')),
description=str(
__(
"""
Generate ReStructuredText using autosummary directives.

sphinx-autogen is a frontend to sphinx.ext.autosummary.generate. It generates
the reStructuredText files from the autosummary directives contained in the
given input files.
sphinx-autogen is a frontend to sphinx.ext.autosummary.generate. It generates
the reStructuredText files from the autosummary directives contained in the
given input files.

The format of the autosummary directive is documented in the
``sphinx.ext.autosummary`` Python module and can be read using::
The format of the autosummary directive is documented in the
``sphinx.ext.autosummary`` Python module and can be read using::

pydoc sphinx.ext.autosummary
"""),
pydoc sphinx.ext.autosummary
"""
)
),
)

parser.add_argument(
Expand All @@ -896,58 +900,62 @@ def get_parser() -> argparse.ArgumentParser:
)

parser.add_argument(
'source_file', nargs='+', help=__('source files to generate rST files for')
'source_file',
nargs='+',
help=__('source files to generate rST files for'),
)

parser.add_argument(
'-o',
'--output-dir',
action='store',
dest='output_dir',
help=__('directory to place all output in'),
help=str(__('directory to place all output in')),
)
parser.add_argument(
'-s',
'--suffix',
action='store',
dest='suffix',
default='rst',
help=__('default suffix for files (default: %(default)s)'),
help=str(__('default suffix for files (default: %(default)s)')),
)
parser.add_argument(
'-t',
'--templates',
action='store',
dest='templates',
default=None,
help=__('custom template directory (default: %(default)s)'),
help=str(__('custom template directory (default: %(default)s)')),
)
parser.add_argument(
'-i',
'--imported-members',
action='store_true',
dest='imported_members',
default=False,
help=__('document imported members (default: %(default)s)'),
help=str(__('document imported members (default: %(default)s)')),
)
parser.add_argument(
'-a',
'--respect-module-all',
action='store_true',
dest='respect_module_all',
default=False,
help=__(
'document exactly the members in module __all__ attribute. '
'(default: %(default)s)'
help=str(
__(
'document exactly the members in module __all__ attribute. '
'(default: %(default)s)'
)
),
)
parser.add_argument(
'--remove-old',
action='store_true',
dest='remove_old',
default=False,
help=__(
'Remove existing files in the output directory that were not generated'
help=str(
__('Remove existing files in the output directory that were not generated')
),
)

Expand Down
8 changes: 6 additions & 2 deletions sphinx/theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ def __init__(
self.pygments_style_dark: str | None = None
for config in reversed(configs.values()):
options |= config.options
if config.stylesheets is not None:
self.stylesheets = config.stylesheets
for stylesheet in config.stylesheets or ():
# Force conversion to string to resolve TranslationProxies
# and avoid TypeErrors during membership checks.
stylesheet_str = str(stylesheet)
if stylesheet_str not in self.stylesheets:
self.stylesheets += (stylesheet_str,)
if config.sidebar_templates is not None:
self.sidebar_templates = config.sidebar_templates
if config.pygments_style_default is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_builders/test_build_html_numfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@pytest.mark.sphinx('html', testroot='numfig')
@pytest.mark.test_params(shared_result='test_build_html_numfig')
def test_numfig_disabled_warn(app: SphinxTestApp) -> None:
app.build()
app.build(force_all=True)
warnings = app.warning.getvalue()
assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' in warnings
assert 'index.rst:56: WARNING: invalid numfig_format: invalid' not in warnings
Expand Down
3 changes: 2 additions & 1 deletion tests/test_theming/test_theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_theme_api(app: SphinxTestApp) -> None:
assert len(theme.get_theme_dirs()) == 2

# direct setting
assert theme.get_config('theme', 'stylesheet') == 'custom.css'
assert theme.get_config('theme', 'stylesheet') == 'basic.css, custom.css'
# inherited setting
assert theme.get_config('options', 'nosidebar') == 'false'
# nonexisting setting
Expand Down Expand Up @@ -169,6 +169,7 @@ def test_dark_style(app: SphinxTestApp, monkeypatch: pytest.MonkeyPatch) -> None
assert css_file.attributes['media'] == '(prefers-color-scheme: dark)'

assert sorted(str(f.filename) for f in app.builder._css_files) == [
'_static/basic.css',
'_static/classic.css',
'_static/pygments.css',
'_static/pygments_dark.css',
Expand Down
Loading