openstack-manuals/tools/build-install-guides-rst.sh
Andreas Jaeger 1efb9dcdfb install-guide-rst: Fix title building
Always reset the title, even in case of errors. Otherwise
a wrong title stays in the index.rst file and gets committed by
accident.

Change-Id: Iaa50d215c1ea9880eb2f45a7269c798cd5c0df8c
2015-07-27 09:13:46 +02:00

24 lines
801 B
Bash
Executable File

#!/bin/bash -e
mkdir -p publish-docs
title_org=$(grep "title::" doc/install-guide-rst/source/index.rst | \
awk '{print substr($0, index($0, "::")+3)}')
trap "sed -i -e \"s/\.\. title::.*/.. title:: ${title_org}/\" \
doc/install-guide-rst/source/index.rst" EXIT
for tag in obs rdo ubuntu debian; do
GLOSSARY=""
if [[ ! -e doc/common-rst/glossary.rst ]] ; then
GLOSSARY="--glossary"
fi
title=$(grep -m 1 -A 5 ".. only:: ${tag}" \
doc/install-guide-rst/source/index.rst | \
sed -n 4p | sed -e 's/^ *//g')
sed -i -e "s/\.\. title::.*/.. title:: ${title}/" \
doc/install-guide-rst/source/index.rst
tools/build-rst.sh doc/install-guide-rst \
$GLOSSARY --tag ${tag} --target "draft/install-guide-rst-${tag}"
done