Simplify RST building
Use a script to build and copy RST guides around instead of duplicating the same lines every time. Use script in build-user-guides.sh for now. A follow-up patch shall change further places. This script will eventually be moved over to openstack-doc-tools, let's first evolve it here and check that we cover all use cases. Change-Id: I753e742bf77b2d6f5acf2f909d62af3dd422832a
This commit is contained in:
parent
b9fe165716
commit
94961a3c3a
78
tools/build-rst.sh
Executable file
78
tools/build-rst.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
DIRECTORY=$1
|
||||||
|
|
||||||
|
if [ -z "$DIRECTORY" ] ; then
|
||||||
|
echo "usage $0 DIRECTORY options"
|
||||||
|
echo "Options are:"
|
||||||
|
echo "--glossary: Build glossary"
|
||||||
|
echo "--tag TAG: Use given tag for building"
|
||||||
|
echo "--target TARGET: Copy files to publish-docs/$TARGET"
|
||||||
|
echo "--build BUILD: Name of build directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
GLOSSARY=0
|
||||||
|
TARGET=""
|
||||||
|
TAG=""
|
||||||
|
TAG_OPT=""
|
||||||
|
BUILD=""
|
||||||
|
|
||||||
|
while [[ $# > 1 ]] ; do
|
||||||
|
option="$1"
|
||||||
|
case $option in
|
||||||
|
--glossary)
|
||||||
|
GLOSSARY=1
|
||||||
|
;;
|
||||||
|
--tag)
|
||||||
|
TAG="$2"
|
||||||
|
TAG_OPT="-t $2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--target)
|
||||||
|
TARGET="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
BUILD="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$GLOSSARY" -eq "1" ] ; then
|
||||||
|
echo "Generating Glossary"
|
||||||
|
tools/glossary2rst.py $DIRECTORY/source/glossary.rst
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "BUILD" ] ; then
|
||||||
|
if [ -z "$TAG" ] ; then
|
||||||
|
BUILD_DIR="$DIRECTORY/build/html"
|
||||||
|
else
|
||||||
|
BUILD_DIR="$DIRECTORY/build-${TAG}/html"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
BUILD_DIR="$DIRECTORY/$BUILD/html"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sphinx-build -E -W $TAG_OPT $DIRECTORY/source $BUILD_DIR
|
||||||
|
|
||||||
|
# Copy RST
|
||||||
|
if [ "$TARGET" != "" ] ; then
|
||||||
|
mkdir -p publish-docs/$TARGET
|
||||||
|
rsync -a $BUILD_DIR publish-docs/$TARGET
|
||||||
|
fi
|
@ -1,16 +1,8 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
echo "Generating Glossary"
|
tools/build-rst.sh doc/user-guides --glossary --tag user_only --build build
|
||||||
echo "==================="
|
# No need to build the glossary again here.
|
||||||
tools/glossary2rst.py doc/user-guides/source/glossary.rst
|
tools/build-rst.sh doc/user-guides --tag admin_only --build build-admin
|
||||||
echo "Done."
|
|
||||||
echo ""
|
|
||||||
echo "Building End User Guide"
|
|
||||||
echo "======================="
|
|
||||||
sphinx-build -t user_only -E -W doc/user-guides/source/ doc/user-guides/build/html
|
|
||||||
echo "Building Admin User Guide"
|
|
||||||
echo "========================="
|
|
||||||
sphinx-build -t admin_only -E -W doc/user-guides/source/ doc/user-guides/build-admin/html
|
|
||||||
|
|
||||||
# Cleanup: Rename index-html to index everywhere
|
# Cleanup: Rename index-html to index everywhere
|
||||||
mv doc/user-guides/build-admin/html/index-admin.html doc/user-guides/build-admin/html/index.html
|
mv doc/user-guides/build-admin/html/index-admin.html doc/user-guides/build-admin/html/index.html
|
||||||
|
Loading…
Reference in New Issue
Block a user