From f018d205f5b0758621460af7f0dfb4ba300d54ac 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 | 22 +++++++++++++++++----- tox.ini | 11 ++++++++++- 3 files changed, 43 insertions(+), 6 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..59180b6 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. @@ -61,11 +63,11 @@ description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.' project = 'OpenStack-Ansible' role_name = 'specs' target_name = 'openstack-ansible-' + role_name -title = 'OpenStack-Ansible ' + role_name + ' Documentation' - +title = 'OpenStack-Ansible Documentation: ' + role_name + ' role' # openstackdocstheme options openstackdocs_repo_name = 'openstack/' + target_name +openstackdocs_pdf_link = True openstackdocs_bug_project = project.lower() openstackdocs_bug_tag = '' @@ -147,7 +149,7 @@ html_theme = 'openstackdocs' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] +html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -228,10 +230,12 @@ 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'), ] +latex_use_xindy = False + # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None @@ -288,3 +292,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