From b8710584c7d551e7d0f39a1d824fb781b2b85d53 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Tue, 20 Apr 2021 13:23:59 +0200 Subject: [PATCH] PDF docs are now available Docs are now built in both html and pdf. Html docs link to pdf docs. Signed-off-by: Jiri Podivin Change-Id: I203942b27ddbfb540b3262c55faba509799ecc19 --- doc/requirements.txt | 1 + doc/source/conf.py | 8 +++++++- tox.ini | 16 +++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 485f45ed..5e47e760 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,4 +3,5 @@ sphinx>=2.0.0,!=2.1.0 # BSD openstackdocstheme>=2.2.2 # Apache-2.0 doc8>=0.8.0 # Apache-2.0 sphinxcontrib-apidoc>=0.2.0 # BSD +sphinxcontrib-svg2pdfconverter>=1.1.1 # BSD License reno>=3.1.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 5e5123dc..820da6cd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,6 +15,7 @@ import os import sys +import datetime # Add the project sys.path.insert(0, os.path.abspath('../..')) @@ -27,6 +28,7 @@ sys.path.insert(0, os.path.join(os.path.abspath('.'), '_exts')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinxcontrib.apidoc', + 'sphinxcontrib.rsvgconverter', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'openstackdocstheme', @@ -43,6 +45,7 @@ apidoc_separate_modules = True # openstackdocstheme options openstackdocs_repo_name = 'openstack/validations-libs' openstackdocs_use_storyboard = True +openstackdocs_pdf_link = True openstackdocs_bug_project = 'tripleo' openstackdocs_bug_tag = 'documentation' @@ -60,7 +63,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -copyright = u'2021, OpenStack Foundation' +copyright = u'{}, OpenStack Foundation'.format(datetime.date.year) # A list of ignored prefixes for module index sorting. modindex_common_prefix = ['validations_libs.'] @@ -106,3 +109,6 @@ latex_documents = [ 'manual' ), ] + +# Allow deeper levels of nesting for \begin...\end stanzas +latex_elements = {'maxlistdepth': 10, 'extraclassoptions': ',openany,oneside'} diff --git a/tox.ini b/tox.ini index b2d324e6..9cc848a5 100644 --- a/tox.ini +++ b/tox.ini @@ -98,13 +98,15 @@ commands= sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T doc8 doc -#TODO(jpodivin): pdf-docs don't compile properly -; [testenv:pdf-docs] -; whitelist_externals = make -; deps = {[testenv:docs]deps} -; commands = -; sphinx-build -W -b latex doc/source doc/build/pdf -; make -C doc/build/pdf +[testenv:pdf-docs] +whitelist_externals = make +description = + Build PDF documentation. +envdir = {toxworkdir}/docs +deps = {[testenv:docs]deps} +commands = + sphinx-build -b latex doc/source doc/build/pdf + make -C doc/build/pdf [doc8] # Settings for doc8: