aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2022-02-07 18:20:07 +0100
committerumarcor <unai.martinezcorral@ehu.eus>2022-02-07 18:41:31 +0100
commitea18eb25e53567a979d40d6cc2d69e1d3e289c93 (patch)
tree322ac3c5916240a339069d134842142f5ad9e0a1
parent76b17599cb66d757e1ced79a8a786c924e409a26 (diff)
downloadghdl-ea18eb25e53567a979d40d6cc2d69e1d3e289c93.tar.gz
ghdl-ea18eb25e53567a979d40d6cc2d69e1d3e289c93.tar.bz2
ghdl-ea18eb25e53567a979d40d6cc2d69e1d3e289c93.zip
doc/conf: fall back to 'alabaster' if '_theme' does not exist
-rw-r--r--doc/conf.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/doc/conf.py b/doc/conf.py
index fc1888b6a..8b01b32c7 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -2,10 +2,14 @@
import sys
from os.path import abspath
from pathlib import Path
-from json import loads
+from json import loads as json_loads
from pyTooling.Packaging import extractVersionInformation
+
+ROOT = Path(__file__).resolve().parent
+
+
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -79,16 +83,24 @@ except Exception as ex:
# ==============================================================================
# Options for HTML output
# ==============================================================================
-html_theme = "_theme"
-html_theme_path = ["."]
-html_theme_options = {
- 'logo_only': True,
- 'home_breadcrumbs': False,
- 'vcs_pageview_mode': 'blob',
-}
-html_css_files = [
- "theme_overrides.css",
-]
+html_context = {}
+ctx = ROOT / "context.json"
+if ctx.is_file():
+ html_context.update(json_loads(ctx.open("r").read()))
+
+if (ROOT / "_theme").is_dir():
+ html_theme_path = ["."]
+ html_theme = "_theme"
+ html_theme_options = {
+ "logo_only": True,
+ "home_breadcrumbs": False,
+ "vcs_pageview_mode": "blob",
+ }
+ html_css_files = [
+ "theme_overrides.css",
+ ]
+else:
+ html_theme = "alabaster"
html_static_path = ['_static']
# '/public' will contain the output from gnatdoc
@@ -97,10 +109,6 @@ html_extra_path = [str(Path(__file__).resolve().parent.parent / 'public')] # F
html_logo = str(Path(html_static_path[0]) / 'logo.png')
html_favicon = str(Path(html_static_path[0]) / 'icon.png')
-html_context = {}
-ctx = Path(__file__).resolve().parent / 'context.json'
-if ctx.is_file():
- html_context.update(loads(ctx.open('r').read()))
# ==============================================================================
# Options for manual page output