system-config/modules/jenkins/files/slave_scripts/markdown-docbook.sh
Clark Boylan 72afd76d32 Trace markdown to docbook conversion script.
When debugging this script it would be nice if Jenkins would have a
trace of what it did in the console log. Make it so.

Change-Id: Ia379468ffb16005e22bfa6399f46e8c2347c6dc6
Reviewed-on: https://review.openstack.org/15774
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2012-11-09 21:50:34 +00:00

22 lines
1.0 KiB
Bash
Executable File

#!/bin/bash -ex
# Documentation can be submitted in markdown and then converted to docbook
# so it can be built with the maven plugin. This is used by Jenkins when
# invoking certain docs jobs and the resulting output is made available to maven.
# In case we start doing something more sophisticated with other refs
# later (such as tags).
BRANCH=$ZUUL_REFNAME
shopt -s extglob
# Need to get the file name to insert here so it can be reused for multiple projects
# Filenames for the known repos that could do this are openstackapi-programming.mdown
# and images-api-v2.0.md and openstackapi-programming and images-api-v2.0 are the names
# for the ID and xml filename.
FILENAME=$1
FILEPATH=`find ./ -regextype posix-extended -regex ".*${FILENAME}\.(md|markdown|mdown)"`
DIRPATH=`dirname $FILEPATH`
pandoc -f markdown -t docbook -s ${FILEPATH} | xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - | xmllint --format - | sed -e "s,<article,<book xml:id=\"$FILENAME\"," | sed -e 's,</article>,</book>,' > ${DIRPATH}/$FILENAME.xml
pwd