Update doc-tools-build-rst

Import change I6c275518b9e55ab3b6bcea52894ea851924bee94 from
openstack-manuals: Add linkcheck for RST.

Change-Id: I1774ddf76d3930318dd0f59e9f938065eb9f07a4
This commit is contained in:
Andreas Jaeger 2015-10-06 18:41:13 +02:00
parent 83ece75a64
commit de062557cc
1 changed files with 28 additions and 15 deletions

View File

@ -21,6 +21,7 @@ if [ -z "$DIRECTORY" ] ; then
echo "--tag TAG: Use given tag for building"
echo "--target TARGET: Copy files to publish-docs/$TARGET"
echo "--build BUILD: Name of build directory"
echo "--linkcheck: Check validity of links instead of building"
exit 1
fi
@ -29,10 +30,18 @@ TARGET=""
TAG=""
TAG_OPT=""
BUILD=""
LINKCHECK=""
while [[ $# > 1 ]] ; do
while [[ $# > 0 ]] ; do
option="$1"
case $option in
--build)
BUILD="$2"
shift
;;
--linkcheck)
LINKCHECK=1
;;
--glossary)
GLOSSARY=1
;;
@ -45,10 +54,6 @@ while [[ $# > 1 ]] ; do
TARGET="$2"
shift
;;
--build)
BUILD="$2"
shift
;;
esac
shift
done
@ -70,17 +75,25 @@ else
fi
if [ -z "$TAG" ] ; then
echo "Building $DIRECTORY"
echo "Checking $DIRECTORY..."
else
echo "Building $DIRECTORY with tag $TAG"
echo "Checking $DIRECTORY with tag $TAG..."
fi
# Show sphinx-build invocation for easy reproduction
set -x
sphinx-build -E -W -b html $TAG_OPT $DIRECTORY/source $BUILD_DIR
set +x
# Copy RST
if [ "$TARGET" != "" ] ; then
mkdir -p publish-docs/$TARGET
rsync -a $BUILD_DIR/ publish-docs/$TARGET/
if [ "$LINKCHECK" = "1" ] ; then
# Show sphinx-build invocation for easy reproduction
set -x
sphinx-build -E -W -b linkcheck $TAG_OPT $DIRECTORY/source $BUILD_DIR
set +x
else
# Show sphinx-build invocation for easy reproduction
set -x
sphinx-build -E -W -b html $TAG_OPT $DIRECTORY/source $BUILD_DIR
set +x
# Copy RST
if [ "$TARGET" != "" ] ; then
mkdir -p publish-docs/$TARGET
rsync -a $BUILD_DIR/ publish-docs/$TARGET/
fi
fi