Add /src/vim/release.sh, a script to compile and install vim
[msysgit.git] / share / vim / vim58 / doc / vim2html.pl
blob1b3bc2e735a82c842f6097acf899555f587be6f2
1 #!/usr/bin/env perl
3 # converts vim documentation to simple html
4 # Sirtaj Singh Kang (taj@kde.org)
6 # Wed Oct 8 01:15:48 EST 1997
8 $date = `date`;
9 chop $date;
11 %url = ();
13 sub readTagFile
15 my($tagfile) = @_;
16 local( $tag, $file, $name );
18 open(TAGS,"$tagfile") || die "can't read tags\n";
20 while( <TAGS> ) {
21 s/</&lt;/g;
22 s/>/&gt;/g;
24 /^(.*)\t(.*)\t/;
26 $tag = $1;
27 ($file= $2) =~ s/.txt$/.html/g;
29 $url{ $tag } = "<A HREF=\"$file#$tag\">$tag</A>";
31 #print "($tag, $file, $tag)\n";
33 close( TAGS );
36 sub vim2html
38 my( $infile ) = @_;
39 local( $outfile );
41 open(IN, "$infile" ) || die "Couldn't read from $infile.\n";
43 ($outfile = $infile) =~ s%.*/%%g;
44 $outfile =~ s/\.txt$//g;
46 open( OUT, ">$outfile.html" )
47 || die "Couldn't write to $outfile.html.\n";
49 print OUT<<EOF;
50 <HTML>
51 <HEAD><TITLE>$outfile</TITLE></HEAD>
52 <BODY BGCOLOR="#ffffff">
53 <H1>Vim Documentation: $outfile</H1>
54 <HR>
55 <PRE>
56 EOF
58 while( <IN> ) {
59 s/</&lt;/g;
60 s/>/&gt;/g;
62 s/\*([^*]*)\*/\*<A NAME="$1"><\/A><B>$1<\/B>\*/g;
63 s/\|([^|]*)\|/\|$url{$1}\|/g;
65 print OUT $_;
67 print OUT<<EOF;
68 </PRE>
69 <p><i>Generated by vim2html on $date</i></p>
70 </BODY>
71 </HTML>
72 EOF
76 sub usage
78 die<<EOF;
79 vim2html.pl: converts vim documentation to HTML.
80 usage:
82 vim2html.pl <tag file> <text files>
83 EOF
86 # main
88 if ( $#ARGV < 2 ) {
89 usage();
92 print "Processing tags...\n";
93 readTagFile( $ARGV[ 0 ] );
95 foreach $file ( 1..$#ARGV ) {
96 print "Processing ".$ARGV[ $file ]."...\n";
97 vim2html( $ARGV[ $file ] );