Follow the OpenStack Sphinx theme configuration

Follow docs[1] and update the sphinx theme configuration,
Also updated bug_tag values for api-ref and documentation.

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

Co-authored-by: wanghui <wang_hui@inspur.com>

Closes-bug: #1768365
Change-Id: I76308497122f4522fe307b3c29b696780e073027
This commit is contained in:
junboli 2018-05-01 15:02:30 +08:00
parent 0503579bcf
commit 927aaf870d
2 changed files with 9 additions and 56 deletions

View File

@ -26,20 +26,18 @@
# serve to show the default.
import os
import subprocess
import sys
import warnings
import openstackdocstheme
extensions = [
'os_api_ref',
'openstackdocstheme',
]
html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]
html_theme_options = {
"sidebar_dropdown": "api_ref",
"sidebar_mode": "toc",
}
@ -65,20 +63,8 @@ source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Image Service 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 glance.version import version_info
# The full version, including alpha/beta/rc tags.
release = version_info.release_string()
# The short X.Y version.
version = version_info.version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
@ -108,14 +94,10 @@ show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# Config logABug feature
# source tree
giturl = (
u'https://git.openstack.org/cgit/openstack/glance/tree/api-ref/source')
# html_context allows us to pass arbitrary values into the html template
html_context = {'bug_tag': 'api-ref',
'giturl': giturl,
'bug_project': 'glance'}
# openstackdocstheme options
repository_name = 'openstack/glance'
bug_project = 'glance'
bug_tag = 'api-ref'
# -- Options for man page output ----------------------------------------------
@ -162,14 +144,7 @@ html_context = {'bug_tag': 'api-ref',
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
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".')
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.

View File

@ -28,9 +28,7 @@
# serve to show the default.
import os
import subprocess
import sys
import warnings
import openstackdocstheme
@ -58,8 +56,7 @@ extensions = ['stevedore.sphinxext',
# openstackdocstheme options
repository_name = 'openstack/glance'
bug_project = 'glance'
bug_tag = ''
html_last_updated_fmt = '%Y-%m-%d %H:%M'
bug_tag = 'documentation'
# sphinxcontrib.apidoc options
apidoc_module_dir = '../../glance'
@ -98,20 +95,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Glance'
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.
#
# The short X.Y version.
from glance.version import version_info as glance_version
# The full version, including alpha/beta/rc tags.
release = glance_version.version_string_with_vcs()
# The short X.Y version.
version = glance_version.canonical_version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
@ -228,14 +213,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
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".')
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.