| 1 |
"""Astropy Sphinx Theme""" |
| 2 |
|
| 3 |
from pathlib import Path |
| 4 |
|
| 5 |
from pydata_sphinx_theme import utils |
| 6 |
|
| 7 |
|
| 8 |
def get_html_theme_path(): |
| 9 |
return Path(__file__).resolve().parent / "astropy-unified" |
| 10 |
|
| 11 |
|
| 12 |
def update_config(app) -> None: |
| 13 |
# Here we default some config options (i.e. things in conf.py) unless they are set by the user |
| 14 |
# Theme options are defaulted in theme.toml |
| 15 |
|
| 16 |
if not utils.config_provided_by_user(app, "html_logo"): |
| 17 |
app.config.html_logo = str( |
| 18 |
get_html_theme_path() / "static" / "img" / "astropy_logo_notext.svg" |
| 19 |
) |
| 20 |
|
| 21 |
if not utils.config_provided_by_user(app, "html_favicon"): |
| 22 |
app.config.html_favicon = str(get_html_theme_path() / "static" / "img" / "favicon.ico") |
| 23 |
|
| 24 |
|
| 25 |
def setup(app): |
| 26 |
app.add_html_theme("astropy-unified", get_html_theme_path()) |
| 27 |
app.add_css_file("css/astropy.css", priority=650) |
| 28 |
app.connect("builder-inited", update_config, priority=200) |
| 29 |
|
| 30 |
return { |
| 31 |
"parallel_read_safe": True, |
| 32 |
"parallel_write_safe": True, |
| 33 |
} |