From 296fd22640eb9c27814e5c4a9ef505fd8730f903 Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Mon, 16 Sep 2019 16:08:04 +0000 Subject: [PATCH] Generate PDF documentation This commit adds a new tox target to build PDF documentation. It's a part of community goal, see storyboard for more information. Change-Id: I6e4f6372ff026a9eb379ee06c683451f58a99976 Story: 2006075 Task: 34812 --- doc/requirements.txt | 1 + doc/source/conf.py | 21 +++++++++++++++++++-- tox.ini | 10 ++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 38639a3..a2fd2b5 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,4 +5,5 @@ openstackdocstheme>=1.30.0 # Apache-2.0 sphinx>=1.6.2,!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD sphinx>=1.6.2,!=1.6.6,!=1.6.7,!=2.1.0;python_version>='3.4' # BSD +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD reno>=2.5.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 64f8579..ba3b5c1 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -23,6 +23,7 @@ extensions = [ 'cliff.sphinxext', 'sphinx.ext.autodoc', 'openstackdocstheme', + 'sphinxcontrib.rsvgconverter', ] autoprogram_cliff_ignored = [ @@ -74,14 +75,30 @@ html_last_updated_fmt = '%Y-%m-%d %H:%M' # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project + +# -- Options for LaTeX output --------------------------------------------- + +# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664 +latex_use_xindy = False + +latex_domain_indices = False + +latex_elements = { + 'makeindex': '', + 'printindex': '', + 'preamble': r'\setcounter{tocdepth}{3}', +} + # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). +# NOTE: Specify toctree_only=True for a better document structure of +# the generated PDF file. latex_documents = [ ('index', - '%s.tex' % project, + 'doc-%s.tex' % project, u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), + u'OpenStack Foundation', 'howto', True), ] # Example configuration for intersphinx: refer to the Python standard library. diff --git a/tox.ini b/tox.ini index 150aa88..5997b22 100644 --- a/tox.ini +++ b/tox.ini @@ -51,6 +51,16 @@ basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -W -b html doc/source doc/build/html +[testenv:pdf-docs] +basepython = python3 +envdir = {toxworkdir}/docs +deps = {[testenv:docs]deps} +whitelist_externals = + make +commands = + sphinx-build -W -b latex doc/source doc/build/pdf + make -C doc/build/pdf + [flake8] # E123, E125 skipped as they are invalid PEP-8.