From 018e06a5f9bf7c0cd5a6bfd6a111fe5c144a8196 Mon Sep 17 00:00:00 2001 From: sonpn13 Date: Sun, 27 Oct 2019 08:59:23 +0700 Subject: [PATCH] PDF Documentation Build tox target Change-Id: I54e3d3d6fbe0b753597703b6e61f884703c4e7e7 Signed-off-by: sonpn13 Story: 2006105 Task: 35341 --- doc/requirements.txt | 16 ++++++++++++++++ doc/source/conf.py | 14 ++++++++++++-- tox.ini | 11 ++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..07801f8 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,16 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +# WARNING: +# This file is maintained in the openstack-ansible-tests repository. +# https://opendev.org/openstack/openstack-ansible-tests/src/branch/master/sync/doc/requirements.txt +# If you need to modify this file, update the one in the +# openstack-ansible-tests repository. Once it merges there, the changes will +# automatically be proposed to all the repositories which use it. + +sphinx>=2.0.0,!=2.1.0 # BSD +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD +openstackdocstheme>=2.2.1 # Apache-2.0 +reno>=3.1.0 # Apache-2.0 +doc8>=0.6.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index dbc720d..2921cdf 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -37,6 +37,8 @@ # ones. extensions = [ 'openstackdocstheme', + 'sphinx.ext.autodoc', + 'sphinxcontrib.rsvgconverter', ] # Add any paths that contain templates here, relative to this directory. @@ -228,8 +230,8 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, target_name + '.tex', - title, author, 'manual'), + (master_doc, 'doc-' + target_name + '.tex', + title.replace("_", r"\_"), author, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -288,3 +290,11 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False +# -- Options for PDF output -------------------------------------------------- + +pdf_documents = [ + (master_doc, target_name, + title, author) +] + +locale_dirs = ['locale/'] diff --git a/tox.ini b/tox.ini index 9111a66..2d2343e 100644 --- a/tox.ini +++ b/tox.ini @@ -28,11 +28,20 @@ setenv = VIRTUAL_ENV={envdir} [testenv:docs] -commands= +deps = -r{toxinidir}/doc/requirements.txt +commands = bash -c "rm -rf doc/build" doc8 doc sphinx-build -W -b html doc/source doc/build/html +[testenv:pdf-docs] +deps = {[testenv:docs]deps} +allowlist_external = + make +commands = + sphinx-build -W -b latex doc/source doc/build/pdf + make -C doc/build/pdf + [doc8] # Settings for doc8: extensions = .rst