From 49b6c09bcd47188766e1b29c03543887ea3754aa Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Mon, 16 Sep 2019 11:25:11 +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: I66add3b35283fdb6337b6dad9d79e852984d471f Story: 2006078 Task: 34824 --- doc/requirements.txt | 2 ++ doc/source/conf.py | 20 ++++++++++++++++---- tox.ini | 13 ++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..9638eea --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,2 @@ +openstackdocstheme>=1.30.0 # Apache-2.0 +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 67602e2..43cb54f 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -23,7 +23,8 @@ sys.path.insert(0, os.path.abspath('../..')) extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', - 'openstackdocstheme' + 'openstackdocstheme', + 'sphinxcontrib.rsvgconverter', ] # openstackdocstheme options @@ -73,10 +74,21 @@ htmlhelp_basename = '%sdoc' % project # [howto/manual]). latex_documents = [ ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), + 'doc-designate-dashboard.tex', + u'Designate Dashboard Documentation', + u'OpenStack Foundation', 'manual', True), ] +latex_domain_indices = False + +latex_elements = { + # Additional stuff for the LaTeX preamble. + # openany: Skip blank pages in generated PDFs + 'extraclassoptions': 'openany,oneside', + 'makeindex': '', + 'printindex': '', + 'preamble': r'\setcounter{tocdepth}{3}', +} + # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/tox.ini b/tox.ini index af090df..9dbfd4a 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,18 @@ commands = [testenv:docs] basepython = python3 -commands = python setup.py build_sphinx +deps = -r{toxinidir}/doc/requirements.txt +commands = sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html + +[testenv:pdf-docs] +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt +envdir = {toxworkdir}/docs +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.