diff options
author | David Robillard <d@drobilla.net> | 2021-01-16 13:48:10 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-16 13:48:10 +0100 |
commit | 5b36fcfb68562525e1ff8b2adb4582003067cb4b (patch) | |
tree | b83047b8dccde734df734a6bf2e1482696d6847e /doc/conf.py.in | |
parent | 4791d8dfc7f0cdf568bfe1efd5c53c1b818b2a81 (diff) | |
download | serd-5b36fcfb68562525e1ff8b2adb4582003067cb4b.tar.gz serd-5b36fcfb68562525e1ff8b2adb4582003067cb4b.tar.bz2 serd-5b36fcfb68562525e1ff8b2adb4582003067cb4b.zip |
Add fallback configuration if documentation theme is unavailable
Diffstat (limited to 'doc/conf.py.in')
-rw-r--r-- | doc/conf.py.in | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/doc/conf.py.in b/doc/conf.py.in index 170ae1b1..9375f0dc 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -12,6 +12,12 @@ 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", @@ -42,44 +48,62 @@ nitpick_ignore = list(map(lambda x: ("c:identifier", x), _opaque)) # HTML output html_static_path = ["_static"] -html_theme = "sphinx_lv2_theme" html_copy_source = False html_short_title = "Serd" -if tags.has('singlehtml'): - html_sidebars = { - "**": [ - "globaltoc.html", - ] - } +if have_lv2_theme: + html_theme = "sphinx_lv2_theme" - html_theme_options = { - "body_max_width": "48em", - "body_min_width": "48em", - "description": "A lightweight library for working with RDF", - "show_footer_version": True, - "show_logo_version": False, - "logo": "serd.svg", - "logo_name": True, - "logo_width": "8em", - "nosidebar": False, - "page_width": "80em", - "sidebar_width": "18em", - "globaltoc_maxdepth": 3, - "globaltoc_collapse": False, - } + if tags.has('singlehtml'): + html_sidebars = { + "**": [ + "globaltoc.html", + ] + } + + html_theme_options = { + "body_max_width": "48em", + "body_min_width": "48em", + "description": "A lightweight library for working with RDF", + "show_footer_version": True, + "show_logo_version": False, + "logo": "serd.svg", + "logo_name": True, + "logo_width": "8em", + "nosidebar": False, + "page_width": "80em", + "sidebar_width": "18em", + "globaltoc_maxdepth": 3, + "globaltoc_collapse": False, + } + + else: + html_theme_options = { + "body_max_width": "60em", + "body_min_width": "40em", + "description": "A lightweight library for working with RDF", + "show_footer_version": True, + "show_logo_version": False, + "logo": "serd.svg", + "logo_name": True, + "logo_width": "8em", + "nosidebar": True, + "page_width": "60em", + "sidebar_width": "14em", + "globaltoc_maxdepth": 1, + "globaltoc_collapse": True, + } else: + + html_theme = "alabaster" + html_theme_options = { "body_max_width": "60em", "body_min_width": "40em", "description": "A lightweight library for working with RDF", - "show_footer_version": True, - "show_logo_version": False, "logo": "serd.svg", "logo_name": True, - "logo_width": "8em", - "nosidebar": True, "page_width": "60em", "sidebar_width": "14em", "globaltoc_maxdepth": 1, |