From 9dc3e7520105f2d04dba10be2b917c8bbbb90b33 Mon Sep 17 00:00:00 2001 From: sonpn13 Date: Thu, 31 Oct 2019 18:24:30 +0700 Subject: [PATCH] Add PDF generation support for Python-SearchlightClient Add PDF generation, fix wrong tag on index.rst Change-Id: I1d0ba224ba1f0a0bd2157ccd45333f9a92871169 Signed-off-by: sonpn13 Story: #2006118 Task: #35498 --- doc/requirements.txt | 3 ++- doc/source/conf.py | 21 ++++++++++++++++++--- doc/source/contribute/index.rst | 2 +- tox.ini | 12 +++++++++++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 92f8ab6..b03569f 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,6 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -openstackdocstheme>=1.18.1 # Apache-2.0 +openstackdocstheme>=1.30.0 # Apache-2.0 +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD sphinx>=1.8.0,<2.0.0;python_version=='2.7' # BSD sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index aed6f5c..b12c018 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -29,7 +29,9 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'openstackdocstheme'] +extensions = ['sphinx.ext.autodoc', + 'openstackdocstheme', + 'sphinxcontrib.rsvgconverter'] autoclass_content = 'both' @@ -191,13 +193,26 @@ htmlhelp_basename = 'python-searchlightclientdoc' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' +latex_use_xindy = False + +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}', +} + # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) # . latex_documents = [ - ('index', 'python-searchlightclient.tex', + ('index', 'doc-python-searchlightclient.tex', 'python-searchlightclient Documentation', - 'OpenStack Foundation', 'manual'), + 'OpenStack Foundation', 'manual', True), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/contribute/index.rst b/doc/source/contribute/index.rst index 7bac562..e7b5dca 100644 --- a/doc/source/contribute/index.rst +++ b/doc/source/contribute/index.rst @@ -6,7 +6,7 @@ Code is hosted at `opendev.org`_. Submit bugs to the searchlight project on `Storyboard`_. Submit code to the openstack/python-searchlightclient project using `Gerrit`_. -.. _git.openstack.org: https://opendev.org/openstack/python-searchlightclient +.. _opendev.org: https://opendev.org/openstack/python-searchlightclient .. _Storyboard: https://storyboard.openstack.org/#!/project_group/93 .. _Gerrit: https://docs.openstack.org/infra/manual/developers.html#development-workflow diff --git a/tox.ini b/tox.ini index bb15c12..8ddc680 100644 --- a/tox.ini +++ b/tox.ini @@ -56,7 +56,17 @@ whitelist_externals = deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build - sphinx-build --keep-going -b html doc/source doc/build/html + sphinx-build --keep-going -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] ignore = E123,E126,E128,E241,E265,E713,H202,H405,H238