openstack-manuals/tools/build-install-guides-rst.sh
Ian Y. Choi 4d42034432 PDF generation support with --pdf option
This commit proposes PDF generation with pdflatex.
Executing Sphinx with latex option generates .tex files will
be performed first, and pdflatex converts from .tex to .pdf files.

More details are as followings:

- Adds texlive related package binary dependency (>= Trusty)
  : inkscape texlive-latex-base texlive-latex-extra
    texlive-fonts-recommended
- build-rst.sh: --pdf option is added
- install-guide PDF support using --pdf option
- PDF support for serveral documents
  : arch-design, cli-reference, ha-guide, ops-guide, user-guide,
    networking-guide, arch-design-draft
  (testable using like "tox -e build -- networking-guide --pdf")
- Intermidiate files for building .tex (required for converting into
  .pdf) are stored in "build/pdf" folder.

Change-Id: I66242f44bb13f1a09be0904a491c84f42f25c3a2
Implements: blueprint build-pdf-from-rst-guides
2016-12-01 21:55:40 +00:00

46 lines
1.4 KiB
Bash
Executable File

#!/bin/bash -e
mkdir -p publish-docs
TAGS=${1:-obs rdo ubuntu debian debconf}
INDEX=doc/install-guide/source/index.rst
LINKCHECK=""
if [[ $# > 0 ]] ; then
if [ "$1" = "--linkcheck" ] ; then
LINKCHECK="$1"
fi
fi
# For translation work, we should have only one index file,
# because our tools generate translation resources from
# only one index file.
# Therefore, this tool uses one combined index file
# while processing title for each distribution.
# Save and restore the index file
cp -f ${INDEX} ${INDEX}.save
trap "mv -f ${INDEX}.save ${INDEX}" EXIT
for tag in $TAGS; do
if [[ "$tag" == "debconf" ]]; then
# Build the guide with debconf
# To use debian only contents, use "debian" tag.
tools/build-rst.sh doc/install-guide-debconf \
--tag debian --target "draft/install-guide-${tag}" $LINKCHECK --pdf
else
##
# Because Sphinx uses the first heading as title regardless of
# only directive, replace title directive with the proper title
# for each distribution to set the title explicitly.
title=$(grep -A 5 "^.. only:: ${tag}" ${INDEX} | \
head -n 6 | sed -n 4p | sed -e 's/^ *//g')
sed -i -e "s/\.\. title::.*/.. title:: ${title}/" ${INDEX}
# Build the guide
tools/build-rst.sh doc/install-guide \
--tag ${tag} --target "draft/install-guide-${tag}" $LINKCHECK --pdf
fi
done