File:  [LON-CAPA] / doc / help / texxml2latex.pl
Revision 1.1: download - view: text, annotated - select for diffs
Fri Jul 5 16:12:30 2002 UTC (21 years, 9 months ago) by bowersj2
Branches: MAIN
CVS tags: HEAD
This commit implements the .tex-based online help system in LON-CAPA. It
may be necessary to manually run loncom/build/help_graphics_converter.pl
and doc/help/rebuildLabelHash.pl after a cvs update, and
loncapa_apache.conf may need to be manually copied to /etc. (The
loncapafiles.lpml has been updated.)

After merging this, the URL http://[loncapahost]/adm/help/Foils.hlp
should display a help file.

Also, some *very* out-of-date files have been removed from the /doc
directory.

    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>