From ea0888e8661c4bb92cdf043f190a0b79f2e23983 Mon Sep 17 00:00:00 2001 From: Nish Patwa Date: Tue, 18 Oct 2016 18:37:23 +0000 Subject: [PATCH] [DOCS] Added release-name as a watermark to Docs. Added a water mark to the role documentation to make clear to deployers which release they're working with. Modified conf.py that adds watermark to the documentation according to particular branch. If the current branch is master than watermark is 'Pre-release' and if the current branch is stable/ than watermark is . This is a combined implementation based on the following patches: - https://review.openstack.org/372565 - https://review.openstack.org/382637 - https://review.openstack.org/384140 Change-Id: I68bf027f41b906d4f1673bd4b993ef59767e70db --- doc/source/conf.py | 24 +++++++++++++++++++++--- test-requirements.txt | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index e2c0ed1..f52ece3 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,6 +13,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import os +import openstackdocstheme + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -28,7 +31,8 @@ # ones. extensions = [ 'sphinx.ext.autodoc', - 'oslosphinx' + 'oslosphinx', + 'sphinxmark' ] # The link to the browsable source code (for the left hand menu) @@ -111,7 +115,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# html_theme = 'alabaster' +html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -119,7 +123,7 @@ todo_include_todos = False # html_theme_options = {} # 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". @@ -288,3 +292,17 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False + + +watermark = os.popen("git branch --contains $(git rev-parse HEAD)\ +| awk -F/ '/stable/ {print $2}'").read().strip(' \n\t').capitalize() +if watermark == "": + watermark = "Pre-release" + +# -- Options for sphinxmark ----------------------------------------------- +sphinxmark_enable = True +sphinxmark_div = 'docs-body' +sphinxmark_image = 'text' +sphinxmark_text = watermark +sphinxmark_text_color = (128, 128, 128) +sphinxmark_text_size = 70 diff --git a/test-requirements.txt b/test-requirements.txt index 672f615..7724b87 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,5 +11,7 @@ ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD # this is required for the docs build jobs sphinx!=1.3b1,<1.4,>=1.2.1 # BSD oslosphinx>=4.7.0 # Apache-2.0 +openstackdocstheme>=1.5.0 # Apache-2.0 doc8 # Apache-2.0 reno>=1.8.0 # Apache2 +sphinxmark>=0.1.14 # Apache-2.0