File: texi2devhelp.sh

package info (click to toggle)
devhelp 43.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,144 kB
  • sloc: ansic: 9,775; perl: 216; javascript: 152; sh: 100; xml: 66; python: 55; lisp: 29; makefile: 13
file content (58 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (11)
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
#!/bin/sh
# This scripts generates a devhelp meta file using the TOC and .idx files
# generated by texi2html
#
# written by Tobias Gruetzmacher <devhelp@portfolio16.de>
#
# Example usage:
# texi2html -Verbose -split=section -idx_sum -subdir=doc/devhelp/autoconf-2.59 doc/autoconf.texi
# gen-meta-devhelp.sh doc/devhelp/autoconf-2.59 autoconf Autoconf 2.59
# rm doc/devhelp/autoconf-2.59/*.idx

if [ "$#" -ne 4 ]
then
	echo "Syntax: `basename $0` <directory> <name> <book title> <version>"
	exit 1
fi

dir=$1
name=$2
title=$3
ver=$4

exec > $dir/$name-$ver.devhelp

cat <<EOF
<?xml version="1.0"?>

<book name="$name" version="$ver" title="$title" link="${name}_toc.html">

<chapters>
EOF

sed -n '1, /^<H1>/ d
	/^<HR/, $ d
	/^<BR>$/ N
	s/^<BR>\n<BLOCKQUOTE>$//
	s/^<BR>/<\/sub>/
	s/<\/\?\(TT\|CODE\|FONT\)[^>]*>//ig
	s/<A.*HREF=\("[^"]*"\)>\(.*\)<\/A>/<sub name="\2" link=\1>/p
	s/<\/BLOCKQUOTE>$/<\/sub>/p' $dir/${name}_toc.html | sed '$d'

cat <<EOF
</chapters>

<functions>
EOF

sed	's/&/\&amp;/g; s/"/\&quot;/g; s/</\&lt;/g; s/>/\&gt;/g
	 s/^/<function name="/
	 s/\t/" link="/
	 s/$/"\/>/' $dir/*.idx

cat <<EOF
</functions>

</book>
EOF