]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/bin/texi2man.sh
release: 1.0.1
[lilypond.git] / stepmake / bin / texi2man.sh
1 #!/bin/sh
2 # texi2man.sh
3
4 if [ $# -ne 2 ]; then
5         echo "Usage: texi2man TEXINFO-FILE MAN-FILENAME"
6         exit 2
7 fi
8
9 date=`date +%d/%b/%y`
10 #urg
11 package_name=LilyPond
12 #urg urg
13 version=0.1.71
14
15 infile=$1
16 outfile=$2
17 name=`basename $1 .texinfo`
18 name=`basename $name .texi`
19 name=`echo $name | tr '[A-Z]' '[a-z]'`
20 NAME=`echo $name | tr '[a-z]' '[A-Z]'`
21
22 echo .TH\ $NAME\ 1\ \"$date\" "$package_name Documentation" >$outfile
23
24 NEWLINE="
25 "
26 cat $infile | 
27 #urg, wish we could fix texi2roff :-(
28 sed 's!.*\\input .*texinfo.*!!' |
29 sed 's!^@chapter.*!@section NAME!' |
30 # sed 's!^@node *[Ii]nvoking.*!@section SYNOPSIS!' |
31 sed 's!^@node.*!!' |
32 # perl -pe "{s/\@node ([^,]*).*/\@section /;\$i=\$1; \$i=~tr [a-z] [A-Z]; chop; \$_.=\$i . \"\n\";}" |
33 perl -pe "{s/\@section (.*)/\@section /;\$i=\$1; \$i=~tr [a-z] [A-Z]; chop; \$_.=\$i . \"\n\";}" |
34 sed 's!^@subsection .*!!' |
35 sed 's!^@c *@texi2man@!@!' |
36 perl -pe "s/\@url{([^}]*)}/\$1/" |
37 perl -pe "s/\@email{([^},]*)}/<\$1>/" |
38 perl -pe "s/\@email{([^},]*),([^}]*)}/\$2, <\$1>/" |
39 sed "s!DESCRIPTION!& NEWLINE\
40 This manual page was automatically generated from $infile by $0.  For more details, please refer to the info pages: NEWLINE\
41     info $name NEWLINE\
42 !" |
43 sed "s!NEWLINE!\\$NEWLINE!g" |
44 # debugging:
45 tee $infile.texi2roff |
46 texi2roff -ms |
47 sed 's!^\.ds __ !.SH !' |
48 # /\&\n(H1.\n(H2      \*(__
49 sed 's!.*(H1.*!!' |
50 cat >> $outfile
51