summaryrefslogtreecommitdiff
path: root/tools/makedocset
blob: 46c87877bcc5fb8298c076fd710674be9d578a69 (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
#!/bin/sh
#
# "$Id$"
#
# Script to make Xcode documentation sets.
#

docversion="1.4.`svnversion . | sed -e '1,$s/[a-zA-Z]//g'`"
docset=""
sources=""
header=""
intro=""
title=""

while test $# -gt 0; do
	arg="$1"
	shift

	case "$arg" in
		--docset)
			docset="$1"
			shift
			;;
		--header)
			header="$1"
			shift
			;;
		--intro)
			intro="$1"
			shift
			;;
		--title)
			title="$1"
			shift
			;;
		*)
			sources="$sources $arg"
			;;
	esac
done

echo "<h1>$title</h1>" >"$header.ds"
sed -e '1,$s/<a href='"'"'/<a href='"'"'http:\/\/www.cups.org\/documentation.php\//g' < "$header" >>"$header.ds"
sed -e '1,$s/\/images\///g' -e '1,$s/<a href='"'"'/<a href='"'"'http:\/\/www.cups.org\/documentation.php\//g'  <"$intro" >"$intro.tmp"
sed -e '1,$s/http:\/\/www.cups.org\/documentation\.php\/#/#/g' <"$intro.tmp" >"$intro.ds"

mxmldoc --docset "$docset" --docversion "$docversion" \
	--feedname cups.org --feedurl http://www.cups.org/docsets.atom \
	--title "$title" --css ../doc/cups-printable.css \
	--header "$header.ds" --intro "$intro.ds" $sources || exit 1
rm -f "$header.ds" "$intro.ds" "$intro.tmp"

if test ! -d ../docsets; then
	mkdir ../docsets
fi

for image in `grep /images "$intro" | sed -e '1,$s/^.*\/images\///' -e '1,$s/\.png.*$/.png/'`; do
	cp ../doc/images/$image "$docset/Contents/Resources/Documentation"
done

xar="`basename \"$docset\" .docset`.xar"

/Developer/usr/bin/docsetutil package --output "../docsets/$xar" \
	--atom ../docsets/docsets.atom \
	--download-url "http://www.cups.org/docsets/$xar" "$docset" || exit 1

rm -rf "$docset"


#
# End of "$Id$".
#