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

View File

@ -28,9 +28,7 @@
# serve to show the default. # serve to show the default.
import os import os
import subprocess
import sys import sys
import warnings
import openstackdocstheme import openstackdocstheme
@ -58,8 +56,7 @@ extensions = ['stevedore.sphinxext',
# openstackdocstheme options # openstackdocstheme options
repository_name = 'openstack/glance' repository_name = 'openstack/glance'
bug_project = 'glance' bug_project = 'glance'
bug_tag = '' bug_tag = 'documentation'
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# sphinxcontrib.apidoc options # sphinxcontrib.apidoc options
apidoc_module_dir = '../../glance' apidoc_module_dir = '../../glance'
@ -98,20 +95,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Glance'
copyright = u'2010-present, OpenStack Foundation.' 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 # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
#language = None #language = None
@ -228,14 +213,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y' #html_last_updated_fmt = '%b %d, %Y'
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", html_last_updated_fmt = '%Y-%m-%d %H:%M'
"-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 # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.