Annotation of doc/help/texxml2latex.pl, revision 1.1
1.1 ! bowersj2 1: #!/usr/bin/perl
! 2:
! 3: use strict;
! 4: use HTML::TokeParser;
! 5: use GDBM_File;
! 6:
! 7: # accept texxml document on standard in
! 8: my $p = HTML::TokeParser->new( $ARGV[0] );
! 9: my $dirprefix = "/home/httpd/html/adm/help/tex/";
! 10:
! 11: # Print the header
! 12: open (LATEX_FILE, $dirprefix . "Latex_Header.tex");
! 13: print <LATEX_FILE>;
! 14:
! 15:
! 16: while (my $token = $p->get_token())
! 17: {
! 18: my $type = $token->[0];
! 19: if ($type eq 'S')
! 20: {
! 21: my $tag = $token->[1];
! 22: my $attr = $token->[2];
! 23: if ($tag eq 'section')
! 24: {
! 25: my $title = $attr->{'name'};
! 26: print "\\section{$title}\n\n";
! 27: }
! 28:
! 29: if ($tag eq 'subsection')
! 30: {
! 31: my $title = $attr->{'name'};
! 32: print "\\subsection{$title}\n\n";
! 33: }
! 34:
! 35: if ($tag eq 'subsubsection')
! 36: {
! 37: my $title = $attr->{'name'};
! 38: print "\\subsubsection{$title}\n\n";
! 39: }
! 40:
! 41: if ($tag eq 'file')
! 42: {
! 43: my $file = $attr->{'name'};
! 44: open (LATEX_FILE, $dirprefix . $file);
! 45: print <LATEX_FILE>;
! 46: }
! 47:
! 48: if ($tag eq 'tex')
! 49: {
! 50: print "\n";
! 51: print $attr->{'content'};
! 52: print "\n";
! 53: }
! 54: }
! 55: }
! 56:
! 57: # Print out the footer.
! 58: open (LATEX_FILE, $dirprefix . "Latex_Footer.tex");
! 59: print <LATEX_FILE>;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>