File: docsrc2man.sh

package info (click to toggle)
vdr-plugin-epgsearch 1.0.1~beta6+git20150211-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,780 kB
  • ctags: 2,325
  • sloc: ansic: 23,325; perl: 1,330; sh: 609; makefile: 197
file content (62 lines) | stat: -rwxr-xr-x 1,337 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# Creates the man pages
#
# Needs: pod2man and nroff
#
# Mike Constabel
#
# Version 0.1 - 31.07.2006
#

DOCSRC="doc-src"

if [ ! -s "epgsearch.c" ]; then
	echo "Cannot find epgsearch.c. Call this script from epgsearch source directory."
	exit
fi

VERSION="$(awk -F\" '/VERSION/ {print $2; exit;}' epgsearch.c)"

for LANGUAGE in $(ls "$DOCSRC"/); do

	[ ! -d ""$DOCSRC"/$LANGUAGE" ] && continue
	mkdir -p man/$LANGUAGE
	rm man/$LANGUAGE/* 2>/dev/null

	for i in "$DOCSRC"/$LANGUAGE/*.txt; do
		echo -ne "create man page: ($LANGUAGE) $(basename "$i" ".txt")..."
		name=$(echo "$(basename "$i")" | sed -e 's/\.[0-9]\..*$//')
		sect=$(echo "$i" | sed -e 's/.*\.\([0-9]\)\.txt/\1/')
		pod2man -c "Epgsearch Version $VERSION" -n "$name" --section="$sect" "$i" >"man/$LANGUAGE/$(basename "$i" ".txt")"
		if [ $? -eq 0 ]; then
			echo " done."
		else
			echo " failed."
		fi
	done

	rm "$DOCSRC"/$LANGUAGE/*~ 2>/dev/null
	gzip -f man/$LANGUAGE/*.[0-9]

done

echo

for LANGUAGE in $(ls "$DOCSRC"/); do

	[ ! -d "$DOCSRC/$LANGUAGE" ] && continue
	mkdir -p doc/$LANGUAGE
	rm doc/$LANGUAGE/* 2>/dev/null

	for i in man/$LANGUAGE/*.gz; do
		echo -ne "create doc file from man page: ($LANGUAGE) $(basename "$i")..."
		zcat "$i" | nroff -man - | col -xbp > "doc/$LANGUAGE/$(basename "$i" ".gz").txt"
		echo " done"
	done

done

echo

#EOF