summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-12-04 11:02:02 -0500
committerDavid Robillard <d@drobilla.net>2022-12-04 11:02:02 -0500
commit9d652e28f4de41fe3280d6bd4a4b80270d1d655b (patch)
treef469d4c92a0ca8fb46961c9dcd0c4030ae407654 /doc
parent94ee6538f7a7790854ce33a68adf0834a27a232b (diff)
downloadzix-9d652e28f4de41fe3280d6bd4a4b80270d1d655b.tar.gz
zix-9d652e28f4de41fe3280d6bd4a4b80270d1d655b.tar.bz2
zix-9d652e28f4de41fe3280d6bd4a4b80270d1d655b.zip
Fall back to alabaster if sphinx_lv2_theme is unavailable
Diffstat (limited to 'doc')
-rw-r--r--doc/_static/custom.css12
-rw-r--r--doc/conf.py.in108
-rw-r--r--doc/meson.build12
3 files changed, 99 insertions, 33 deletions
diff --git a/doc/_static/custom.css b/doc/_static/custom.css
new file mode 100644
index 0000000..c5fe824
--- /dev/null
+++ b/doc/_static/custom.css
@@ -0,0 +1,12 @@
+/* Copyright 2022 David Robillard <d@drobilla.net> */
+/* SPDX-License-Identifier: 0BSD or ISC */
+
+section > dl {
+ margin-bottom: 30px;
+}
+
+.struct > dd > dl.member > dt,
+.enum > dd > dl.member > dt,
+.enum-class > dd > dl.member > dt {
+ padding: 15px 0 0;
+}
diff --git a/doc/conf.py.in b/doc/conf.py.in
index cefa9e9..1fa288f 100644
--- a/doc/conf.py.in
+++ b/doc/conf.py.in
@@ -17,6 +17,13 @@ language = "en"
nitpicky = True
pygments_style = "friendly"
+try:
+ import sphinx_lv2_theme
+
+ have_lv2_theme = True
+except ModuleNotFoundError:
+ have_lv2_theme = False
+
# Ignore everything opaque or external for nitpicky mode
_opaque = [
"FILE",
@@ -56,38 +63,73 @@ nitpick_ignore = list(_c_nitpick_ignore) + list(_cpp_nitpick_ignore)
html_copy_source = False
html_secnumber_suffix = " "
html_short_title = "@ZIX_TITLE@"
-html_theme = "sphinx_lv2_theme"
-
-if tags.has("singlehtml"):
- html_sidebars = {
- "**": [
- "globaltoc.html",
- ]
- }
-
- html_theme_options = {
- "body_max_width": "46em",
- "body_min_width": "46em",
- "description": desc,
- "globaltoc_collapse": False,
- "globaltoc_maxdepth": 3,
- "logo_name": True,
- "nosidebar": False,
- "page_width": "80em",
- "show_footer_version": True,
- "show_logo_version": True,
- "sidebar_width": "14em",
- }
+if have_lv2_theme:
+ html_theme = "sphinx_lv2_theme"
+
+ if tags.has("singlehtml"):
+ html_sidebars = {
+ "**": [
+ "globaltoc.html",
+ ]
+ }
+
+ html_theme_options = {
+ "body_max_width": "46em",
+ "body_min_width": "46em",
+ "description": desc,
+ "globaltoc_collapse": False,
+ "globaltoc_maxdepth": 3,
+ "logo_name": True,
+ "nosidebar": False,
+ "page_width": "80em",
+ "show_footer_version": True,
+ "show_logo_version": True,
+ "sidebar_width": "14em",
+ }
+
+ else:
+ html_theme_options = {
+ "body_max_width": "60em",
+ "body_min_width": "46em",
+ "description": desc,
+ "logo_name": True,
+ "nosidebar": True,
+ "page_width": "60em",
+ "show_footer_version": True,
+ "show_logo_version": True,
+ "sidebar_width": "14em",
+ }
else:
- html_theme_options = {
- "body_max_width": "60em",
- "body_min_width": "46em",
- "description": desc,
- "logo_name": True,
- "nosidebar": True,
- "page_width": "60em",
- "show_footer_version": True,
- "show_logo_version": True,
- "sidebar_width": "14em",
- }
+ html_theme = "alabaster"
+ html_static_path = ["@ZIX_SRCDIR@/doc/_static"]
+
+ if tags.has("singlehtml"):
+ html_sidebars = {
+ "**": [
+ "globaltoc.html",
+ ]
+ }
+
+ html_theme_options = {
+ "body_max_width": "48em",
+ "body_min_width": "48em",
+ "description": desc,
+ "globaltoc_collapse": False,
+ "globaltoc_maxdepth": 3,
+ "logo_name": True,
+ "nosidebar": False,
+ "page_width": "80em",
+ "sidebar_width": "16em",
+ }
+
+ else:
+ html_theme_options = {
+ "body_max_width": "60em",
+ "body_min_width": "40em",
+ "description": desc,
+ "logo_name": True,
+ "nosidebar": True,
+ "page_width": "60em",
+ "show_relbars": True,
+ }
diff --git a/doc/meson.build b/doc/meson.build
index 74c66f2..4f316a3 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -15,6 +15,18 @@ endif
build_docs = doxygen.found() and sphinxygen.found() and sphinx_build.found()
if build_docs
+ # Check for Sphinx LV2 theme
+
+ pymod = import('python')
+ sphinx_lv2_theme_python = pymod.find_installation(
+ modules: ['sphinx_lv2_theme'],
+ required: false
+ )
+
+ if not sphinx_lv2_theme_python.found()
+ warning('Missing sphinx_lv2_theme module, falling back to alabaster')
+ endif
+
# Documentation Code
if not get_option('tests').disabled()