From ffd8e27bd17cae1094261b5aee43b3a345d3d8f3 Mon Sep 17 00:00:00 2001
From: licanwei
Date: Mon, 16 Sep 2019 20:47:30 -0700
Subject: [PATCH] Build pdf docs
Add a new pdf-docs environment to enable PDF build.
sphinxcontrib-svg2pdfconverter is used to handle SVG properly.
Change-Id: I1563579486da8912ba8a220bb08a5331e7df910b
---
doc/requirements.txt | 1 +
doc/source/conf.py | 14 +++++++++++++-
doc/source/glossary.rst | 2 +-
doc/source/index.rst | 8 +++++---
tox.ini | 12 ++++++++++++
5 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/doc/requirements.txt b/doc/requirements.txt
index b4b677a25..be20d7bce 100644
--- a/doc/requirements.txt
+++ b/doc/requirements.txt
@@ -5,6 +5,7 @@ openstackdocstheme>=1.20.0 # Apache-2.0
sphinx>=1.6.5,!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD
sphinx>=1.6.5,!=1.6.6,!=1.6.7,!=2.1.0;python_version>='3.4' # BSD
sphinxcontrib-pecanwsme>=0.8.0 # Apache-2.0
+sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
reno>=2.7.0 # Apache-2.0
sphinxcontrib-apidoc>=0.2.0 # BSD
os-api-ref>=1.4.0 # Apache-2.0
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 44d81d6c4..662dbcbba 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -42,6 +42,7 @@ extensions = [
'oslo_config.sphinxconfiggen',
'openstackdocstheme',
'sphinx.ext.napoleon',
+ 'sphinxcontrib.rsvgconverter',
]
wsme_protocols = ['restjson']
@@ -137,10 +138,21 @@ bug_tag = ''
# [howto/manual]).
latex_documents = [
('index',
- '%s.tex' % project,
+ 'doc-watcher.tex',
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
]
+# If false, no module index is generated.
+latex_domain_indices = False
+
+latex_elements = {
+ 'makeindex': '',
+ 'printindex': '',
+ 'preamble': r'\setcounter{tocdepth}{3}',
+}
+
+# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
+latex_use_xindy = False
# Example configuration for intersphinx: refer to the Python standard library.
# intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/doc/source/glossary.rst b/doc/source/glossary.rst
index a5b80ce2d..b696b1700 100644
--- a/doc/source/glossary.rst
+++ b/doc/source/glossary.rst
@@ -8,7 +8,7 @@
Glossary
========
-.. glossary::
+.. _glossary:
:sorted:
This page explains the different terms used in the Watcher system.
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 1fb8e80ed..67437345e 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -112,9 +112,11 @@ Watcher Manual Pages
man/index
+.. only:: html
+
Indices and tables
==================
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
+ * :ref:`genindex`
+ * :ref:`modindex`
+ * :ref:`search`
diff --git a/tox.ini b/tox.ini
index 43a231a6d..c74134c28 100644
--- a/tox.ini
+++ b/tox.ini
@@ -100,6 +100,18 @@ extension=.rst
# todo: stop ignoring doc/source/man when https://bugs.launchpad.net/doc8/+bug/1502391 is fixed
ignore-path=doc/source/image_src,doc/source/man,doc/source/api
+[testenv:pdf-docs]
+basepython = python3
+envdir = {toxworkdir}/docs
+deps = {[testenv:docs]deps}
+whitelist_externals =
+ rm
+ make
+commands =
+ rm -rf doc/build/pdf
+ sphinx-build -W -b latex doc/source doc/build/pdf
+ make -C doc/build/pdf
+
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt