Import markdown-docbook.sh from config

Import file from openstack-infra/config repository with filename
modules/jenkins/files/slave_scripts/markdown-docbook.sh

The file will be used for converting markdown to docbook.

Add this separately so that we can track changes to it more
easily.

Change-Id: I8d3a13d4b1126fa8845e2b5d5a4a9db6b23fbc64
This commit is contained in:
Andreas Jaeger 2013-12-28 16:03:35 +01:00
parent 64f2f860c8
commit 9e2f95e526
1 changed files with 21 additions and 0 deletions

21
bin/markdown-docbook.sh Executable file
View File

@ -0,0 +1,21 @@
#!/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,<chapter xml:id=\"$FILENAME\"," | sed -e 's,</article>,</chapter>,' > ${DIRPATH}/$FILENAME.xml
pwd