From baa9b9c732fefd6e7ba56fc4f3366fd7b7277574 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 23 Jun 2017 14:48:58 -0400 Subject: [PATCH] use openstackdocstheme html context Set some of the new config values and enable openstackdocstheme as an extension so it will inject values into the page context as it writes each documentation page. This ensures the pages link to the right bug tracker, etc. Change-Id: I36d400358b1b5e2c2423c43f43c775bafb0d4721 Depends-On: Icf3a40ed104cfd828f532f6f2b112ed02f996ff5 Signed-off-by: Doug Hellmann --- doc/source/conf.py | 33 ++++++++------------------------- releasenotes/source/conf.py | 10 +++++++--- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 340f291fd7..a15a04cbf1 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,11 +26,8 @@ from __future__ import print_function import django import logging -import openstackdocstheme import os -import subprocess import sys -import warnings # NOTE(amotoki): Sphinx 1.6.x catches warnings from imported modules. @@ -69,8 +66,15 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode', + 'openstackdocstheme', ] +# openstackdocstheme options +repository_name = 'openstack/horizon' +bug_project = 'horizon' +bug_tag = 'documentation' +html_last_updated_fmt = '%Y-%m-%d %H:%M' + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -150,7 +154,7 @@ html_theme_options = { } # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [openstackdocstheme.get_html_theme_path()] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". @@ -176,13 +180,6 @@ html_static_path = [] # 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".') # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -224,20 +221,6 @@ except Exception: # Output file base name for HTML help builder. htmlhelp_basename = 'Horizondoc' -# We ask git for the SHA checksum -# The git SHA checksum is used by "log-a-bug" -gitsha = subprocess.check_output(git_cmd).strip('\n') -giturl = u'https://git.openstack.org/cgit/openstack/horizon/tree/doc/source' -# html_context allows us to pass arbitrary values into the html template -html_context = { - "gitsha": gitsha, - "giturl": giturl, - "bug_project": "horizon", - # tag that reported bugs will be tagged with - "bug_tag": "documentation", -} - - # -- Options for LaTeX output ------------------------------------------------- latex_elements = { diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 96f915efef..16279e62b2 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -29,8 +29,6 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) -import openstackdocstheme - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -42,8 +40,15 @@ import openstackdocstheme extensions = [ 'reno.sphinxext', 'sphinx.ext.extlinks', + 'openstackdocstheme', ] +# openstackdocstheme options +repository_name = 'openstack/horizon' +bug_project = 'horizon' +bug_tag = 'documentation' +html_last_updated_fmt = '%Y-%m-%d %H:%M' + # Set aliases for extlinks # - generic launchpad bug - [:bug:`12345`] # - horizon blueprint - [:blueprint:`drop-nova-network`] @@ -138,7 +143,6 @@ html_theme = 'openstackdocs' # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] -html_theme_path = [openstackdocstheme.get_html_theme_path()] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation".