-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvertAdoc.sh
executable file
·55 lines (42 loc) · 1.43 KB
/
convertAdoc.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
53
54
55
#!/usr/bin/env bash
# https://github.com/asciidoctor/docker-asciidoctor
DOCKER_IMAGE=asciidoctor/docker-asciidoctor:1.1.0
DOCKER_WORKDIR=/documents
FILENAME=demo
TARGET_PATH=target/docs
ASCIIDOC_PATH=target/adoc
DOC_PATH=docs
if [ ! -d ${ASCIIDOC_PATH} ]
then
echo "Directory ${ASCIIDOC_PATH} does not exists."
return
fi
function generate() {
COMMAND="$@"
docker run -it \
-v $(pwd):${DOCKER_WORKDIR}/ \
-w ${DOCKER_WORKDIR} \
${DOCKER_IMAGE} \
$COMMAND \
-r asciidoctor-diagram \
-a sourcedir=${DOCKER_WORKDIR}/src/main/java \
-a webfonts! \
${ASCIIDOC_PATH}/${FILENAME}.adoc
}
if [ ! -d ${DOC_PATH} ]
then
mkdir ${DOC_PATH}
fi
generate asciidoctor -D ${DOC_PATH} -o index.html --attribute fullDoc
echo "HTML index documentation was generated as ${DOC_PATH}/index.html"
if [ ! -d ${TARGET_PATH} ]
then
mkdir ${TARGET_PATH}
fi
generate asciidoctor -D ${TARGET_PATH} -o ${FILENAME}-full.html --attribute fullDoc
echo "HTML full documentation was generated as ${TARGET_PATH}/${FILENAME}-full.html"
generate asciidoctor -D ${TARGET_PATH}
echo "HTML documentation was generated as ${TARGET_PATH}/${FILENAME}.html"
# Must generate html before to create images
#generate asciidoctor-pdf -B ${TARGET_PATH} -o ${FILENAME}-full.pdf --attribute fullDoc
#echo "PDF documentation was generated as ${TARGET_PATH}/${FILENAME}.pdf"