From f9d4e0e07867054397aea0cc5b6447e133935011 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Thu, 31 Mar 2016 17:15:46 +0300 Subject: [PATCH] Re-organize doc building * Split out PDF building into a separate tox target * Run HTML builder the same way as by Infra * Omit Latex builder as it's not used Change-Id: Idae8ce297fdcc05141749d31f343cb29ce89ca66 --- doc/source/_styles/pdf.style | 26 ++++++++++++++------------ doc/source/conf.py | 2 ++ tools/build_pdf.sh | 11 +++++++++++ tox.ini | 14 +++++++++++--- 4 files changed, 38 insertions(+), 15 deletions(-) create mode 100755 tools/build_pdf.sh diff --git a/doc/source/_styles/pdf.style b/doc/source/_styles/pdf.style index 159f6a0..340f8bf 100644 --- a/doc/source/_styles/pdf.style +++ b/doc/source/_styles/pdf.style @@ -170,39 +170,39 @@ toc7: parent: toc - leftIndent: 100 + leftIndent: 120 toc8: parent: toc - leftIndent: 100 + leftIndent: 140 toc9: parent: toc - leftIndent: 100 + leftIndent: 160 toc10: parent: toc - leftIndent: 100 + leftIndent: 160 toc11: parent: toc - leftIndent: 100 + leftIndent: 160 toc12: parent: toc - leftIndent: 100 + leftIndent: 160 toc13: parent: toc - leftIndent: 100 + leftIndent: 160 toc14: parent: toc - leftIndent: 100 + leftIndent: 160 toc15: parent: toc - leftIndent: 100 + leftIndent: 160 footer: parent: normal @@ -320,7 +320,7 @@ parent: heading fontName: stdBold textColor: #D32F1A - fontSize: 200% + fontSize: 250% spaceBefore: 30 spaceAfter: 30 @@ -328,20 +328,21 @@ parent: heading fontName: stdBold textColor: #D32F1A - fontSize: 150% + fontSize: 180% spaceBefore: 20 spaceAfter: 14 heading3: parent: heading fontName: stdBold - fontSize: 125% + fontSize: 140% spaceBefore: 12 spaceAfter: 8 heading4: parent: heading fontName: stdBold + fontSize: 115% spaceBefore: 12 spaceBefore: 8 @@ -481,6 +482,7 @@ table-body: parent : normal + fontSize: 8 dedication: parent : normal diff --git a/doc/source/conf.py b/doc/source/conf.py index 728958b..f953a90 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -432,3 +432,5 @@ pdf_use_numbered_links = False # Background images fitting mode pdf_fit_background_mode = 'scale' + +pdf_default_dpi = 72 diff --git a/tools/build_pdf.sh b/tools/build_pdf.sh new file mode 100755 index 0000000..b131f33 --- /dev/null +++ b/tools/build_pdf.sh @@ -0,0 +1,11 @@ +#!/bin/bash -xe + +# copy sources to temporary folder +TEMP_DIR="$(mktemp -d)" +cp -r doc/source/* ${TEMP_DIR} + +# convert SVG to PNG +find ${TEMP_DIR} -name *svg | sed "s/\.svg$//" | xargs -I% cairosvg "%.svg" -f pdf -o "%.pdf" + +# run Sphinx +sphinx-build -b pdf ${TEMP_DIR} doc/build/pdf diff --git a/tox.ini b/tox.ini index 22ff7a2..3bae8bb 100644 --- a/tox.ini +++ b/tox.ini @@ -25,9 +25,17 @@ commands = flake8 [testenv:docs] commands = - sphinx-build -b html doc/source/ doc/build/html - sphinx-build -b latex doc/source/ doc/build/latex - sphinx-build -b pdf doc/source/ doc/build/pdf + python setup.py build_sphinx + +[testenv:pdf] +deps = + cairosvg + lxml + tinycss + cssselect + rst2pdf +whitelist_externals = bash +commands = bash tools/build_pdf.sh [flake8] show-source = true