MartinPdeS-docs 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/PKG-INFO +1 -1
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/PKG-INFO +1 -1
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/martinpdes_docs/sphinx.py +18 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/pyproject.toml +1 -1
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/tests/test_configuration.py +9 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/SOURCES.txt +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/dependency_links.txt +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/requires.txt +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/top_level.txt +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/README.md +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/martinpdes_docs/__init__.py +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/martinpdes_docs/static/martinpdes_layout.css +0 -0
- {martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/setup.cfg +0 -0
|
@@ -4,6 +4,20 @@ import os
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
def _raster_thumbnail_path(logo: str, favicon: str) -> str | None:
|
|
8
|
+
"""Choose a Sphinx-Gallery-compatible fallback thumbnail.
|
|
9
|
+
|
|
10
|
+
Sphinx-Gallery requires a raster image for ``default_thumb_file``. SVG
|
|
11
|
+
files are valid theme logos and favicons, but are not accepted as gallery
|
|
12
|
+
thumbnail sources by all supported Sphinx-Gallery versions.
|
|
13
|
+
"""
|
|
14
|
+
raster_suffixes = {".png", ".jpg", ".jpeg", ".gif"}
|
|
15
|
+
for candidate in (logo, favicon):
|
|
16
|
+
if Path(candidate).suffix.lower() in raster_suffixes:
|
|
17
|
+
return candidate
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
|
|
7
21
|
def configure(
|
|
8
22
|
*,
|
|
9
23
|
project: str,
|
|
@@ -97,6 +111,10 @@ def configure(
|
|
|
97
111
|
"plot_gallery": True,
|
|
98
112
|
"thumbnail_size": [600, 600],
|
|
99
113
|
"download_all_examples": False,
|
|
114
|
+
# Use the project's favicon for examples that do not create a figure.
|
|
115
|
+
# The path is interpreted relative to the documentation source tree,
|
|
116
|
+
# just like ``html_favicon``.
|
|
117
|
+
"default_thumb_file": _raster_thumbnail_path(logo, favicon),
|
|
100
118
|
"line_numbers": False,
|
|
101
119
|
"remove_config_comments": True,
|
|
102
120
|
"capture_repr": ("_repr_html_", "__repr__"),
|
|
@@ -14,6 +14,15 @@ def test_configuration_has_project_overrides():
|
|
|
14
14
|
assert config["epub_exclude_files"] == ["search.html"]
|
|
15
15
|
assert config["sphinx_gallery_conf"]["image_scrapers"] == ("matplotlib",)
|
|
16
16
|
assert config["sphinx_gallery_conf"]["thumbnail_size"] == [600, 600]
|
|
17
|
+
assert config["sphinx_gallery_conf"]["default_thumb_file"] is None
|
|
18
|
+
|
|
19
|
+
raster = configure(
|
|
20
|
+
project="Example",
|
|
21
|
+
package="example",
|
|
22
|
+
logo="../images/logo.png",
|
|
23
|
+
favicon="_static/favicon.svg",
|
|
24
|
+
)
|
|
25
|
+
assert raster["sphinx_gallery_conf"]["default_thumb_file"] == "../images/logo.png"
|
|
17
26
|
assert "github_url" not in config["html_theme_options"]
|
|
18
27
|
assert config["html_context"]["github_repo"] == "Example"
|
|
19
28
|
|
|
File without changes
|
{martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/MartinPdeS_docs.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{martinpdes_docs-0.1.3 → martinpdes_docs-0.1.4}/martinpdes_docs/static/martinpdes_layout.css
RENAMED
|
File without changes
|
|
File without changes
|