From ea1ae95b6369df744f724dde989a657b1fec897a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sun, 30 Apr 2017 09:17:45 +0200 Subject: [PATCH] Update docs theme configuration Enable log-a-bug feature and add information on when document was built. Disable pep8 check for doc/source/conf.py. Change-Id: Ia86791ac69845572b2fbc536732afcf901bcf203 --- doc/source/conf.py | 19 +++++++++++++++++++ tox.ini | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 8844bdcc..724dda7f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -41,6 +41,18 @@ master_doc = 'index' project = u'openstack-doc-tools' copyright = u'2017, OpenStack Foundation' +# A few variables have to be set for the log-a-bug feature. +# giturl: The location of conf.py on Git. Must be set manually. +# gitsha: The SHA checksum of the bug description. Automatically extracted from git log. +# bug_tag: Tag for categorizing the bug. Must be set manually. +# These variables are passed to the logabug code via html_context. +giturl = u'https://git.openstack.org/cgit/openstack/openstack-doc-tools/tree/doc/source' +git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '" +gitsha = os.popen(git_cmd).read().strip('\n') +bug_tag = u'openstack-doc-tools' +html_context = {"gitsha": gitsha, "bug_tag": bug_tag, + "giturl": giturl} + # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True @@ -62,6 +74,13 @@ html_theme_path = [openstackdocstheme.get_html_theme_path()] # html_static_path = ['static'] +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# So that we can enable "log-a-bug" links from each output HTML page, this +# variable must be set to a format that includes year, month, day, hours and +# minutes. +html_last_updated_fmt = '%Y-%m-%d %H:%M' + # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project diff --git a/tox.ini b/tox.ini index a0f8924f..eff8613d 100644 --- a/tox.ini +++ b/tox.ini @@ -47,7 +47,7 @@ commands = python setup.py build_sphinx [flake8] show-source = True builtins = _ -exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,*autogenerate_config_docs/venv,*autogenerate_config_docs/sources +exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,*autogenerate_config_docs/venv,*autogenerate_config_docs/sources,doc/source/conf.py # 28 is currently the most complex thing we have max-complexity=29 ignore = H101