find $DOCS_DIR -name $INDEX_RST -printf '%h\n' | while read dir
do
name=$(generate_name $dir)
- src="$SRC_DIR/${dir#$DOCS_DIR/}"
+ if is_top_dir "$dir" ; then
+ src="$SRC_DIR"
+ else
+ src="$SRC_DIR/${dir#$DOCS_DIR/}"
+ fi
build="$BUILD_DIR/$name"
output="$OUTPUT_DIR/$name"
conf="$src/conf.py"
# TODO: failures in ODT creation should be handled error and
# cause 'exit 1' before OPNFV B release.
tex=$(find $build -name '*.tex' | head -1)
- odt=$(basename "${tex%.tex}.odt")
+ odt="${tex%.tex}.odt"
if [[ -e $tex ]] && which pandoc > /dev/null ; then
- pandoc $tex -o $output/$odt || {
+ (
+ cd $(dirname $tex)
+ pandoc $(basename $tex) -o $(basename $odt)
+ ) && {
+ mv $odt $output/
+ }|| {
msg="Error: ODT creation for $dir has failed."
echo
echo "$msg"