summaryrefslogtreecommitdiff
path: root/app/doc/mk-xtrkcad-manual-html
blob: 9340b1daf4f0c8c752bd3bbd8e26fa19400b5cbe (plain)
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
#!/bin/sh

if [ $# -ne 3 ] ; then
	echo mk-xtrkcad-manual-html SRCDIR BINDIR OUTFILE
	echo SRCDIR contains .but files
	echo BINDIR contains .html files
	echo OUTFILE is the output .html file
	echo Open OUTFILE in Chrome and print as pdf
	echo from a directory which contains png.d
	exit 1
fi

SRCDIR=$1
BINDIR=$2
OUTFILE=$3
OUTDIR=`pwd`

if [ ! -d ${SRCDIR} ] ; then
	echo $SRCDIR does not exist
	exit 1
fi

if [ ! -f ${SRCDIR}/addm.but ] ; then
	echo $SRCDIR does not contain .but files
	exit 1
fi

if [ ! -d ${SRCDIR}/png.d ] ; then
	echo $SRCDIR does not contain png.d directory
	exit 1
fi

if [ ! -d ${BINDIR} ] ; then
	echo $BINDIR does not exist
	exit 1
fi

if [ ! -f ${BINDIR}/addM.html ] ; then
	echo $BINDIR does not contain .html files
	exit 1
fi


extract() {
	grep '^\\[ACHS]' $1 |\
	sed \
		-e 's/^\\[ACHS][0-9]*{//' \
		-e 's/}.*//' \
		-e '/^$/d' \
	       	-e 's/$/.html/' ;
}

cd $SRCDIR
# extract .html refs
FILES="\
contents.html \
`extract intro.but.in` \
`extract addm.but` \
`extract changem.but` \
`extract drawm.but` \
`extract editm.but` \
`extract filem.but` \
`extract helpm.but` \
`extract hotbar.but` \
`extract macrom.but` \
`extract managem.but` \
`extract optionm.but` \
`extract statusbar.but` \
`extract view_winm.but` \
`extract navigation.but` \
`extract appendix.but` \
`extract ${BINDIR}/../../help/messages.but` \
`extract upgrade.but` \
`extract warranty.but` \
IndexPage.html"

cd $OUTDIR
(
cd $BINDIR
# clean up html: remove nav line, fix case file names
cat $FILES |\
       	grep -v 'Previous.*Next' |\
	sed \
		-e 's/bSensor.png/bsensor.png/'\
		-e 's/bControl.png/bcontrol.png/'\
		-e 's/iconlink.PNG/iconlink.png/'\
       	) > ${OUTFILE}

echo "Combined .html files are in ${OUTFILE}" 
echo "Make sure ${OUTFILE} is in a directory which contains a link to"
echo "  $SRCDIR/png.d/"
echo "Open with Chrome and Print to File as a PDF"
echo "You should specify a custom scale of at least 150%"