Use openstackdocstheme according to guide

This change alters the api-ref's conf.py to follow the documentation[1].
Functionally, this results in the api-ref using the api_ref theme
options, which adds a dropdown menu to the other API references instead
of to unrelated documentation, and deduplicates the headers.

[1] https://docs.openstack.org/openstackdocstheme/latest/

Change-Id: I706301130efac6b37d97ebd814d9987370d76692
This commit is contained in:
wanghui 2018-03-27 09:53:17 +08:00 committed by Colleen Murphy
parent b357a96ac0
commit de4d72c5f2
1 changed files with 6 additions and 26 deletions

View File

@ -22,19 +22,15 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import subprocess
import warnings
import openstackdocstheme
html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]
html_theme_options = {
"sidebar_dropdown": "api_ref",
"sidebar_mode": "toc",
}
extensions = [
'os_api_ref',
'openstackdocstheme',
]
@ -65,22 +61,12 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Identity API Reference'
copyright = u'2010-present, OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
from keystone import version as keystone_version
# The short X.Y version.
version = keystone_version.release_string()
# The full version, including alpha/beta/rc tags.
release = keystone_version.release_string()
# html_context allows us to pass arbitrary values into the html template
html_context = {"bug_tag": "api-ref",
"bug_project": "keystone"}
# -- Options for openstackdocstheme -------------------------------------------
repository_name = 'openstack/keystone'
bug_project = 'keystone'
bug_tag = 'api-ref'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -165,12 +151,6 @@ pygments_style = 'sphinx'
# using the given strftime format.
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
"-n1"]
try:
html_last_updated_fmt = subprocess.check_output(
git_cmd).decode('utf-8')
except Exception:
warnings.warn('Cannot get last updated time from git repository. '
'Not setting "html_last_updated_fmt".')
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.