summaryrefslogtreecommitdiff
path: root/docs/src/asciideps
blob: 65059437f1d3bf4f89a44e2f87579f5a0d182ae9 (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
#!/bin/sh

set -e

test -z "$1" && exit 0
test -f "$1" || exit 1

includes () {
	DIR=`dirname "$1"`

	for f in `sed -ne "s|^include::\(.*\)\[\]$|$DIR/\1|p" "$1"`; do
		echo "$f"
		includes "$f"
	done
}

images() {
	DIR=`dirname "$1"`

	sed -ne "s|^image::\([^[]*\)\[\]$|$DIR/\1|p" "$1"
	sed -ne "s|^.*image:\([^:][^[]*\)\[\].*$|$DIR/\1|p" "$1"
}

INCLUDES=`includes "$1"`
IMAGES=`images "$1"`
for f in $INCLUDES; do
	IMAGES="$IMAGES `images $f`"
done

echo "${1%%.txt}.dep :" $INCLUDES
echo "${1%%.txt}.html: " $INCLUDES
echo "${1%%.txt}.pdf: " $INCLUDES $IMAGES