PDF Documentation Build tox target

This patch adds a `pdf-docs` tox target that will build
PDF versions of our docs. As per the Train community goal:

  https://governance.openstack.org/tc/goals/selected/train/pdf-doc-generation.html

Add sphinxcontrib-svg2pdfconverter to doc/requirements.txt
to convert our SVGs.

Change-Id: Ib0fc3cabe19771c3f569d22c8b09aa456f4caf6e
Story: 2006105
This commit is contained in:
Dmitriy Rabotyagov 2019-10-15 19:32:16 +03:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 25ad47732f
commit faf60ddb53
4 changed files with 31 additions and 28 deletions

View File

@ -4,8 +4,8 @@
# this is required for the docs build jobs
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
sphinx>=1.8.0,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
openstackdocstheme>=1.18.1 # Apache-2.0
reno>=2.5.0 # Apache-2.0
sphinxmark>=0.1.14 # Apache-2.0
doc8>=0.6.0 # Apache-2.0

View File

View File

@ -12,7 +12,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import pbr.version
# If extensions (or modules to document with autodoc) are in another directory,
@ -31,7 +30,7 @@ import pbr.version
extensions = [
'openstackdocstheme',
'sphinx.ext.autodoc',
'sphinxmark'
'sphinxcontrib.rsvgconverter',
]
# Add any paths that contain templates here, relative to this directory.
@ -59,7 +58,7 @@ title = 'Config Template Documentation'
# The link to the browsable source code (for the left hand menu)
oslosphinx_cgit_link = (
'https://git.openstack.org/cgit/openstack/{}'.format(target_name)
'https://opendev.org/openstack/{}'.format(target_name)
)
# The version info for the project you're documenting, acts as replacement for
@ -219,7 +218,7 @@ html_last_updated_fmt = '%Y-%m-%d %H:%M'
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'ansible-config_templatedoc'
htmlhelp_basename = target_name + '-docs'
# -- Options for LaTeX output ---------------------------------------------
@ -241,11 +240,12 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'ansible-config_template.tex',
'ansible-config_template Documentation',
'ansible-config_template contributors', 'manual'),
(master_doc, 'doc-' + target_name + '.tex',
title, author, 'manual'),
]
latex_use_xindy = False
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
@ -272,9 +272,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'ansible-config_template',
'ansible-config_template Documentation',
[author], 1)
(master_doc, target_name,
title, [author], 1)
]
# If true, show URL addresses after external links.
@ -287,10 +286,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'ansible-config_template',
'ansible-config_template Documentation',
author, 'ansible-config_template', 'One line description of project.',
'Miscellaneous'),
(master_doc, target_name,
title, author, bug_project,
description, category),
]
# Documents to append as an appendix to all manuals.
@ -305,16 +303,11 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
# -- Options for PDF output --------------------------------------------------
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"
pdf_documents = [
(master_doc, target_name,
title, author)
]
# -- 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
locale_dirs = ['locale/']

12
tox.ini
View File

@ -38,12 +38,22 @@ setenv =
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands=
commands =
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
whitelist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[doc8]
# Settings for doc8:
extensions = .rst