Skip to content

Commit bb18071

Browse files
committed
updated formatting
1 parent a8c6d9b commit bb18071

3 files changed

Lines changed: 59 additions & 8 deletions

File tree

docs/_static/custom.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.wy-side-nav-search > a.icon.icon-home {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: center;
5+
gap: 0.5rem;
6+
text-align: center;
7+
}
8+
9+
.wy-side-nav-search > a.icon.icon-home::before {
10+
display: none;
11+
}
12+
13+
.wy-side-nav-search > a.icon.icon-home img.logo {
14+
order: -1;
15+
margin: 0;
16+
}

docs/_templates/.gitkeep

Whitespace-only changes.

docs/conf.py

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
from __future__ import annotations
44

5+
import os
6+
import re
57
import sys
68
from pathlib import Path
79

10+
from sphinx.application import Sphinx
11+
12+
autoclass_content = "both"
13+
814
ROOT = Path(__file__).resolve().parents[1]
915
sys.path.insert(0, str(ROOT / "src"))
1016

@@ -28,16 +34,45 @@
2834
autosummary_imported_members = True
2935
nitpicky = True
3036

31-
templates_path: list[str] = []
37+
templates_path = ["_templates"]
3238
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
3339

34-
try:
35-
import sphinx_rtd_theme # noqa: F401
36-
40+
if os.environ.get("READTHEDOCS") == "True":
3741
html_theme = "sphinx_rtd_theme"
38-
except ImportError:
39-
html_theme = "alabaster"
42+
else:
43+
try:
44+
import sphinx_rtd_theme # noqa: F401
4045

41-
html_static_path: list[str] = []
46+
html_theme = "sphinx_rtd_theme"
47+
except ImportError:
48+
html_theme = "alabaster"
49+
50+
html_static_path = ["_static"]
51+
html_css_files = ["custom.css"]
4252
html_logo = "drc.png"
43-
html_theme_options = {"logo_only": True}
53+
html_title = project
54+
if html_theme == "sphinx_rtd_theme":
55+
html_theme_options = {"logo_only": False}
56+
else:
57+
html_theme_options = {}
58+
59+
_VIEWPORT_META_RE = re.compile(r'<meta name="viewport"[^>]*>', re.IGNORECASE)
60+
61+
62+
def _dedupe_viewport_meta(
63+
app: object,
64+
pagename: str,
65+
templatename: str,
66+
context: dict[str, object],
67+
doctree: object,
68+
) -> None:
69+
"""Keep one viewport tag by removing extra entries from Sphinx metatags."""
70+
del app, pagename, templatename, doctree
71+
metatags = context.get("metatags")
72+
if isinstance(metatags, str):
73+
context["metatags"] = _VIEWPORT_META_RE.sub("", metatags)
74+
75+
76+
def setup(app: Sphinx) -> None:
77+
"""Register build-time hooks."""
78+
app.connect("html-page-context", _dedupe_viewport_meta)

0 commit comments

Comments
 (0)