File:
[LON-CAPA] /
doc /
help /
texxml2indextex.pl
Revision
1.3:
download - view:
text,
annotated -
select for diffs
Fri Jun 20 21:10:52 2003 UTC (21 years, 3 months ago) by
bowersj2
Branches:
MAIN
CVS tags:
version_2_9_X,
version_2_9_99_0,
version_2_9_1,
version_2_9_0,
version_2_8_X,
version_2_8_99_1,
version_2_8_99_0,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_X,
version_2_7_99_1,
version_2_7_99_0,
version_2_7_1,
version_2_7_0,
version_2_6_X,
version_2_6_99_1,
version_2_6_99_0,
version_2_6_3,
version_2_6_2,
version_2_6_1,
version_2_6_0,
version_2_5_X,
version_2_5_99_1,
version_2_5_99_0,
version_2_5_2,
version_2_5_1,
version_2_5_0,
version_2_4_X,
version_2_4_99_0,
version_2_4_2,
version_2_4_1,
version_2_4_0,
version_2_3_X,
version_2_3_99_0,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_X,
version_2_2_99_1,
version_2_2_99_0,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_X,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
version_2_1_99_0,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
version_2_10_0_RC2,
version_2_10_0_RC1,
version_2_10_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
version_1_3_X,
version_1_3_3,
version_1_3_2,
version_1_3_1,
version_1_3_0,
version_1_2_X,
version_1_2_99_1,
version_1_2_99_0,
version_1_2_1,
version_1_2_0,
version_1_1_X,
version_1_1_99_5,
version_1_1_99_4,
version_1_1_99_3,
version_1_1_99_2,
version_1_1_99_1,
version_1_1_99_0,
version_1_1_3,
version_1_1_2,
version_1_1_1,
version_1_1_0,
version_1_0_99_3,
version_1_0_99_2,
version_1_0_99_1,
version_1_0_99,
version_1_0_3,
version_1_0_2,
version_1_0_1,
version_1_0_0,
version_0_99_5,
version_0_99_4,
version_0_99_3,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
bz6209-base,
bz6209,
HEAD,
GCI_3,
GCI_2,
GCI_1,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
Seems to fix bug 1649.
It seems that for a given Apache child, the first run of tth would blow
up and spit out an error message, but not kill the child. The second run
would then totally kill tth (it output nothing at all, not even an error
message, let alone the HTML-ified tex), and only then would the server
die.
1: #!/usr/bin/perl
2:
3: # The LearningOnline Network with CAPA
4: # Converts a texxml file into an 'index' file suitable for use as a
5: # help file online
6: #
7: # Copyright Michigan State University Board of Trustees
8: #
9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
10: #
11: # LON-CAPA is free software; you can redistribute it and/or modify
12: # it under the terms of the GNU General Public License as published by
13: # the Free Software Foundation; either version 2 of the License, or
14: # (at your option) any later version.
15: #
16: # LON-CAPA is distributed in the hope that it will be useful,
17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: # GNU General Public License for more details.
20: #
21: # You should have received a copy of the GNU General Public License
22: # along with LON-CAPA; if not, write to the Free Software
23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: #
25: # /home/httpd/html/adm/gpl.txt
26: #
27: # http://www.lon-capa.org/
28: #
29: # 7-16-2002 Jeremy Bowers
30:
31: use strict;
32: use HTML::TokeParser;
33: use GDBM_File;
34:
35: if (not defined($ARGV[1]))
36: {
37: print <<USAGE;
38: Usage: texxml2indextex.pl texxmlfilename
39: texxml2indextex.pl will create an 'index file' suitable for use as a
40: sort of title page for a given set of help files. The second file will
41: be placed at the beginning, verbatim, so it can be used to provide
42: context, title, etc, if given.
43: USAGE
44:
45: exit;
46: }
47:
48: # accept texxml document on standard in
49: my $p = HTML::TokeParser->new( <$ARGV[1]> );
50: my $dirprefix = "/home/httpd/html/adm/help/tex/";
51:
52: # there's a TTH error if we put something before a section starts,
53: # so don't display anything that precedes a section. Since that's just
54: # the title page anyhow, no loss.
55: my $inSection = 0;
56:
57: while (my $token = $p->get_token())
58: {
59: my $type = $token->[0];
60: if ($type eq 'S')
61: {
62: my $tag = $token->[1];
63: my $attr = $token->[2];
64: if ($tag eq 'title')
65: {
66: my $title = $attr->{'name'};
67: print "{\\Large Online Access to $title}\n\n";
68: }
69: if ($tag eq 'section')
70: {
71: $inSection = 1;
72: my $title = $attr->{'name'};
73: print "\\emph{\\textbf{$title}}\n";
74: print "\\begin{itemize}\n\n";
75: }
76:
77: if ($tag eq 'subsection')
78: {
79: my $title = $attr->{'name'};
80: print "\\textbf{$title}\n\n";
81: print "\\begin{itemize}\n\n";
82: }
83:
84: if ($tag eq 'subsubsection')
85: {
86: my $title = $attr->{'name'};
87: print "\\emph{$title}\n\n";
88: print "\\begin{itemize}\n\n";
89: }
90:
91: if ($tag eq 'file')
92: {
93: my $file = substr($attr->{'name'}, 0, -4);
94: my $title = $file;
95: $title =~ s/_/ /g;
96: if ($inSection) {print "\\item \\ref{$file} $title\n\n"};
97: }
98: }
99: elsif ($type eq 'E')
100: {
101: my $tag = $token->[1];
102: if (index($tag, "section") != -1)
103: {
104: print "\\end{itemize}\n\n";
105: }
106: }
107: }
108:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>