From 6eebb4b446b2fc1b06af5c96bbe782238d669d3c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 1 Dec 2016 12:13:10 +0000 Subject: [PATCH] Point roles docs bugs to openstack-ansible LP Currently when clicking on the small bug in the roles' docs, we land on openstack-manuals launchpad. This should solve it. Change-Id: I3d61d6f6d3facc4becc3cfbe379f5406d32283a3 --- doc/source/conf.py | 39 ++++++++++++++++++++++++++++++++++++--- test-requirements.txt | 2 ++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 610578b..1f8c68e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,7 +22,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import openstackdocstheme import pbr.version +import os # 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 @@ -39,7 +41,8 @@ import pbr.version # ones. extensions = [ 'sphinx.ext.autodoc', - 'oslosphinx' + 'oslosphinx', + 'sphinxmark' ] # Add any paths that contain templates here, relative to this directory. @@ -80,6 +83,22 @@ release = version_info.version_string_with_vcs() # The short X.Y version. version = version_info.canonical_version_string() +# 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 = ("http://git.openstack.org/cgit/openstack/{0}" + "/tree/doc/source").format(target_name) +git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '" +gitsha = os.popen(git_cmd).read().strip('\n') +bug_project = project.lower() +bug_title = "Documentation bug" +html_context = {"gitsha": gitsha, "giturl": giturl, + "bug_tag": "docs", "bug_title": bug_title, + "bug_project": bug_project} + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -129,7 +148,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 @@ -137,7 +156,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". @@ -303,3 +322,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 7a115e3..1f4612d 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 # Apache-2.0 +sphinxmark>=0.1.14 # Apache-2.0