Browse Source

[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/<release-name> than watermark is <release-name>.

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: Ic3201a200c52d1790103c30350ccfa9b84c6b425
tags/15.0.0.0b1
Andreas Jaeger 2 years ago
parent
commit
cb8203ad03
2 changed files with 21 additions and 3 deletions
  1. 19
    3
      doc/source/conf.py
  2. 2
    0
      test-requirements.txt

+ 19
- 3
doc/source/conf.py View File

@@ -23,6 +23,8 @@
23 23
 # serve to show the default.
24 24
 
25 25
 import pbr.version
26
+import os
27
+import openstackdocstheme
26 28
 
27 29
 # If extensions (or modules to document with autodoc) are in another directory,
28 30
 # add these directories to sys.path here. If the directory is relative to the
@@ -39,7 +41,8 @@ import pbr.version
39 41
 # ones.
40 42
 extensions = [
41 43
     'sphinx.ext.autodoc',
42
-    'oslosphinx'
44
+    'oslosphinx',
45
+    'sphinxmark'
43 46
 ]
44 47
 
45 48
 # Add any paths that contain templates here, relative to this directory.
@@ -129,7 +132,7 @@ todo_include_todos = False
129 132
 
130 133
 # The theme to use for HTML and HTML Help pages.  See the documentation for
131 134
 # a list of builtin themes.
132
-# html_theme = 'alabaster'
135
+html_theme = 'openstackdocs'
133 136
 
134 137
 # Theme options are theme-specific and customize the look and feel of a theme
135 138
 # further.  For a list of options available for each theme, see the
@@ -137,7 +140,7 @@ todo_include_todos = False
137 140
 # html_theme_options = {}
138 141
 
139 142
 # Add any paths that contain custom themes here, relative to this directory.
140
-# html_theme_path = []
143
+html_theme_path = [openstackdocstheme.get_html_theme_path()]
141 144
 
142 145
 # The name for this set of Sphinx documents.  If None, it defaults to
143 146
 # "<project> v<release> documentation".
@@ -303,3 +306,16 @@ texinfo_documents = [
303 306
 
304 307
 # If true, do not generate a @detailmenu in the "Top" node's menu.
305 308
 # texinfo_no_detailmenu = False
309
+
310
+watermark = os.popen("git branch --contains $(git rev-parse HEAD)\
311
+| awk -F/ '/stable/ {print $2}'").read().strip(' \n\t').capitalize()
312
+if watermark == "":
313
+    watermark = "Pre-release"
314
+
315
+# -- Options for sphinxmark -----------------------------------------------
316
+sphinxmark_enable = True
317
+sphinxmark_div = 'docs-body'
318
+sphinxmark_image = 'text'
319
+sphinxmark_text = watermark
320
+sphinxmark_text_color = (128, 128, 128)
321
+sphinxmark_text_size = 70

+ 2
- 0
test-requirements.txt View File

@@ -11,5 +11,7 @@ ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD
11 11
 # this is required for the docs build jobs
12 12
 sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
13 13
 oslosphinx>=4.7.0 # Apache-2.0
14
+openstackdocstheme>=1.5.0 # Apache-2.0
14 15
 doc8 # Apache-2.0
15 16
 reno>=1.8.0 # Apache2
17
+sphinxmark>=0.1.14  # Apache-2.0

Loading…
Cancel
Save