forked from arun-gupta/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.sh
executable file
·52 lines (45 loc) · 1.18 KB
/
convert.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Run using:
#
# ./convert.sh
#
# or
#
# ./convert.sh html,pdf
#
# ...where the first argument is a comma-delimited list of formats
# Program paths
ASCIIDOCTOR=asciidoctor
FOPUB=~/tools/asciidoctor-fopub/fopub
ASCIIDOCTOR_PDF=~/tools/asciidoctor-pdf/bin/asciidoctor-pdf
#FOPUB=~/projects/asciidoctor/fopub/fopub
#ASCIIDOCTOR_PDF=~/projects/asciidoctor/asciidoctor-pdf/bin/asciidoctor-pdf
# File names
MASTER_ADOC=docker-java-lab.adoc
MASTER_DOCBOOK=${MASTER_ADOC/.adoc/.xml}
# Command options
SHARED_OPTIONS='-a numbered -a experimental -a source-highlighter=coderay -a imagesdir=images'
# Formats
if [ ! -z $1 ]; then
read -a FORMATS <<<$(IFS=','; echo $1)
else
FORMATS=(html
docbook
fopdf)
fi
for f in ${FORMATS[*]}; do
if [ $f == 'html' ]; then
echo "Converting to HTML ..."
$ASCIIDOCTOR -v $SHARED_OPTIONS $MASTER_ADOC
elif [ $f == 'docbook' ]; then
echo "Converting to DocBook ..."
$ASCIIDOCTOR -b docbook $SHARED_OPTIONS $MASTER_ADOC
elif [ $f == 'fopdf' ]; then
echo "Converting to FO-PDF ..."
$FOPUB $MASTER_DOCBOOK
elif [ $f == 'pdf' ]; then
echo "Converting to PDF ..."
$ASCIIDOCTOR_PDF $SHARED_OPTIONS $MASTER_ADOC
fi
done
exit 0