From 606ec02d4a1b22cd5e4f05669eaa3756d5e4f8ed Mon Sep 17 00:00:00 2001 From: Bernd Bausch Date: Sun, 1 Mar 2015 13:04:09 +0900 Subject: [PATCH] "log a bug" link added to Sphinx-based documentation Current documentation is Docbook-based. Each page features two "log a bug" links near the top and the bottom. This bug fix modifies the openstackdocstheme to do something similar for future Sphinx-based documentation pages. Regarding functionality: ------------------------ In the current DocBook-based implementation, a click on "log a bug" opens a launchpad page with the bug summary and further information prepopulated. Summary is the name of the book, such as "Install Guide for Ubuntu - Icehouse"; an example for Further Information is: ----------------------------------- Built: 2015-01-06T17:15:01 00:00 git SHA: 233c8098bbdc5bc83bbd74403650feb6610f4b95 URL: http://docs.openstack.org/icehouse/install-guide/install/apt/content/ source File: file:/home/jenkins/workspace/openstack-manuals-tox-doc-publishdocs/doc/install-guide/bk_openstackinstallguide.xml xml:id: openstack-install-manual-icehouse With our Sphinx-based docs, the Release value, git SHA, and source file should be sufficient. Here is the new functionality: ------------------------------------- Release: 1.0 on 2015-04-06 12:27 SHA: c43d442c4d053891a22bde1232f9fbea18bad44e Source: http://git.openstack.org/cgit/openstack/openstack-manuals/tree/doc/source/index.rst Change-Id: Ib60146d993ff67fc3f8fd8703cdad1935f7ec6bb Partial-Bug: #1421799 --- .gitignore | 1 + doc/source/conf.py | 23 +++++++++++-- .../theme/openstackdocs/layout.html | 24 ++++++------- .../theme/openstackdocs/script_footer.html | 34 +++++++++++++++++++ .../theme/openstackdocs/static/js/docs.js | 28 ++++++++++----- .../theme/openstackdocs/titlerow.html | 3 +- 6 files changed, 87 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 4dd38514..4d57995e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ _build/ /openstackdocstheme.egg-info/ *.pyc doc/build +doc/source/BBresult diff --git a/doc/source/conf.py b/doc/source/conf.py index 5b57504a..1d64ef3d 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -43,19 +43,33 @@ source_suffix = '.rst' # The master toctree document. master_doc = 'index' -# General information about the project. -project = u'os-doc-demo' +# "project" contains the name of the book, such as +# 'security guide' or 'network guide' +# It's used by the "log-a-bug" button on each page +# and should ultimately be set automatically by the build process +project = u'network guide' copyright = u'2015, OpenStack Contributors' # 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. # +# "version" and "release" are used by the "log-a-bug" feature +# # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. release = '1.0' +# We ask git for the SHA checksum +# The git SHA checksum is used by "log-a-bug" +git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '" +gitsha = os.popen(git_cmd).read().strip('\n') +# source tree +pwd = os.popen("pwd").read().strip('\n') +# html_context allows us to pass arbitrary values into the html template +html_context = { "pwd":pwd, "gitsha":gitsha } + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None @@ -139,6 +153,11 @@ html_static_path = ['_static/css'] # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' +# 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' + # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True diff --git a/openstackdocstheme/theme/openstackdocs/layout.html b/openstackdocstheme/theme/openstackdocs/layout.html index 689c2a1d..240939e9 100644 --- a/openstackdocstheme/theme/openstackdocs/layout.html +++ b/openstackdocstheme/theme/openstackdocs/layout.html @@ -2,10 +2,11 @@ +{% block header %}{% endblock %} OpenStack Docs: {{ title }} - - + + {% include 'css.html' %} {# FAVICON #} @@ -46,26 +47,21 @@ Conceptual architecture -->
-
- {% if next or prev %} - {% if next %} -  next - {% endif %} - {% if prev %} - previous | - {% endif %} - {% endif %} +
+ updated: {{ last_updated }} | release: {{ release }}
suggest edits -
+
{% include 'license_cc.html' %}
- + + found an error? report a bug @@ -82,7 +78,9 @@ {% include 'footer.html' %} + {% include 'script_footer.html' %} + diff --git a/openstackdocstheme/theme/openstackdocs/script_footer.html b/openstackdocstheme/theme/openstackdocs/script_footer.html index 8f1ac845..0a500ecd 100644 --- a/openstackdocstheme/theme/openstackdocs/script_footer.html +++ b/openstackdocstheme/theme/openstackdocs/script_footer.html @@ -14,6 +14,40 @@ +