From c0e9f0308ea212e6ecc5559b2cbec892c77778cc Mon Sep 17 00:00:00 2001 From: whoami-rajat Date: Tue, 17 Sep 2019 13:21:43 +0530 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: I58b1fb537c3758bba5a57d3cf7ce4cf10625bd89 Story: 2006076 Task: 34817 --- README.rst | 11 +++++++++-- doc/source/conf.py | 19 ++++++++++++++++--- tox.ini | 10 ++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index ecaf22d..b3e30e5 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,15 @@ Team and repository tags ======================== -.. image:: https://governance.openstack.org/tc/badges/python-congressclient.svg - :target: https://governance.openstack.org/tc/reference/tags/index.html +.. only::html + + .. image:: https://governance.openstack.org/tc/badges/python-congressclient.svg + :target: https://governance.openstack.org/tc/reference/tags/index.html + +.. only::latex + + .. image:: python-congressclient.svg + .. Change things from this point on diff --git a/doc/source/conf.py b/doc/source/conf.py index 7a165cb..3995766 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -83,14 +83,27 @@ htmlhelp_basename = '%sdoc' % project # A list of ignored prefixes for module index sorting. modindex_common_prefix = ['congressclient.'] +# 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, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), + 'doc-%s.tex' % project, + u'Congress Client Documentation', + u'OpenStack Foundation', 'manual', True), ] # Example configuration for intersphinx: refer to the Python standard library. diff --git a/tox.ini b/tox.ini index 9b05821..a91f295 100644 --- a/tox.ini +++ b/tox.ini @@ -32,6 +32,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 + [testenv:releasenotes] basepython = python3 deps = {[testenv:docs]deps}