From 927aaf870de6e778c3f66ec68632e424c9d37ebb Mon Sep 17 00:00:00 2001 From: junboli Date: Tue, 1 May 2018 15:02:30 +0800 Subject: [PATCH] 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 Closes-bug: #1768365 Change-Id: I76308497122f4522fe307b3c29b696780e073027 --- api-ref/source/conf.py | 39 +++++++-------------------------------- doc/source/conf.py | 26 ++------------------------ 2 files changed, 9 insertions(+), 56 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 26917f6b3b..6c602b6f78 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -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. diff --git a/doc/source/conf.py b/doc/source/conf.py index 355cc9c88c..7017433ca7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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.