Browse Source

PDF documentation build

Note that toctree_only option [1] is set to True in latex_documents
in doc/source/conf.py to get a better document structure in
the generated PDF file.

The above solution also helps us avoid a filename conflict between
the generated PDF file name and a PDF file converted from an SVG image
of the project badge where both files would be neutron-dynamic-routing.pdf.

Change-Id: I809040e0a4def90451f9a80c02c6f811af330bc9
Story: 2006099
Task: 35128
tags/15.0.0.0b1^0
Akihiro Motoki 3 weeks ago
parent
commit
b6d13bdce5
5 changed files with 39 additions and 4 deletions
  1. 20
    3
      doc/source/conf.py
  2. 5
    0
      doc/source/index.rst
  3. 1
    0
      lower-constraints.txt
  4. 3
    1
      test-requirements.txt
  5. 10
    0
      tox.ini

+ 20
- 3
doc/source/conf.py View File

@@ -27,6 +27,7 @@ extensions = [
27 27
     'oslo_config.sphinxconfiggen',
28 28
     'oslo_policy.sphinxext',
29 29
     'oslo_policy.sphinxpolicygen',
30
+    'sphinxcontrib.rsvgconverter',
30 31
 ]
31 32
 
32 33
 # openstackdocstheme options
@@ -72,16 +73,32 @@ html_last_updated_fmt = '%Y-%m-%d %H:%M'
72 73
 # Output file base name for HTML help builder.
73 74
 htmlhelp_basename = '%sdoc' % project
74 75
 
76
+# -- Options for LaTeX output -------------------------------------------------
77
+
75 78
 # Grouping the document tree into LaTeX files. List of tuples
76 79
 # (source start file, target name, title, author, documentclass
77
-# [howto/manual]).
80
+# [howto/manual], torctree_only).
78 81
 latex_documents = [
79 82
     ('index',
80
-     '%s.tex' % project,
83
+     'doc-%s.tex' % project,
81 84
      u'%s Documentation' % project,
82
-     u'OpenStack Foundation', 'manual'),
85
+     u'OpenStack Foundation', 'manual',
86
+     # Specify toctree_only=True for a better document structure of
87
+     # the generated PDF file.
88
+     True),
83 89
 ]
84 90
 
91
+# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
92
+latex_use_xindy = False
93
+
94
+latex_domain_indices = False
95
+
96
+latex_elements = {
97
+    'makeindex': '',
98
+    'printindex': '',
99
+    'preamble': r'\setcounter{tocdepth}{3}',
100
+}
101
+
85 102
 # Example configuration for intersphinx: refer to the Python standard library.
86 103
 #intersphinx_mapping = {'http://docs.python.org/': None}
87 104
 

+ 5
- 0
doc/source/index.rst View File

@@ -26,6 +26,11 @@
26 26
 Welcome to neutron-dynamic-routing's documentation!
27 27
 ===================================================
28 28
 
29
+.. NOTE(amotoki): toctree_only=False is specified in latex_documents
30
+   in doc/source/conf.py to get a better structure of the PDF doc.
31
+   This means the content of this file (index.rst) is NOT rendered
32
+   in the generated PDF file.
33
+
29 34
 .. include:: ../../README.rst
30 35
 
31 36
 Contents

+ 1
- 0
lower-constraints.txt View File

@@ -123,6 +123,7 @@ simplejson==3.5.1
123 123
 six==1.10.0
124 124
 snowballstemmer==1.2.1
125 125
 Sphinx==1.6.5
126
+sphinxcontrib-svg2pdfconverter==0.1.0 # BSD
126 127
 sphinxcontrib-websupport==1.0.1
127 128
 SQLAlchemy==1.2.0
128 129
 sqlalchemy-migrate==0.11.0

+ 3
- 1
test-requirements.txt View File

@@ -8,7 +8,9 @@ fixtures>=3.0.0 # Apache-2.0/BSD
8 8
 flake8-import-order==0.12 # LGPLv3
9 9
 mock>=2.0.0 # BSD
10 10
 python-subunit>=1.0.0 # Apache-2.0/BSD
11
-sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD
11
+sphinx!=1.6.6,!=1.6.7,>=1.6.5,<2.0.0;python_version=='2.7'  # BSD
12
+sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.5;python_version>='3.4' # BSD
13
+sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
12 14
 openstackdocstheme>=1.18.1 # Apache-2.0
13 15
 oslo.concurrency>=3.26.0 # Apache-2.0
14 16
 stestr>=1.0.0 # Apache-2.0

+ 10
- 0
tox.ini View File

@@ -89,6 +89,16 @@ commands = {posargs}
89 89
 basepython = python3
90 90
 commands = python setup.py build_sphinx
91 91
 
92
+[testenv:pdf-docs]
93
+basepython = python3
94
+envdir = {toxworkdir}/docs
95
+# deps = {[testenv:docs]deps}
96
+whitelist_externals =
97
+  make
98
+commands =
99
+  sphinx-build -W -b latex doc/source doc/build/pdf
100
+  make -C doc/build/pdf
101
+
92 102
 [flake8]
93 103
 # E125 continuation line does not distinguish itself from next logical line
94 104
 # E126 continuation line over-indented for hanging indent

Loading…
Cancel
Save