From 386d5df55778459bfde22488dfd9bba3659b547f Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Tue, 25 Jun 2019 09:19:35 +0800 Subject: [PATCH] Build pdf doc The is one of community goals that each project could produce a single PDF file. The pdf should be in the output of openstack-tox-docs job. TeX packages are required to build PDF locally, following is recommended: * inkscape * texlive-latex-base * texlive-latex-extra * texlive-fonts-recommended More about the goal: https://governance.openstack.org/tc/goals/train/pdf-doc-generation.html https://etherpad.openstack.org/p/train-pdf-support-goal https://etherpad.openstack.org/p/pdf-goal-train-common-problems Change-Id: Id2244fa8c70e8b8c09e309998012041883b98ab1 --- doc/requirements.txt | 3 ++- doc/source/conf.py | 22 ++++++++-------------- tox.ini | 8 ++++++++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 0070fb5..22a69db 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,4 +5,5 @@ reno>=2.5.0 # Apache-2.0 sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD sphinxcontrib-apidoc>=0.2.0 # BSD -openstackdocstheme>=1.18.1 # Apache-2.0 +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD +openstackdocstheme>=1.20.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 0414234..16b4f65 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -21,14 +21,10 @@ sys.path.insert(0, os.path.abspath('../..')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinxcontrib.apidoc', + 'sphinxcontrib.rsvgconverter', + 'openstackdocstheme', ] -try: - import openstackdocstheme - extensions.append('openstackdocstheme') -except ImportError: - openstackdocstheme = None - autoclass_content = 'both' apidoc_module_dir = '../../metalsmith' apidoc_output_dir = 'reference/api' @@ -46,7 +42,6 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'metalsmith' copyright = u'2018, MetalSmith Developers ' # The version info for the project you're documenting, acts as replacement for @@ -77,21 +72,20 @@ pygments_style = 'sphinx' # html_theme = '_theme' # html_static_path = ['static'] -if openstackdocstheme is not None: - html_theme = 'openstackdocs' -else: - html_theme = 'default' +html_theme = 'openstackdocs' # Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +htmlhelp_basename = 'metalsmithdoc' + +latex_use_xindy = False # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', - '%s.tex' % project, - u'%s Documentation' % project, + 'doc-metalsmith.tex', + u'MetalSmith Documentation', u'MetalSmith Developers', 'manual'), ] diff --git a/tox.ini b/tox.ini index bfc2f4e..49dccf5 100644 --- a/tox.ini +++ b/tox.ini @@ -54,6 +54,14 @@ deps = commands = sphinx-build -a -E -W -b html doc/source doc/build/html +[testenv:pdf-docs] +basepython = python3 +whitelist_externals = make +deps = {[testenv:docs]deps} +commands = + sphinx-build -W -b latex doc/source doc/build/pdf + make -C doc/build/pdf + [testenv:releasenotes] basepython = python3 deps =