Repository navigation
Expand file tree
/
Copy pathmakeBook.sh
More file actions
executable file
·112 lines (99 loc) · 2.2 KB
/
Copy pathmakeBook.sh
File metadata and controls
executable file
·112 lines (99 loc) · 2.2 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
htmlDest="html"
infoDest="info"
docbookDest="docbook"
masterDoc="DesignGUI.texinfo"
chapNumbers="01 02 03 04 05 06 07 50"
function collateChaptersImg {
chapters=""
for n in $chapNumbers
do
chapters="$chapters chapter-$n"
done
imgPath="./misc"
for chapter in $chapters
do
imgPath="$imgPath:./$chapter/img"
done
}
function doPdf {
makeinfo -I $imgPath --pdf $masterDoc
cd -
clean_all
}
function doDocbook {
cleanupDestination $docbookDest
texi2any --output=$docbookDest/ --transliterate-file-names --split=node \
--no-number-sections --docbook $masterDoc
}
function doInfo {
prepareDestination $infoDest
makeinfo -I $imgPath --output=$infoDest/ $masterDoc
}
function doHtml {
prepareDestination $htmlDest
cp misc/style.css $htmlDest
texi2any -c ICONS=true -I $imgPath --output=$htmlDest/ --html -c FORMAT_MENU=menu \
-c CONTENTS_OUTPUT_LOCATION=inline --css-ref=style.css --no-warn $masterDoc
}
function cleanupDestination {
# Clean up dest $1
rm -rf "$1"
mkdir "$1"
}
function prepareDestination {
# Clean up dest $1 and copy all bitmaps there
cleanupDestination "$1"
for dir in $chapters
do
if [ -d $dir/img ]; then
cp $dir/img/*.png "$1" 2> /dev/null
cp $dir/img/*.jpg "$1" 2> /dev/null
cp $dir/img/*.gif "$1" 2> /dev/null
fi
done
cp ./misc/*.png "$1" 2> /dev/null
cp ./misc/*.jpg "$1" 2> /dev/null
cp ./misc/*.gif "$1" 2> /dev/null
}
function package_html {
doHtml
tar cfz `basename $masterDoc .texinfo`-html.tgz html
}
function clean_all {
rm *.log *.toc *.aux *.cp *.cps *.fn *.ky *.tp *.vr *.fns *.pg
}
function usage {
echo "Usage: $0 (docbook|html|pdf|package|clean)"
}
collateChaptersImg
case "$1" in
docbook)
echo "Build documentation in docbook."
doDocbook
;;
html)
echo 'Build documentation in html.'
doHtml
;;
pdf)
echo 'Build documentation in PDF.'
doPdf
;;
info)
echo 'Build documentation for Texinfo.'
doInfo
;;
package)
echo 'Build html documentation and archive it.'
doHtml
package_html
;;
clean)
echo "Delete all the intermediate files."
clean_all
;;
*)
usage
exit
esac