From c6441aeba36302ee409ce0592b0d0d24ec74c5b6 Mon Sep 17 00:00:00 2001 From: Graham Hayes Date: Fri, 19 Aug 2016 14:35:21 +0100 Subject: [PATCH] Get ready for os-api-ref sphinx theme change Change-Id: Ib4c12c5f2efbdf0870fbaaf4951bcfe2fcf7c392 --- api-ref/source/conf.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 6dfcca6814..ee9117a53c 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -28,6 +28,36 @@ import os import subprocess import sys +# TODO(Graham Hayes): Remove the following block of code when os-api-ref is +# using openstackdocstheme + +import os_api_ref + +if getattr(os_api_ref, 'THEME', 'olsosphinx') == 'openstackdocstheme': + # We are on the new version with openstackdocstheme support + + extensions = [ + 'os_api_ref', + ] + + import openstackdocstheme # noqa + + html_theme = 'openstackdocs' + html_theme_path = [openstackdocstheme.get_html_theme_path()] + html_theme_options = { + "sidebar_mode": "toc", + } + +else: + # We are on the old version without openstackdocstheme support + + extensions = [ + 'os_api_ref', + 'oslosphinx', + ] + +# End temporary block + # 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. @@ -40,11 +70,6 @@ sys.path.insert(0, os.path.abspath('./')) # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'os_api_ref', - 'oslosphinx', -] - # The suffix of source filenames. source_suffix = '.rst'