#!/usr/bin/env perl # converts vim documentation to simple html # Sirtaj Singh Kang (taj@kde.org) # Wed Oct 8 01:15:48 EST 1997 $date = `date`; chop $date; %url = (); sub readTagFile { my($tagfile) = @_; local( $tag, $file, $name ); open(TAGS,"$tagfile") || die "can't read tags\n"; while( ) { s//>/g; /^(.*)\t(.*)\t/; $tag = $1; ($file= $2) =~ s/.txt$/.html/g; $url{ $tag } = "$tag"; #print "($tag, $file, $tag)\n"; } close( TAGS ); } sub vim2html { my( $infile ) = @_; local( $outfile ); open(IN, "$infile" ) || die "Couldn't read from $infile.\n"; ($outfile = $infile) =~ s%.*/%%g; $outfile =~ s/\.txt$//g; open( OUT, ">$outfile.html" ) || die "Couldn't write to $outfile.html.\n"; print OUT< $outfile

Vim Documentation: $outfile


EOF

	while(  ) {
		s//>/g;

		s/\*([^*]*)\*/\*<\/A>$1<\/B>\*/g;
		s/\|([^|]*)\|/\|$url{$1}\|/g;

		print OUT $_;
	}
	print OUT<

Generated by vim2html on $date

EOF } sub usage { die< EOF } # main if ( $#ARGV < 2 ) { usage(); } print "Processing tags...\n"; readTagFile( $ARGV[ 0 ] ); foreach $file ( 1..$#ARGV ) { print "Processing ".$ARGV[ $file ]."...\n"; vim2html( $ARGV[ $file ] ); }