Address pep8 warning at markdown-docbook.sh

Change-Id: Ie9b36de21b86389982f9b1e8d8abf796b973d5da
This commit is contained in:
KATO Tomoyuki 2016-01-17 21:49:10 +09:00
parent 80a0206e8a
commit b4f4013423
1 changed files with 14 additions and 8 deletions

View File

@ -50,19 +50,25 @@ fi
# ID and xml filename.
FILENAME=$1
FILEPATH=`find ./ -regextype posix-extended -regex ".*${FILENAME}\.(md|markdown|mdown)"`
FILEPATH=`find ./ -regextype posix-extended \
-regex ".*${FILENAME}\.(md|markdown|mdown)"`
DIRPATH=`dirname $FILEPATH`
SOURCES=`ls $DIRPATH/*.md`
# Check for requirements
type -P pandoc > /dev/null 2>&1 || { echo >&2 "pandoc not installed. Aborting."; exit 1; }
type -P xsltproc > /dev/null 2>&1 || { echo >&2 "xsltproc not installed. Aborting."; exit 1; }
type -P xmllint > /dev/null 2>&1 || { echo >&2 "xmllint not installed. Aborting."; exit 1; }
type -P pandoc > /dev/null 2>&1 || \
{ echo >&2 "pandoc not installed. Aborting."; exit 1; }
type -P xsltproc > /dev/null 2>&1 || \
{ echo >&2 "xsltproc not installed. Aborting."; exit 1; }
type -P xmllint > /dev/null 2>&1 || \
{ echo >&2 "xmllint not installed. Aborting."; exit 1; }
TITLE=`head -n1 $DIRPATH/$FILENAME.md|sed -e 's/^#* *//'`
pandoc -V xmlid=$FILENAME --template=$DIR/pandoc-template.docbook -f markdown -t docbook -s ${SOURCES} |\
xsltproc -o - ${DB_UPGRADE} - |\
xmllint --format - |\
sed -e "s|<title>NO TITLE</title>|<title>$TITLE</title>|" > ${DIRPATH}/$FILENAME.xml
pandoc -V xmlid=$FILENAME --template=$DIR/pandoc-template.docbook \
-f markdown -t docbook -s ${SOURCES} |\
xsltproc -o - ${DB_UPGRADE} - |\
xmllint --format - |\
sed -e "s|<title>NO TITLE</title>|<title>$TITLE</title>|" > \
${DIRPATH}/$FILENAME.xml
pwd