File:
[LON-CAPA] /
loncom /
xml /
londefdef.pm
Revision
1.109:
download - view:
text,
annotated -
select for diffs
Mon Feb 3 19:10:28 2003 UTC (21 years, 3 months ago) by
sakharuk
Branches:
MAIN
CVS tags:
HEAD
Correction was done to the width of the table in the case of one column table.
Checked on two dozens problems. Works well but the case of nested one column tables does not supported yet. Working on more global changes.
1: # The LearningOnline Network with CAPA
2: # Tags Default Definition Module
3: #
4: # $Id: londefdef.pm,v 1.109 2003/02/03 19:10:28 sakharuk Exp $
5: #
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: # Copyright for TtHfunc and TtMfunc by Ian Hutchinson.
30: # TtHfunc and TtMfunc (the "Code") may be compiled and linked into
31: # binary executable programs or libraries distributed by the
32: # Michigan State University (the "Licensee"), but any binaries so
33: # distributed are hereby licensed only for use in the context
34: # of a program or computational system for which the Licensee is the
35: # primary author or distributor, and which performs substantial
36: # additional tasks beyond the translation of (La)TeX into HTML.
37: # The C source of the Code may not be distributed by the Licensee
38: # to any other parties under any circumstances.
39: #
40: #
41: # last modified 06/26/00 by Alexander Sakharuk
42: # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer
43: # 01/18 Alex Sakharuk
44:
45: package Apache::londefdef;
46:
47: use Apache::lonnet;
48: use strict;
49: use Apache::lonxml;
50: use Apache::File();
51: use Image::Magick;
52:
53: BEGIN {
54:
55: &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','u','ul','var','wbr'));
56:
57: }
58:
59: #======================= TAG SUBROUTINES =====================
60: #-- <output>
61: sub start_output {
62: my ($target) = @_;
63: if ($target eq 'meta') { $Apache::lonxml::metamode--; }
64: return '';
65: }
66: sub end_output {
67: my ($target) = @_;
68: if ($target eq 'meta') { $Apache::lonxml::metamode++; }
69: return '';
70: }
71: #-- <m> tag
72: sub start_m {
73: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
74: my $currentstring = '';
75: if ($target eq 'web') {
76: $Apache::lonxml::prevent_entity_encode++;
77: my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
78: $inside ='\\documentstyle{article}'.$inside;
79: &Apache::lonxml::debug("M is starting with:$inside:");
80: my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
81: if ($eval eq 'on') {
82: $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
83: #&Apache::lonxml::debug("M is evaulated to:$inside:");
84: }
85: $currentstring = &Apache::lontexconvert::converted(\$inside);
86: if ($Apache::lontexconvert::errorstring) {
87: &Apache::lonxml::warning("tth error: ".
88: $Apache::lontexconvert::errorstring);
89: $Apache::lontexconvert::errorstring='';
90: }
91: #&Apache::lonxml::debug("M is ends with:$currentstring:");
92: } elsif ($target eq 'tex') {
93: $currentstring = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
94: if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';}
95: } else {
96: my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
97: }
98: return $currentstring;
99: }
100: sub end_m {
101: my ($target,$token) = @_;
102: my $currentstring = '';
103: if ($target eq 'web') {
104: $Apache::lonxml::prevent_entity_encode--;
105: } elsif ($target eq 'tex') {
106: $currentstring = "";
107: } elsif ($target eq 'meta') {
108: }
109: return $currentstring;
110: }
111: #-- <html> tag
112: sub start_html {
113: my ($target,$token) = @_;
114: my $currentstring = '';
115: if ($ENV{'browser.mathml'}) {
116: &tth::ttminit();
117: if ($ENV{'browser.unicode'}) {
118: &tth::ttmoptions('-L -u1');
119: } else {
120: &tth::ttmoptions('-L -u0');
121: }
122: } else {
123: &tth::tthinit();
124: if ($ENV{'browser.unicode'}) {
125: &tth::tthoptions('-L -u1');
126: } else {
127: &tth::tthoptions('-L -u0');
128: }
129: }
130: if ($target eq 'web') {
131: $currentstring = &Apache::lonxml::xmlbegin().
132: &Apache::lonxml::fontsettings();
133: } elsif ($target eq 'tex') {
134: @Apache::londefdef::table = ();
135: $currentstring .= '\documentclass[letterpaper]{article}
136: \newcommand{\keephidden}[1]{}
137: \renewcommand{\deg}{$^{\circ}$}
138: \usepackage[dvips]{graphicx}
139: \usepackage{epsfig}\usepackage{calc}
140: \newenvironment{choicelist}{\begin{enumerate}}{\end{enumerate}}';
141: }
142: return $currentstring;
143: }
144: sub end_html {
145: my ($target,$token) = @_;
146: my $currentstring = '';
147: if ($target eq 'web') {
148: $currentstring = &Apache::lonxml::xmlend();
149: }
150: return $currentstring;
151: }
152: #-- <head> tag
153: sub start_head {
154: my ($target,$token) = @_;
155: my $currentstring = '';
156: if ($target eq 'web') {
157: $currentstring = $token->[4];
158: }
159: return $currentstring;
160: }
161: sub end_head {
162: my ($target,$token) = @_;
163: my $currentstring = '';
164: if ($target eq 'web') {
165: $currentstring = &Apache::lonxml::registerurl(undef,$target).
166: $token->[2];
167: }
168: return $currentstring;
169: }
170: #-- <map> tag
171: sub start_map {
172: my ($target,$token) = @_;
173: my $currentstring = '';
174: if ($target eq 'web') {
175: $currentstring = $token->[4];
176: }
177: return $currentstring;
178: }
179: sub end_map {
180: my ($target,$token) = @_;
181: my $currentstring = '';
182: if ($target eq 'web') {
183: $currentstring = $token->[2];
184: }
185: return $currentstring;
186: }
187: #-- <select> tag
188: sub start_select {
189: my ($target,$token) = @_;
190: my $currentstring = '';
191: if ($target eq 'web') {
192: $currentstring = $token->[4];
193: }
194: return $currentstring;
195: }
196: sub end_select {
197: my ($target,$token) = @_;
198: my $currentstring = '';
199: if ($target eq 'web') {
200: $currentstring = $token->[2];
201: }
202: return $currentstring;
203: }
204: #-- <option> tag
205: sub start_option {
206: my ($target,$token) = @_;
207: my $currentstring = '';
208: if ($target eq 'web') {
209: $currentstring = $token->[4];
210: }
211: return $currentstring;
212: }
213: sub end_option {
214: my ($target,$token) = @_;
215: my $currentstring = '';
216: if ($target eq 'web') {
217: $currentstring = $token->[2];
218: }
219: return $currentstring;
220: }
221: #-- <input> tag
222: sub start_input {
223: my ($target,$token) = @_;
224: my $currentstring = '';
225: if ($target eq 'web') {
226: $currentstring = $token->[4];
227: }
228: return $currentstring;
229: }
230: sub end_input {
231: my ($target,$token) = @_;
232: my $currentstring = '';
233: if ($target eq 'web') {
234: $currentstring = $token->[2];
235: }
236: return $currentstring;
237: }
238: #-- <textarea> tag
239: sub start_textarea {
240: my ($target,$token) = @_;
241: my $currentstring = '';
242: if ($target eq 'web') {
243: $currentstring = $token->[4];
244: }
245: return $currentstring;
246: }
247: sub end_textarea {
248: my ($target,$token) = @_;
249: my $currentstring = '';
250: if ($target eq 'web') {
251: $currentstring = $token->[2];
252: }
253: return $currentstring;
254: }
255: #-- <form> tag
256: sub start_form {
257: my ($target,$token) = @_;
258: my $currentstring = '';
259: if ($target eq 'web') {
260: $currentstring = $token->[4];
261: }
262: return $currentstring;
263: }
264: sub end_form {
265: my ($target,$token) = @_;
266: my $currentstring = '';
267: if ($target eq 'web') {
268: $currentstring = $token->[2];
269: }
270: return $currentstring;
271: }
272: #-- <title> tag
273: sub start_title {
274: my ($target,$token) = @_;
275: my $currentstring = '';
276: if ($target eq 'web') {
277: $currentstring = $token->[4];
278: } elsif ($target eq 'tex') {
279: $currentstring .= '\keephidden{'
280: }
281: if ($target eq 'meta') {
282: $currentstring='<title>';
283: &start_output();
284: }
285: return $currentstring;
286: }
287: sub end_title {
288: my ($target,$token) = @_;
289: my $currentstring = '';
290: if ($target eq 'web') {
291: $currentstring = $token->[2];
292: } elsif ($target eq 'tex') {
293: $currentstring .= '}';
294: }
295: if ($target eq 'meta') {
296: &end_output();
297: $currentstring='</title>';
298: }
299: return $currentstring;
300: }
301: #-- <meta> tag
302: sub start_meta {
303: my ($target,$token,$tagstack,$parstack,$parser) = @_;
304: my $currentstring = '';
305: if ($target eq 'web') {
306: my $args='';
307: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
308: if ($args eq '') {
309: &Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]);
310: } else {
311: $currentstring = $token->[4];
312: }
313: }
314: if ($target eq 'meta') {
315: unless ($token->[2]->{'http-equiv'}) {
316: my $name=$token->[2]->{'name'};
317: $name=~tr/A-Z/a-z/;
318: $name=~s/\s/\_/g;
319: if ($name) {
320: $currentstring='<'.$name.'>'.
321: $token->[2]->{'content'}.
322: '</'.$name.'>';
323: }
324: }
325: }
326: return $currentstring;
327: }
328: sub end_meta {
329: my ($target,$token,$tagstack,$parstack,$parser) = @_;
330: my $currentstring = '';
331: if ($target eq 'web') {
332: my $args='';
333: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
334: if ($args ne '') {
335: $currentstring = $token->[4];
336: }
337: }
338: return $currentstring;
339: }
340: #-- <body> tag
341: sub start_body {
342: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
343: my $currentstring = '';
344: if ($target eq 'web') {
345: if (!$Apache::lonxml::registered) {
346: $currentstring.='<head>'.
347: &Apache::lonxml::registerurl(undef,$target).'</head>';
348: }
349: my $onLoad='';
350: foreach my $key (keys(%{$token->[2]})) {
351: if ($key =~ /^onload$/i) {
352: $onLoad.=$token->[2]->{$key}.';';
353: delete($token->[2]->{$key});
354: }
355: }
356: $token->[2]->{'onload'}=&Apache::lonxml::loadevents().
357: ';'.$onLoad;
358: my $onUnload='';
359: foreach my $key (keys(%{$token->[2]})) {
360: if ($key =~ /^onunload$/i) {
361: $onUnload.=$token->[2]->{$key}.';';
362: delete($token->[2]->{$key});
363: }
364: }
365: $token->[2]->{'onunload'}=&Apache::lonxml::unloadevents().
366: ';'.$onUnload;
367:
368: $currentstring .= '<'.$token->[1];
369: foreach (keys %{$token->[2]}) {
370: $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
371: }
372: $currentstring.='>';
373: if ($ENV{'request.state'} ne 'published') {
374: $currentstring.=(<<EDITBUTTON);
375: <form method="post">
376: <input type="submit" name="editmode" value="Edit" />
377: </form>
378: EDITBUTTON
379: }
380: } elsif ($target eq 'tex') {
381: $currentstring = '\begin{document}';
382: }
383: return $currentstring;
384: }
385: sub end_body {
386: my ($target,$token) = @_;
387: my $currentstring = '';
388: if ($target eq 'web') {
389: $currentstring = $token->[2];
390: } elsif ($target eq 'tex') {
391: $currentstring = '\end{document}';
392: }
393: return $currentstring;
394: }
395: #-- <center> tag
396: sub start_center {
397: my ($target,$token) = @_;
398: my $currentstring = '';
399: if ($target eq 'web') {
400: $currentstring = $token->[4];
401: } elsif ($target eq 'tex') {
402: $currentstring = '\begin{center}';
403: } elsif ($target eq 'latexsource') {
404: $currentstring = '\begin{center}';
405: }
406: return $currentstring;
407: }
408: sub end_center {
409: my ($target,$token) = @_;
410: my $currentstring = '';
411: if ($target eq 'web') {
412: $currentstring = $token->[2];
413: } elsif ($target eq 'tex') {
414: $currentstring = '\end{center}';
415: } elsif ($target eq 'latexsource') {
416: $currentstring = '\end{center}';
417: }
418: return $currentstring;
419: }
420: #-- <b> tag
421: sub start_b {
422: my ($target,$token) = @_;
423: my $currentstring = '';
424: if ($target eq 'web') {
425: $currentstring = $token->[4];
426: } elsif ($target eq 'tex') {
427: $currentstring = '\textbf{';
428: } elsif ($target eq 'latexsource') {
429: $currentstring = '\textbf{';
430: }
431: return $currentstring;
432: }
433: sub end_b {
434: my ($target,$token) = @_;
435: my $currentstring = '';
436: if ($target eq 'web') {
437: $currentstring = $token->[2];
438: } elsif ($target eq 'tex') {
439: $currentstring = '}';
440:
441: } elsif ($target eq 'latexsource') {
442: $currentstring = '}';
443: }
444: return $currentstring;
445: }
446: #-- <strong> tag
447: sub start_strong {
448: my ($target,$token) = @_;
449: my $currentstring = '';
450: if ($target eq 'web') {
451: $currentstring = $token->[4];
452: } elsif ($target eq 'tex') {
453: $currentstring = '\textbf{';
454: } elsif ($target eq 'latexsource') {
455: $currentstring = '\textbf{';
456: }
457: return $currentstring;
458: }
459: sub end_strong {
460: my ($target,$token) = @_;
461: my $currentstring = '';
462: if ($target eq 'web') {
463:
464: $currentstring = $token->[2];
465: } elsif ($target eq 'tex') {
466: $currentstring = '}';
467: } elsif ($target eq 'latexsource') {
468: $currentstring = '}';
469: }
470: return $currentstring;
471: }
472: #-- <h1> tag
473: sub start_h1 {
474: my ($target,$token) = @_;
475: my $currentstring = '';
476: if ($target eq 'web') {
477: $currentstring .= $token->[4];
478: } elsif ($target eq 'tex') {
479: $currentstring .= '{\large \textbf{';
480: } elsif ($target eq 'meta') {
481: $currentstring='<subject>';
482: &start_output();
483: }
484: return $currentstring;
485: }
486: sub end_h1 {
487: my ($target,$token) = @_;
488: my $currentstring = '';
489: if ($target eq 'web') {
490: $currentstring .= $token->[2];
491: } elsif ($target eq 'tex') {
492: $currentstring .= '}}';
493: } elsif ($target eq 'meta') {
494: &end_output();
495: $currentstring='</subject>';
496: }
497: return $currentstring;
498: }
499: #-- <h2> tag
500: sub start_h2 {
501: my ($target,$token) = @_;
502: my $currentstring = '';
503: if ($target eq 'web') {
504: $currentstring .= $token->[4];
505: } elsif ($target eq 'tex') {
506: $currentstring .= '{\large \textbf{';
507: }
508: return $currentstring;
509: }
510: sub end_h2 {
511: my ($target,$token) = @_;
512: my $currentstring = '';
513: if ($target eq 'web') {
514: $currentstring .= $token->[2];
515: } elsif ($target eq 'tex') {
516: $currentstring .= '}}';
517: }
518: return $currentstring;
519: }
520: #-- <h3> tag
521: sub start_h3 {
522: my ($target,$token) = @_;
523: my $currentstring = '';
524: if ($target eq 'web') {
525: $currentstring .= $token->[4];
526: } elsif ($target eq 'tex') {
527: $currentstring .= '{\large \textbf{';
528: }
529: return $currentstring;
530: }
531: sub end_h3 {
532: my ($target,$token) = @_;
533: my $currentstring = '';
534: if ($target eq 'web') {
535: $currentstring .= $token->[2];
536: } elsif ($target eq 'tex') {
537: $currentstring .= '}}';
538: }
539: return $currentstring;
540: }
541: #-- <h4> tag
542: sub start_h4 {
543: my ($target,$token) = @_;
544: my $currentstring = '';
545: if ($target eq 'web') {
546: $currentstring .= $token->[4];
547: } elsif ($target eq 'tex') {
548: $currentstring .= '{\large \textbf{';
549: }
550: return $currentstring;
551: }
552: sub end_h4 {
553: my ($target,$token) = @_;
554: my $currentstring = '';
555: if ($target eq 'web') {
556: $currentstring .= $token->[2];
557: } elsif ($target eq 'tex') {
558: $currentstring .= '}}';
559: }
560: return $currentstring;
561: }
562: #-- <h5> tag
563: sub start_h5 {
564: my ($target,$token) = @_;
565: my $currentstring = '';
566: if ($target eq 'web') {
567: $currentstring .= $token->[4];
568: } elsif ($target eq 'tex') {
569: $currentstring .= '{\large \textbf{';
570: }
571: return $currentstring;
572: }
573: sub end_h5 {
574: my ($target,$token) = @_;
575: my $currentstring = '';
576: if ($target eq 'web') {
577: $currentstring .= $token->[2];
578: } elsif ($target eq 'tex') {
579: $currentstring .= '}}';
580: }
581: return $currentstring;
582: }
583: #-- <h6> tag
584: sub start_h6 {
585: my ($target,$token) = @_;
586: my $currentstring = '';
587: if ($target eq 'web') {
588: $currentstring .= $token->[4];
589: } elsif ($target eq 'tex') {
590: $currentstring .= '{\large \textbf{';
591: }
592: return $currentstring;
593: }
594: sub end_h6 {
595: my ($target,$token) = @_;
596: my $currentstring = '';
597: if ($target eq 'web') {
598: $currentstring .= $token->[2];
599: } elsif ($target eq 'tex') {
600: $currentstring .= '}}';
601: }
602: return $currentstring;
603: }
604: #--- <cite> tag
605: sub start_cite {
606: my ($target,$token) = @_;
607: my $currentstring = '';
608: if ($target eq 'web') {
609: $currentstring .= $token->[4];
610: } elsif ($target eq 'tex') {
611: $currentstring .= "\\textit{";
612: } elsif ($target eq 'latexsource') {
613: $currentstring .= "\\textit{";
614: }
615: return $currentstring;
616: }
617: sub end_cite {
618: my ($target,$token) = @_;
619: my $currentstring = '';
620: if ($target eq 'web') {
621: $currentstring .= $token->[2];
622: } elsif ($target eq 'tex') {
623: $currentstring .= "}";
624: } elsif ($target eq 'latexsource') {
625: $currentstring .= "}";
626: }
627: return $currentstring;
628: }
629: #-- <i> tag
630: sub start_i {
631: my ($target,$token) = @_;
632: my $currentstring = '';
633: if ($target eq 'web') {
634: $currentstring .= $token->[4];
635: } elsif ($target eq 'tex') {
636: $currentstring .= '\textit{';
637: } elsif ($target eq 'latexsource') {
638: $currentstring .= '\textit{';
639: }
640: return $currentstring;
641: }
642: sub end_i {
643: my ($target,$token) = @_;
644: my $currentstring = '';
645: if ($target eq 'web') {
646: $currentstring .= $token->[2];
647: } elsif ($target eq 'tex') {
648: $currentstring .= '}';
649: } elsif ($target eq 'latexsource') {
650: $currentstring .= '}';
651: }
652: return $currentstring;
653: }
654: #-- <address> tag
655: sub start_address {
656: my ($target,$token) = @_;
657: my $currentstring = '';
658: if ($target eq 'web') {
659: $currentstring .= $token->[4];
660: } elsif ($target eq 'tex') {
661: $currentstring .= "\\textit{";
662: } elsif ($target eq 'latexsource') {
663: $currentstring .= "\\textit{";
664: }
665: return $currentstring;
666: }
667: sub end_address {
668: my ($target,$token) = @_;
669: my $currentstring = '';
670: if ($target eq 'web') {
671: $currentstring .= $token->[2];
672: } elsif ($target eq 'tex') {
673: $currentstring .= "}";
674: } elsif ($target eq 'latexsource') {
675: $currentstring .= "}";
676: }
677: return $currentstring;
678: }
679: #-- <dfn> tag
680: sub start_dfn {
681: my ($target,$token) = @_;
682: my $currentstring = '';
683: if ($target eq 'web') {
684: $currentstring .= $token->[4];
685: } elsif ($target eq 'tex') {
686: $currentstring .= "\\textit{";
687: } elsif ($target eq 'latexsource') {
688: $currentstring .= "\\textit{";
689: }
690: return $currentstring;
691: }
692: sub end_dfn {
693: my ($target,$token) = @_;
694: my $currentstring = '';
695: if ($target eq 'web') {
696: $currentstring .= $token->[2];
697: } elsif ($target eq 'tex') {
698: $currentstring .= "}";
699: } elsif ($target eq 'latexsource') {
700: $currentstring .= "}";
701: }
702: return $currentstring;
703: }
704: #-- <tt> tag
705: sub start_tt {
706: my ($target,$token) = @_;
707: my $currentstring = '';
708: if ($target eq 'web') {
709: $currentstring .= $token->[4];
710: } elsif ($target eq 'tex') {
711: $currentstring .= '\texttt{';
712: } elsif ($target eq 'latexsource') {
713: $currentstring .= '\texttt{';
714: }
715: return $currentstring;
716: }
717: sub end_tt {
718: my ($target,$token) = @_;
719: my $currentstring = '';
720: if ($target eq 'web') {
721: $currentstring .= $token->[2];
722: } elsif ($target eq 'tex') {
723: $currentstring .= '}';
724: } elsif ($target eq 'latexsource') {
725: $currentstring .= '}';
726: }
727: return $currentstring;
728: }
729: #-- <kbd> tag
730: sub start_kbd {
731: my ($target,$token) = @_;
732: my $currentstring = '';
733: if ($target eq 'web') {
734: $currentstring .= $token->[4];
735: } elsif ($target eq 'tex') {
736: $currentstring .= "\\texttt";
737: } elsif ($target eq 'latexsource') {
738: $currentstring .= "\\texttt{";
739: }
740: return $currentstring;
741: }
742: sub end_kbd {
743: my ($target,$token) = @_;
744: my $currentstring = '';
745: if ($target eq 'web') {
746: $currentstring .= $token->[2];
747: } elsif ($target eq 'tex') {
748: $currentstring .= "}";
749: } elsif ($target eq 'latexsource') {
750: $currentstring .= "}";
751: }
752: return $currentstring;
753: }
754: #-- <code> tag
755: sub start_code {
756: my ($target,$token) = @_;
757: my $currentstring = '';
758: if ($target eq 'web') {
759: $currentstring .= $token->[4];
760: } elsif ($target eq 'tex') {
761: $currentstring .= '\texttt{';
762: }
763: return $currentstring;
764: }
765: sub end_code {
766: my ($target,$token) = @_;
767: my $currentstring = '';
768: if ($target eq 'web') {
769: $currentstring .= $token->[2];
770: } elsif ($target eq 'tex') {
771: $currentstring .= '}';
772: }
773: return $currentstring;
774: }
775: #-- <em> tag
776: sub start_em {
777: my ($target,$token) = @_;
778: my $currentstring = '';
779: if ($target eq 'web') {
780: $currentstring .= $token->[4];
781: } elsif ($target eq 'tex') {
782: $currentstring .= '\emph{';
783: } elsif ($target eq 'latexsource') {
784: $currentstring .= '\emph{';
785: }
786: return $currentstring;
787: }
788: sub end_em {
789: my ($target,$token) = @_;
790: my $currentstring = '';
791: if ($target eq 'web') {
792: $currentstring .= $token->[2];
793: } elsif ($target eq 'tex') {
794: $currentstring .= '}';
795: } elsif ($target eq 'latexsource') {
796: $currentstring .= '}';
797: }
798: return $currentstring;
799: }
800: #-- <q> tag
801: sub start_q {
802: my ($target,$token) = @_;
803: my $currentstring = '';
804: if ($target eq 'web') {
805: $currentstring .= $token->[4];
806: } elsif ($target eq 'tex') {
807: $currentstring .= "\\emph{";
808: } elsif ($target eq 'latexsource') {
809: $currentstring .= "\\emph{";
810: }
811: return $currentstring;
812: }
813: sub end_q {
814: my ($target,$token) = @_;
815: my $currentstring = '';
816: if ($target eq 'web') {
817: $currentstring .= $token->[2];
818: } elsif ($target eq 'tex') {
819: $currentstring .= "}";
820: } elsif ($target eq 'latexsource') {
821: $currentstring .= "}";
822: }
823: return $currentstring;
824: }
825: #-- <p> tag
826: sub start_p {
827: my ($target,$token) = @_;
828: my $currentstring = '';
829: if ($target eq 'web') {
830: $currentstring .= $token->[4];
831: } elsif ($target eq 'tex') {
832: $currentstring .= '{\par ';
833: } elsif ($target eq 'latexsource') {
834: $currentstring .= '{\par ';
835: }
836: return $currentstring;
837: }
838: sub end_p {
839: my ($target,$token) = @_;
840: my $currentstring = '';
841: if ($target eq 'web') {
842: $currentstring .= $token->[2];
843: } elsif ($target eq 'tex') {
844: $currentstring .= '}';
845: } elsif ($target eq 'latexsource') {
846: $currentstring .= '}';
847: }
848: return $currentstring;
849: }
850: #-- <br> tag
851: sub start_br {
852: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
853: my $currentstring = '';
854: if ($target eq 'web') {
855: $currentstring .= $token->[4];
856: } elsif ($target eq 'tex') {
857: if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') {
858: $currentstring .= '\vskip 0.2 mm';
859: }
860: } elsif ($target eq 'latexsource') {
861: $currentstring .= '\\';
862: }
863: return $currentstring;
864: }
865: sub end_br {
866: my ($target,$token) = @_;
867: my $currentstring = '';
868: if ($target eq 'web') {
869: $currentstring .= $token->[2];
870: }
871: return $currentstring;
872: }
873: #-- <big> tag
874: sub start_big {
875: my ($target,$token) = @_;
876: my $currentstring = '';
877: if ($target eq 'web') {
878: $currentstring .= $token->[4];
879: } elsif ($target eq 'tex') {
880: $currentstring .= '\large{';
881: } elsif ($target eq 'latexsource') {
882: $currentstring .= '{\Large ';
883: }
884: return $currentstring;
885: }
886: sub end_big {
887: my ($target,$token) = @_;
888: my $currentstring = '';
889: if ($target eq 'web') {
890: $currentstring .= $token->[2];
891: } elsif ($target eq 'tex') {
892: $currentstring .= '}';
893: } elsif ($target eq 'latexsource') {
894: $currentstring .= '}';
895: }
896: return $currentstring;
897: }
898: #-- <small> tag
899: sub start_small {
900: my ($target,$token) = @_;
901: my $currentstring = '';
902: if ($target eq 'web') {
903: $currentstring .= $token->[4];
904: } elsif ($target eq 'tex') {
905: $currentstring .= '{\footnotesize ';
906: } elsif ($target eq 'latexsource') {
907: $currentstring .= '{\footnotesize ';
908: }
909: return $currentstring;
910: }
911: sub end_small {
912: my ($target,$token) = @_;
913: my $currentstring = '';
914: if ($target eq 'web') {
915: $currentstring .= $token->[2];
916: } elsif ($target eq 'tex') {
917: $currentstring .= '}';
918: } elsif ($target eq 'latexsource') {
919: $currentstring .= '}';
920: }
921: return $currentstring;
922: }
923: #-- <basefont> tag
924: sub start_basefont {
925: my ($target,$token) = @_;
926: my $currentstring = '';
927: if ($target eq 'web') {
928: $currentstring = $token->[4];
929: }
930: return $currentstring;
931: }
932: sub end_basefont {
933: my ($target,$token) = @_;
934: my $currentstring = '';
935: if ($target eq 'web') {
936: $currentstring = $token->[4];
937: }
938: return $currentstring;
939: }
940: #-- <font> tag
941: sub start_font {
942: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
943: my $currentstring = '';
944: if ($target eq 'web') {
945: my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
946: if ($face=~/symbol/i) {$Apache::lonxml::prevent_entity_encode++;}
947: $currentstring = $token->[4];
948: }
949: return $currentstring;
950: }
951: sub end_font {
952: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
953: my $currentstring = '';
954: if ($target eq 'web') {
955: my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
956: if ($face=~/symbol/i) {$Apache::lonxml::prevent_entity_encode--;}
957: $currentstring = $token->[2];
958: }
959: return $currentstring;
960: }
961: #-- <strike> tag
962: sub start_strike {
963: my ($target,$token) = @_;
964: my $currentstring = '';
965: if ($target eq 'web') {
966: $currentstring .= $token->[4];
967: } elsif ($target eq 'tex') {
968: &Apache::lonxml::startredirection();
969: }
970: return $currentstring;
971: }
972: sub end_strike {
973: my ($target,$token) = @_;
974: my $currentstring = '';
975: if ($target eq 'web') {
976: $currentstring .= $token->[2];
977: } elsif ($target eq 'tex') {
978: $currentstring=&Apache::lonxml::endredirection();
979: $currentstring=~s/(\S)(\s+)(\S)/$1}$2\\underline{$3/g;
980: $currentstring=~s/^\s*(\S)/\\underline{$1/;
981: $currentstring=~s/(\S)\s*$/$1}/;
982: }
983: return $currentstring;
984: }
985: #-- <s> tag
986: sub start_s {
987: my ($target,$token) = @_;
988: my $currentstring = '';
989: if ($target eq 'web') {
990: $currentstring .= $token->[4];
991: } elsif ($target eq 'tex') {
992: &Apache::lonxml::startredirection();
993: }
994: return $currentstring;
995: }
996: sub end_s {
997: my ($target,$token) = @_;
998: my $currentstring = '';
999: if ($target eq 'web') {
1000: $currentstring .= $token->[2];
1001: } elsif ($target eq 'tex') {
1002: $currentstring=&Apache::lonxml::endredirection();
1003: $currentstring=~s/(\S)(\s+)(\S)/$1}$2\\underline{$3/g;
1004: $currentstring=~s/^\s*(\S)/\\underline{$1/;
1005: $currentstring=~s/(\S)\s*$/$1}/;
1006: }
1007: return $currentstring;
1008: }
1009: #-- <sub> tag
1010: sub start_sub {
1011: my ($target,$token) = @_;
1012: my $currentstring = '';
1013: if ($target eq 'web') {
1014: $currentstring .= $token->[4];
1015: } elsif ($target eq 'tex') {
1016: $currentstring .= "\$_{ ";
1017: }
1018: return $currentstring;
1019: }
1020: sub end_sub {
1021: my ($target,$token) = @_;
1022: my $currentstring = '';
1023: if ($target eq 'web') {
1024: $currentstring .= $token->[2];
1025: } elsif ($target eq 'tex') {
1026: $currentstring .= " }\$";
1027: }
1028: return $currentstring;
1029: }
1030: #-- <sup> tag
1031: sub start_sup {
1032: my ($target,$token) = @_;
1033: my $currentstring = '';
1034: if ($target eq 'web') {
1035: $currentstring .= $token->[4];
1036: } elsif ($target eq 'tex') {
1037: $currentstring .= "\$^{ ";
1038: }
1039: return $currentstring;
1040: }
1041: sub end_sup {
1042: my ($target,$token) = @_;
1043: my $currentstring = '';
1044: if ($target eq 'web') {
1045: $currentstring .= $token->[2];
1046: } elsif ($target eq 'tex') {
1047: $currentstring .= " }\$";
1048: }
1049: return $currentstring;
1050: }
1051: #-- <hr> tag
1052: sub start_hr {
1053: my ($target,$token) = @_;
1054: my $currentstring = '';
1055: if ($target eq 'web') {
1056: $currentstring .= $token->[4];
1057: } elsif ($target eq 'tex') {
1058: $currentstring .= '\vskip 0 mm \noindent\makebox[\textwidth/2 ][b]{\hrulefill}\vskip 0 mm ';
1059: }
1060: return $currentstring;
1061: }
1062: sub end_hr {
1063: my ($target,$token) = @_;
1064: my $currentstring = '';
1065: if ($target eq 'web') {
1066: $currentstring .= $token->[2];
1067: } elsif ($target eq 'tex') {
1068: }
1069: return $currentstring;
1070: }
1071: #-- <div> tag
1072: sub start_div {
1073: my ($target,$token) = @_;
1074: my $currentstring = '';
1075: if ($target eq 'web') {
1076: $currentstring .= $token->[4];
1077: }
1078: return $currentstring;
1079: }
1080: sub end_div {
1081: my ($target,$token) = @_;
1082: my $currentstring = '';
1083: if ($target eq 'web') {
1084: $currentstring .= $token->[2];
1085: }
1086: return $currentstring;
1087: }
1088: #-- <a> tag
1089: sub start_a {
1090: my ($target,$token) = @_;
1091: my $currentstring = '';
1092: if ($target eq 'web') {
1093: $currentstring .= $token->[4];
1094: } elsif ($target eq 'tex') {
1095: }
1096: return $currentstring;
1097: }
1098: sub end_a {
1099: my ($target,$token,$tagstack,$stackref) = @_;
1100: my $currentstring = '';
1101: if ($target eq 'web') {
1102: $currentstring .= $token->[2];
1103: } elsif ($target eq 'tex') {
1104: my $tempor_var = $stackref->[$#$stackref];
1105: if (index($tempor_var,'name') != -1 ) {
1106: $tempor_var =~ s/name=([^,]*),/$1/g;
1107: } elsif (index($tempor_var,'href') != -1 ) {
1108: $tempor_var =~ s/href=([^,]*),/$1/g;
1109: $currentstring .= " \\ref{$tempor_var}";
1110: }
1111: }
1112: return $currentstring;
1113: }
1114: #-- <li> tag
1115: sub start_li {
1116: my ($target,$token,$tagstack,$stackref) = @_;
1117: my $currentstring = '';
1118: if ($target eq 'web') {
1119: $currentstring = $token->[4];
1120: } elsif ($target eq 'tex') {
1121: my $tempor_var = $stackref->[$#$stackref];
1122: if (index($tempor_var,'circle') != -1 ) {
1123: $currentstring .= " \\item[o] ";
1124: } elsif (index($tempor_var,'square') != -1 ) {
1125: $currentstring .= " \\item[$\Box$] ";
1126: } elsif ($tempor_var ne '') {
1127: $_ = $tempor_var;
1128: m/my\s*([^=]*)=/;
1129: $currentstring .= " \\item[$1] ";
1130: } else {
1131: $currentstring .= " \\item ";
1132: }
1133: }
1134: return $currentstring;
1135: }
1136: sub end_li {
1137: my ($target,$token) = @_;
1138: my $currentstring = '';
1139: if ($target eq 'web') {
1140: $currentstring = $token->[2];
1141: }
1142: return $currentstring;
1143: }
1144: #-- <u> tag
1145: sub start_u {
1146: my ($target,$token) = @_;
1147: my $currentstring = '';
1148: if ($target eq 'web') {
1149: $currentstring .= $token->[4];
1150: } elsif ($target eq 'tex') {
1151: &Apache::lonxml::startredirection();
1152: }
1153: return $currentstring;
1154: }
1155: sub end_u {
1156: my ($target,$token) = @_;
1157: my $currentstring = '';
1158: if ($target eq 'web') {
1159: $currentstring .= $token->[2];
1160: } elsif ($target eq 'tex') {
1161: $currentstring=&Apache::lonxml::endredirection();
1162: $currentstring=~s/(\S)(\s+)(\S)/$1}$2\\underline{$3/g;
1163: $currentstring=~s/^\s*(\S)/\\underline{$1/;
1164: $currentstring=~s/(\S)\s*$/$1}/;
1165: }
1166: return $currentstring;
1167: }
1168: #-- <ul> tag
1169: sub start_ul {
1170: my ($target,$token) = @_;
1171: my $currentstring = '';
1172: if ($target eq 'web') {
1173: $currentstring = $token->[4];
1174: } elsif ($target eq 'tex') {
1175: $currentstring = '\begin{itemize}';
1176: }
1177: return $currentstring;
1178: }
1179: sub end_ul {
1180: my ($target,$token) = @_;
1181: my $currentstring = '';
1182: if ($target eq 'web') {
1183: $currentstring = $token->[2];
1184: } elsif ($target eq 'tex') {
1185: $currentstring = '\end{itemize}';
1186: }
1187: return $currentstring;
1188: }
1189: #-- <menu> tag
1190: sub start_menu {
1191: my ($target,$token) = @_;
1192: my $currentstring = '';
1193: if ($target eq 'web') {
1194: $currentstring = $token->[4];
1195: } elsif ($target eq 'tex') {
1196: $currentstring = " \\begin{itemize} ";
1197: }
1198: return $currentstring;
1199: }
1200: sub end_menu {
1201: my ($target,$token) = @_;
1202: my $currentstring = '';
1203: if ($target eq 'web') {
1204: $currentstring = $token->[2];
1205: } elsif ($target eq 'tex') {
1206: $currentstring = " \\end{itemize}";
1207: }
1208: return $currentstring;
1209: }
1210: #-- <dir> tag
1211: sub start_dir {
1212: my ($target,$token) = @_;
1213: my $currentstring = '';
1214: if ($target eq 'web') {
1215: $currentstring = $token->[4];
1216: } elsif ($target eq 'tex') {
1217: $currentstring = " \\begin{itemize} ";
1218: }
1219: return $currentstring;
1220: }
1221: sub end_dir {
1222: my ($target,$token) = @_;
1223: my $currentstring = '';
1224: if ($target eq 'web') {
1225: $currentstring = $token->[2];
1226: } elsif ($target eq 'tex') {
1227: $currentstring = " \\end{itemize}";
1228: }
1229: return $currentstring;
1230: }
1231: #-- <ol> tag
1232: sub start_ol {
1233: my ($target,$token) = @_;
1234: my $currentstring = '';
1235: if ($target eq 'web') {
1236: $currentstring = $token->[4];
1237: } elsif ($target eq 'tex') {
1238: $currentstring = '\begin{enumerate}';
1239: }
1240: return $currentstring;
1241: }
1242: sub end_ol {
1243: my ($target,$token) = @_;
1244: my $currentstring = '';
1245: if ($target eq 'web') {
1246: $currentstring = $token->[2];
1247: } elsif ($target eq 'tex') {
1248: $currentstring = '\end{enumerate}';
1249: }
1250: return $currentstring;
1251: }
1252: #-- <dl> tag
1253: sub start_dl {
1254: my ($target,$token) = @_;
1255: my $currentstring = '';
1256: if ($target eq 'web') {
1257: $currentstring = $token->[4];
1258: } elsif ($target eq 'tex') {
1259: $currentstring = '\begin{description}';
1260: }
1261: return $currentstring;
1262: }
1263: sub end_dl {
1264: my ($target,$token) = @_;
1265: my $currentstring = '';
1266: if ($target eq 'web') {
1267: $currentstring = $token->[2];
1268: } elsif ($target eq 'tex') {
1269: $currentstring = '\end{description}';
1270: }
1271: return $currentstring;
1272: }
1273: #-- <dt> tag
1274: sub start_dt {
1275: my ($target,$token) = @_;
1276: my $currentstring = '';
1277: if ($target eq 'web') {
1278: $currentstring = $token->[4];
1279: } elsif ($target eq 'tex') {
1280: $currentstring = '\item[';
1281: }
1282: return $currentstring;
1283: }
1284: sub end_dt {
1285: my ($target,$token) = @_;
1286: my $currentstring = '';
1287: if ($target eq 'web') {
1288: $currentstring = $token->[2];
1289: } elsif ($target eq 'tex') {
1290: $currentstring = ']';
1291: }
1292: return $currentstring;
1293: }
1294: #-- <dd> tag
1295: sub start_dd {
1296: my ($target,$token) = @_;
1297: my $currentstring = '';
1298: if ($target eq 'web') {
1299: $currentstring = $token->[4];
1300: }
1301: return $currentstring;
1302: }
1303: sub end_dd {
1304: my ($target,$token) = @_;
1305: my $currentstring = '';
1306: if ($target eq 'web') {
1307: $currentstring = $token->[2];
1308: }
1309: return $currentstring;
1310: }
1311: #-- <table> tag
1312: sub start_table {
1313: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1314: my $currentstring = '';
1315: if ($target eq 'web') {
1316: $currentstring = $token->[4];
1317: } elsif ($target eq 'tex') {
1318: my $aa = {};
1319: push @Apache::londefdef::table, $aa;
1320: $Apache::londefdef::table[-1]{'row_number'} = -1;
1321: $Apache::londefdef::table[-1]{'output'} = ' \noindent \begin{tabular} ';
1322: my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval,undef,1);
1323: unless (defined $border) { $border = 0; }
1324: if ($border) {
1325: $Apache::londefdef::table[-1]{'hinc'} = '\hline ';
1326: $Apache::londefdef::table[-1]{'vinc'} = '&';
1327: $Apache::londefdef::table[-1]{'vvinc'} = '|';
1328: } else {
1329: $Apache::londefdef::table[-1]{'hinc'} = '';
1330: $Apache::londefdef::table[-1]{'vinc'} = '&';
1331: $Apache::londefdef::table[-1]{'vvinc'} = '';
1332: }
1333: my $width;
1334: foreach my $key (keys(%{$token->[2]})) {
1335: if ($key =~ /^width$/i) {
1336: $width = &Apache::lonxml::get_param($key,$parstack,$safeeval,undef,1);
1337: }
1338: }
1339: if (defined($width)) { $Apache::londefdef::table[-1]{'width'}=$width; }
1340: }
1341: return $currentstring;
1342: }
1343: sub end_table {
1344: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1345: my $currentstring = '';
1346: if ($target eq 'web') {
1347: $currentstring = $token->[2];
1348: } elsif ($target eq 'tex') {
1349: my $inmemory = '';
1350: my $output = '';
1351: #construct header of the table
1352: my $header_of_table = '{'.$Apache::londefdef::table[-1]{'vvinc'};
1353: my $in;
1354: for ($in=0;$in<=$Apache::londefdef::table[-1]{'counter_columns'};$in++) {
1355: $header_of_table .= $Apache::londefdef::table[-1]{'columns'}[$in].$Apache::londefdef::table[-1]{'vvinc'};
1356: }
1357: $header_of_table .= '}';
1358: #fill the table
1359: for ($in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) {
1360: $output .= $Apache::londefdef::table[-1]{'rowdata'}[$in];
1361: chop $output;
1362: $output .= ' \\\\ ';
1363: }
1364: #define the length of the table cells
1365: my @lengthforoutput = split(/,/,$Apache::londefdef::table[-1]{'lengthrow'}[0]);
1366: my $how_many_columns = $#lengthforoutput + 1; #total number of columns in the table
1367: my $filled_columns = 0; #number of columns with information about width
1368: my $available_space = ' ';
1369: foreach my $tempo_length (@{ $Apache::londefdef::table[-1]{'lengthrow'} }) {
1370: my @length = split(/,/,$tempo_length);
1371: for (my $ico=0;$ico<=$#lengthforoutput;$ico++) {
1372: $lengthforoutput[$ico] =~ m/(\d*\.?\d*)\s*(\w+)/;
1373: my $old_value = $1;
1374: my $old_unit = $2;
1375: if ($old_unit eq 'cm') {
1376: $old_value = $old_value * 10;
1377: } elsif ($old_unit eq 'in') {
1378: $old_value = $old_value * 25.4;
1379: } elsif ($old_unit eq 'pt') {
1380: $old_value = $old_value * 25.4/72.27;
1381: } elsif ($old_unit eq 'pc') {
1382: $old_value = $old_value * 25.4/6.022;
1383: }
1384: $old_unit = 'mm';
1385: $length[$ico] =~ m/(\d*\.?\d*)\s*(\w+)/;
1386: my $new_value = $1;
1387: my $new_unit = $2;
1388: if ($new_unit eq 'cm') {
1389: $new_value = $new_value * 10;
1390: } elsif ($old_unit eq 'in') {
1391: $new_value = $new_value * 25.4;
1392: } elsif ($old_unit eq 'pt') {
1393: $new_value = $new_value * 25.4/72.27;
1394: } elsif ($old_unit eq 'pc') {
1395: $new_value = $new_value * 25.4/6.022;
1396: }
1397: $new_unit = 'mm';
1398: if ($old_value < $new_value) {
1399: $lengthforoutput[$ico] = $new_value.' mm';
1400: } else {
1401: $lengthforoutput[$ico] = $old_value.' mm';
1402: }
1403: }
1404: }
1405: for (my $ico=0;$ico<=$#lengthforoutput;$ico++) {
1406: if (not $lengthforoutput[$ico]=~m/^\s*0\s*\w*\s*$/) {
1407: $filled_columns++;
1408: $available_space = $available_space.' - '.$lengthforoutput[$ico];
1409: }
1410: }
1411: my $temp_file;
1412: my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.tbl";
1413: if (-e $filename) {
1414: $temp_file = Apache::File->new($filename);
1415: my @tbl_file_content = <$temp_file>;
1416: my ($one,$two,$three) = split(/,/,$tbl_file_content[0]);
1417: $how_many_columns+=$one-1;
1418: $filled_columns+=$two;
1419: if($three=~/\S/) {$available_space = $available_space.' - '.$three;}
1420: } else {
1421: $temp_file = Apache::File->new('>>'.$filename);
1422: }
1423: print $temp_file "$how_many_columns,$filled_columns,$available_space\n";
1424: $output =~ s/\\parbox{TOBECHANGEDONNUMBER}{}/\\parbox{1 mm}{}/g;
1425: $output =~ s/\\parbox{TOBECHANGEDONNUMBER}/\\parbox{\$SpacePerColumn}/g;
1426: my @tagar = @$tagstack;
1427: my $signature = 1;
1428: for (my $ico=0;$ico<$#tagar;$ico++) {
1429: if ($tagar[$ico] eq 'table') { $signature = 0; }
1430: }
1431: if ($signature) {
1432: my $NumberEmptyLength = $how_many_columns - $filled_columns;
1433: my $SpacePerColumn = '(\textwidth '.$available_space.')/'.$NumberEmptyLength;
1434: my $shorthand = ($filled_columns+1)*4;
1435: $output =~ s/\$SpacePerColumn/$SpacePerColumn - $shorthand mm/g;
1436: }
1437: if ($how_many_columns==1) { #start of block with width correction for one column table
1438: $output=~s/^\s*\\parbox{([^}]*)}/\\parbox{\\textwidth - 1 cm}/;
1439: } #end of block with width correction for one column table
1440: $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$output.$Apache::londefdef::table[-1]{'hinc'}.'\end{tabular}\vskip 0 mm ';
1441: if ($#Apache::londefdef::table > 0) {
1442: $inmemory = $Apache::londefdef::table[-1]{'output'};
1443: pop @Apache::londefdef::table;
1444: $Apache::londefdef::table[-1]{'rowdata'}[$Apache::londefdef::table[-1]{'row_number'}] .= $inmemory
1445: } else {
1446: $currentstring = $Apache::londefdef::table[-1]{'output'};
1447: $currentstring =~ s/\\\\\s+\\\\/\\\\/g;
1448: pop @Apache::londefdef::table;
1449: if (-e $filename) {
1450: unlink $filename;
1451: }
1452: }
1453: }
1454: return $currentstring;
1455: }
1456: #-- <tr> tag
1457: sub start_tr {
1458: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1459: my $currentstring = '';
1460: if ($target eq 'web') {
1461: $currentstring = $token->[4];
1462: } elsif ($target eq 'tex') {
1463: $Apache::londefdef::table[-1]{'row_number'}++;
1464: my $alignchar = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);
1465: if ($alignchar ne '') {
1466: push @ {$Apache::londefdef::table[-1]{'rows'} }, $alignchar;
1467: } else {
1468: push @ {$Apache::londefdef::table[-1]{'rows'} }, 'l';
1469: }
1470: push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'});
1471: $Apache::londefdef::table[-1]{'counter_columns'} = -1;
1472: $Apache::londefdef::table[-1]{'length'} = '';
1473: }
1474: return $currentstring;
1475: }
1476: sub end_tr {
1477: my ($target,$token) = @_;
1478: my $currentstring = '';
1479: if ($target eq 'web') {
1480: $currentstring = $token->[2];
1481: } elsif ($target eq 'tex') {
1482: push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'};
1483:
1484: }
1485: return $currentstring;
1486: }
1487: #-- <td> tag
1488: sub start_td {
1489: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1490: my $currentstring = '';
1491: if ($target eq 'web') {
1492: $currentstring = $token->[4];
1493: } elsif ($target eq 'tex') {
1494: my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);
1495: if ($what_to_push eq '') {
1496: $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);;
1497: }
1498: push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;
1499: $Apache::londefdef::table[-1]{'counter_columns'}++;
1500: &Apache::lonxml::startredirection();
1501: }
1502: return $currentstring;
1503: }
1504: sub end_td {
1505: my ($target,$token) = @_;
1506: my $currentstring = '';
1507: my $tempolen = '';
1508: if ($target eq 'web') {
1509: $currentstring = $token->[2];
1510: } elsif ($target eq 'tex') {
1511: my $current_row = $Apache::londefdef::table[-1]{'row_number'};
1512: my $data=&Apache::lonxml::endredirection();
1513: if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt))/) {
1514: $Apache::londefdef::table[-1]{'length'} .= $1.',';
1515: $tempolen = $1;
1516: } else {
1517: if (length($data)<5) {
1518: $Apache::londefdef::table[-1]{'length'} .= '0 mm,';
1519: $tempolen = '6 mm';
1520: } else {
1521: $Apache::londefdef::table[-1]{'length'} .= '0 mm,';
1522: $tempolen = 'TOBECHANGEDONNUMBER';
1523: }
1524: }
1525: @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$tempolen.'}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
1526: }
1527: return $currentstring;
1528: }
1529: #-- <th> tag
1530: sub start_th {
1531: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1532: my $currentstring = '';
1533: if ($target eq 'web') {
1534: $currentstring = $token->[4];
1535: } elsif ($target eq 'tex') {
1536: my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);
1537: if ($what_to_push eq '') {
1538: $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);;
1539: }
1540: push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;
1541: $Apache::londefdef::table[-1]{'counter_columns'}++;
1542: &Apache::lonxml::startredirection();
1543: ;
1544: }
1545: return $currentstring;
1546: }
1547: sub end_th {
1548: my ($target,$token) = @_;
1549: my $currentstring = '';
1550: if ($target eq 'web') {
1551: $currentstring = $token->[2];
1552: } elsif ($target eq 'tex') {
1553: my $current_row = $Apache::londefdef::table[-1]{'row_number'};
1554: my $data=&Apache::lonxml::endredirection();
1555: if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) {
1556: $Apache::londefdef::table[-1]{'length'} .= $1.',';
1557: } else {
1558: $Apache::londefdef::table[-1]{'length'} .= '0 mm,';
1559: }
1560: @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{\textbf{'.$data.'}} '.$Apache::londefdef::table[-1]{'vinc'};
1561: }
1562: return $currentstring;
1563: }
1564: #-- <img> tag
1565: sub start_img {
1566: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1567: my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,
1568: undef,1);
1569: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src;
1570: my $currentstring = '';
1571: my $width_param = '';
1572: my $height_param = '';
1573: my $scaling = .3;
1574:
1575: if ($target eq 'web') {
1576: $currentstring = $token->[4];
1577: } elsif ($target eq 'tex') {
1578: &image_replication($src);
1579: $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
1580: #if original gif/jpg/png file exist do following:
1581: if (-e $src) {
1582: #defines the default size of image
1583: my $image = Image::Magick->new;
1584: my $current_figure = $image->Read($src);
1585: $width_param = $image->Get('width') * $scaling;;
1586: $height_param = $image->Get('height') * $scaling;;
1587: undef $image;
1588: #do we have any specified size of the picture?
1589: my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval);
1590: my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval);
1591: my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval,
1592: undef,1);
1593: if ($TeXwidth ne '') {
1594: if ($TeXwidth=~/(\d+)\s*\%/) {
1595: $width_param = $1*$ENV{'form.textwidth'}/100;
1596: } else {
1597: $width_param = $TeXwidth;
1598: }
1599: } elsif ($TeXheight ne '') {
1600: $width_param = $TeXheight/$height_param*$width_param;
1601: } elsif ($width ne '') {
1602: $width_param = $width*$scaling;
1603: }
1604: my $file;
1605: my $path;
1606: if ($src =~ m!(.*)/([^/]*)$!) {
1607: $file = $2;
1608: $path = $1.'/';
1609: }
1610: my $newsrc = $src;
1611: $newsrc =~ s/\.(gif|jpg|png)$/.eps/i;
1612: $file=~s/\.(gif|jpg|png)$/.eps/i;
1613: #where can we find the picture?
1614: if (-e $newsrc) {
1615: #eps counterpart for image exist
1616: if ($path) {
1617: $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1618: }
1619: } else {
1620: #there is no eps counterpart for image - check for ps one
1621: $newsrc =~ s/\.eps$/\.ps/;
1622: if (-e $newsrc) {
1623: #ps counterpart for image exist
1624: $file =~ s/\.eps$/\.ps/;
1625: if ($path) {
1626: $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1627: }
1628: } else {
1629: #there aren't eps or ps - so create eps
1630: my $temp_file;
1631: my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
1632: $temp_file = Apache::File->new('>>'.$filename);
1633: print $temp_file "$src\n";
1634: $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool/}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1635: }
1636: }
1637: } else {
1638: #original image file doesn't exist so check the alt attribute
1639: my $alt = &Apache::lonxml::get_param('alt',$parstack,$safeeval,undef,1);
1640: if ($alt) {
1641: $currentstring .= ' '.$alt.' ';
1642: } else {
1643: #<allow> tag will care about replication
1644: }
1645: }
1646: }
1647: return $currentstring;
1648: }
1649: sub end_img {
1650: my ($target,$token) = @_;
1651: my $currentstring = '';
1652: if ($target eq 'web') {
1653: $currentstring = $token->[2];
1654: } elsif ($target eq 'tex') {
1655: $currentstring = '';
1656: }
1657: return $currentstring;
1658: }
1659: #-- <applet> tag
1660:
1661: sub start_applet {
1662: my ($target,$token) = @_;
1663: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1664: $token->[2]->{'code'};
1665: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1666: $token->[2]->{'archive'};
1667: my $currentstring = '';
1668: if ($target eq 'web') {
1669: $currentstring = $token->[4];
1670: } elsif ($target eq 'tex') {
1671: $currentstring = " \\begin{figure} ";
1672: }
1673: return $currentstring;
1674: }
1675: sub end_applet {
1676: my ($target,$token) = @_;
1677: my $currentstring = '';
1678: if ($target eq 'web') {
1679: $currentstring = $token->[2];
1680: } elsif ($target eq 'tex') {
1681: $currentstring = " \\end{figure}";
1682: }
1683: return $currentstring;
1684: }
1685:
1686: #-- <embed> tag
1687:
1688: sub start_embed {
1689: my ($target,$token) = @_;
1690: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1691: $token->[2]->{'src'};
1692: my $currentstring = '';
1693: if ($target eq 'web') {
1694: $currentstring = $token->[4];
1695: } elsif ($target eq 'tex') {
1696: $currentstring = " \\begin{figure} ";
1697: }
1698: return $currentstring;
1699: }
1700: sub end_embed {
1701: my ($target,$token) = @_;
1702: my $currentstring = '';
1703: if ($target eq 'web') {
1704: $currentstring = $token->[2];
1705: } elsif ($target eq 'tex') {
1706: $currentstring = " \\end{figure}";
1707: }
1708: return $currentstring;
1709: }
1710:
1711: #-- <param> tag
1712:
1713: sub start_param {
1714: my ($target,$token) = @_;
1715: if ($token->[2]->{'name'} eq 'cabbase') {
1716: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1717: $token->[2]->{'value'};
1718: }
1719: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1720: $token->[2]->{'src'};
1721: my $currentstring = '';
1722: if ($target eq 'web') {
1723: $currentstring = $token->[4];
1724: } elsif ($target eq 'tex') {
1725: $currentstring = " \\begin{figure} ";
1726: }
1727: return $currentstring;
1728: }
1729: sub end_param {
1730: my ($target,$token) = @_;
1731: my $currentstring = '';
1732: if ($target eq 'web') {
1733: $currentstring = $token->[2];
1734: } elsif ($target eq 'tex') {
1735: $currentstring = " \\end{figure}";
1736: }
1737: return $currentstring;
1738: }
1739: #-- <allow> tag
1740: sub start_allow {
1741: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1742: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1743: $token->[2]->{'src'};
1744: my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
1745: &image_replication($src);
1746: my $result;
1747: if ($target eq 'edit') {
1748: $result .=&Apache::edit::tag_start($target,$token);
1749: $result .=&Apache::edit::text_arg('File Spec:','src',$token,70);
1750: $result .=&Apache::edit::end_row();#.&Apache::edit::start_spanning_row();
1751: } elsif ($target eq 'modified') {
1752: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1753: $safeeval,'src');
1754: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1755: }
1756: return $result;
1757: }
1758:
1759: sub end_allow {
1760: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1761: if ( $target eq 'edit') { return (&Apache::edit::end_table()); }
1762: return '';
1763: }
1764: #-- Frames
1765: sub start_frameset {
1766: my ($target,$token) = @_;
1767: my $currentstring = '';
1768: if ($target eq 'web') {
1769: if (!$Apache::lonxml::registered) {
1770: $currentstring.='<head>'.
1771: &Apache::lonxml::registerurl(undef,$target).'</head>';
1772: }
1773: $currentstring .= $token->[4];
1774: }
1775: return $currentstring;
1776: }
1777: sub end_frameset {
1778: my ($target,$token) = @_;
1779: my $currentstring = '';
1780: if ($target eq 'web') {
1781: $currentstring = $token->[2];
1782: }
1783: return $currentstring;
1784: }
1785: #-- <pre>
1786: sub start_pre {
1787: my ($target,$token) = @_;
1788: my $currentstring = '';
1789: if ($target eq 'web') {
1790: $currentstring .= $token->[4];
1791: } elsif ($target eq 'tex') {
1792: $currentstring .= '\begin{verbatim}';
1793: }
1794: return $currentstring;
1795: }
1796: sub end_pre {
1797: my ($target,$token) = @_;
1798: my $currentstring = '';
1799: if ($target eq 'web') {
1800: $currentstring .= $token->[2];
1801: } elsif ($target eq 'tex') {
1802: $currentstring .= '\end{verbatim}';
1803: }
1804: return $currentstring;
1805: }
1806: #-- <insert>
1807: sub start_insert {
1808: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1809: my $currentstring = '';
1810: if ($target eq 'web') {
1811: my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
1812: $currentstring .= '<b>'.$display.'</b>';;
1813: }
1814: return $currentstring;
1815: }
1816: sub end_insert {
1817: my ($target,$token) = @_;
1818: my $currentstring = '';
1819: if ($target eq 'web') {
1820: $currentstring .= '';
1821: }
1822: return $currentstring;
1823: }
1824: #-- <externallink>
1825: sub start_externallink {
1826: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1827: my $currentstring = '';
1828: if ($target eq 'web') {
1829: my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
1830: $currentstring .= '<b>'.$display.'</b>';;
1831: }
1832: return $currentstring;
1833: }
1834: sub end_externallink {
1835: my ($target,$token) = @_;
1836: my $currentstring = '';
1837: if ($target eq 'web') {
1838: $currentstring .= '';
1839: }
1840: return $currentstring;
1841: }
1842: #-- <blankspace heigth="">
1843: sub start_blankspace {
1844: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1845: my $currentstring = '';
1846: if ($target eq 'tex') {
1847: my $howmuch = &Apache::lonxml::get_param('heigth',$parstack,$safeeval,undef,1);
1848: $currentstring .= '\vskip '.$howmuch.' ';
1849: }
1850: return $currentstring;
1851: }
1852: sub end_blankspace {
1853: my ($target,$token) = @_;
1854: my $currentstring = '';
1855: if ($target eq 'tex') {
1856: $currentstring .= '';
1857: }
1858: return $currentstring;
1859: }
1860: #-- <abbr> tag
1861: sub start_abbr {
1862: my ($target,$token) = @_;
1863: my $currentstring = '';
1864: if ($target eq 'web') {
1865: $currentstring = $token->[4];
1866: }
1867: return $currentstring;
1868: }
1869: sub end_abbr {
1870: my ($target,$token) = @_;
1871: my $currentstring = '';
1872: if ($target eq 'web') {
1873: $currentstring = $token->[2];
1874: }
1875: return $currentstring;
1876: }
1877: #-- <acronym> tag
1878: sub start_acronym {
1879: my ($target,$token) = @_;
1880: my $currentstring = '';
1881: if ($target eq 'web') {
1882: $currentstring = $token->[4];
1883: }
1884: return $currentstring;
1885: }
1886: sub end_acronym {
1887: my ($target,$token) = @_;
1888: my $currentstring = '';
1889: if ($target eq 'web') {
1890: $currentstring = $token->[2];
1891: }
1892: return $currentstring;
1893: }
1894: #-- <area> tag
1895: sub start_area {
1896: my ($target,$token) = @_;
1897: my $currentstring = '';
1898: if ($target eq 'web') {
1899: $currentstring = $token->[4];
1900: }
1901: return $currentstring;
1902: }
1903: sub end_area {
1904: my ($target,$token) = @_;
1905: my $currentstring = '';
1906: if ($target eq 'web') {
1907: $currentstring = $token->[2];
1908: }
1909: return $currentstring;
1910: }
1911: #-- <base> tag
1912: sub start_base {
1913: my ($target,$token) = @_;
1914: my $currentstring = '';
1915: if ($target eq 'web') {
1916: $currentstring = $token->[4];
1917: }
1918: return $currentstring;
1919: }
1920: sub end_base {
1921: my ($target,$token) = @_;
1922: my $currentstring = '';
1923: if ($target eq 'web') {
1924: $currentstring = $token->[2];
1925: }
1926: return $currentstring;
1927: }
1928: #-- <bdo> tag
1929: sub start_bdo {
1930: my ($target,$token) = @_;
1931: my $currentstring = '';
1932: if ($target eq 'web') {
1933: $currentstring = $token->[4];
1934: }
1935: return $currentstring;
1936: }
1937: sub end_bdo {
1938: my ($target,$token) = @_;
1939: my $currentstring = '';
1940: if ($target eq 'web') {
1941: $currentstring = $token->[2];
1942: }
1943: return $currentstring;
1944: }
1945: #-- <bgsound> tag
1946: sub start_bgsound {
1947: my ($target,$token) = @_;
1948: my $currentstring = '';
1949: if ($target eq 'web') {
1950: $currentstring = $token->[4];
1951: }
1952: return $currentstring;
1953: }
1954: sub end_bgsound {
1955: my ($target,$token) = @_;
1956: my $currentstring = '';
1957: if ($target eq 'web') {
1958: $currentstring = $token->[2];
1959: }
1960: return $currentstring;
1961: }
1962: #-- <blink> tag
1963: sub start_blink {
1964: my ($target,$token) = @_;
1965: my $currentstring = '';
1966: if ($target eq 'web') {
1967: $currentstring = $token->[4];
1968: }
1969: return $currentstring;
1970: }
1971: sub end_blink {
1972: my ($target,$token) = @_;
1973: my $currentstring = '';
1974: if ($target eq 'web') {
1975: $currentstring = $token->[2];
1976: }
1977: return $currentstring;
1978: }
1979: #-- <blockquote> tag
1980: sub start_blockquote {
1981: my ($target,$token) = @_;
1982: my $currentstring = '';
1983: if ($target eq 'web') {
1984: $currentstring = $token->[4];
1985: }
1986: return $currentstring;
1987: }
1988: sub end_blockquote {
1989: my ($target,$token) = @_;
1990: my $currentstring = '';
1991: if ($target eq 'web') {
1992: $currentstring = $token->[2];
1993: }
1994: return $currentstring;
1995: }
1996: #-- <button> tag
1997: sub start_button {
1998: my ($target,$token) = @_;
1999: my $currentstring = '';
2000: if ($target eq 'web') {
2001: $currentstring = $token->[4];
2002: }
2003: return $currentstring;
2004: }
2005: sub end_button {
2006: my ($target,$token) = @_;
2007: my $currentstring = '';
2008: if ($target eq 'web') {
2009: $currentstring = $token->[2];
2010: }
2011: return $currentstring;
2012: }
2013: #-- <caption> tag
2014: sub start_caption {
2015: my ($target,$token) = @_;
2016: my $currentstring = '';
2017: if ($target eq 'web') {
2018: $currentstring = $token->[4];
2019: }
2020: return $currentstring;
2021: }
2022: sub end_caption {
2023: my ($target,$token) = @_;
2024: my $currentstring = '';
2025: if ($target eq 'web') {
2026: $currentstring = $token->[2];
2027: }
2028: return $currentstring;
2029: }
2030: #-- <col> tag
2031: sub start_col {
2032: my ($target,$token) = @_;
2033: my $currentstring = '';
2034: if ($target eq 'web') {
2035: $currentstring = $token->[4];
2036: }
2037: return $currentstring;
2038: }
2039: sub end_col {
2040: my ($target,$token) = @_;
2041: my $currentstring = '';
2042: if ($target eq 'web') {
2043: $currentstring = $token->[2];
2044: }
2045: return $currentstring;
2046: }
2047: #-- <colgroup> tag
2048: sub start_colgroup {
2049: my ($target,$token) = @_;
2050: my $currentstring = '';
2051: if ($target eq 'web') {
2052: $currentstring = $token->[4];
2053: }
2054: return $currentstring;
2055: }
2056: sub end_colgroup {
2057: my ($target,$token) = @_;
2058: my $currentstring = '';
2059: if ($target eq 'web') {
2060: $currentstring = $token->[2];
2061: }
2062: return $currentstring;
2063: }
2064: #-- <del> tag
2065: sub start_del {
2066: my ($target,$token) = @_;
2067: my $currentstring = '';
2068: if ($target eq 'web') {
2069: $currentstring = $token->[4];
2070: }
2071: return $currentstring;
2072: }
2073: sub end_del {
2074: my ($target,$token) = @_;
2075: my $currentstring = '';
2076: if ($target eq 'web') {
2077: $currentstring = $token->[2];
2078: }
2079: return $currentstring;
2080: }
2081: #-- <fieldset> tag
2082: sub start_fieldset {
2083: my ($target,$token) = @_;
2084: my $currentstring = '';
2085: if ($target eq 'web') {
2086: $currentstring = $token->[4];
2087: }
2088: return $currentstring;
2089: }
2090: sub end_fieldset {
2091: my ($target,$token) = @_;
2092: my $currentstring = '';
2093: if ($target eq 'web') {
2094: $currentstring = $token->[2];
2095: }
2096: return $currentstring;
2097: }
2098: #-- <frame> tag
2099: sub start_frame {
2100: my ($target,$token) = @_;
2101: my $currentstring = '';
2102: if ($target eq 'web') {
2103: $currentstring = $token->[4];
2104: }
2105: return $currentstring;
2106: }
2107: sub end_frame {
2108: my ($target,$token) = @_;
2109: my $currentstring = '';
2110: if ($target eq 'web') {
2111: $currentstring = $token->[2];
2112: }
2113: return $currentstring;
2114: }
2115: #-- <iframe> tag
2116: sub start_iframe {
2117: my ($target,$token) = @_;
2118: my $currentstring = '';
2119: if ($target eq 'web') {
2120: $currentstring = $token->[4];
2121: }
2122: return $currentstring;
2123: }
2124: sub end_iframe {
2125: my ($target,$token) = @_;
2126: my $currentstring = '';
2127: if ($target eq 'web') {
2128: $currentstring = $token->[2];
2129: }
2130: return $currentstring;
2131: }
2132: #-- <ins> tag
2133: sub start_ins {
2134: my ($target,$token) = @_;
2135: my $currentstring = '';
2136: if ($target eq 'web') {
2137: $currentstring = $token->[4];
2138: }
2139: return $currentstring;
2140: }
2141: sub end_ins {
2142: my ($target,$token) = @_;
2143: my $currentstring = '';
2144: if ($target eq 'web') {
2145: $currentstring = $token->[2];
2146: }
2147: return $currentstring;
2148: }
2149: #-- <isindex> tag
2150: sub start_isindex {
2151: my ($target,$token) = @_;
2152: my $currentstring = '';
2153: if ($target eq 'web') {
2154: $currentstring = $token->[4];
2155: }
2156: return $currentstring;
2157: }
2158: sub end_isindex {
2159: my ($target,$token) = @_;
2160: my $currentstring = '';
2161: if ($target eq 'web') {
2162: $currentstring = $token->[2];
2163: }
2164: return $currentstring;
2165: }
2166: #-- <keygen> tag
2167: sub start_keygen {
2168: my ($target,$token) = @_;
2169: my $currentstring = '';
2170: if ($target eq 'web') {
2171: $currentstring = $token->[4];
2172: }
2173: return $currentstring;
2174: }
2175: sub end_keygen {
2176: my ($target,$token) = @_;
2177: my $currentstring = '';
2178: if ($target eq 'web') {
2179: $currentstring = $token->[2];
2180: }
2181: return $currentstring;
2182: }
2183: #-- <label> tag
2184: sub start_label {
2185: my ($target,$token) = @_;
2186: my $currentstring = '';
2187: if ($target eq 'web') {
2188: $currentstring = $token->[4];
2189: }
2190: return $currentstring;
2191: }
2192: sub end_label {
2193: my ($target,$token) = @_;
2194: my $currentstring = '';
2195: if ($target eq 'web') {
2196: $currentstring = $token->[2];
2197: }
2198: return $currentstring;
2199: }
2200: #-- <layer> tag
2201: sub start_layer {
2202: my ($target,$token) = @_;
2203: my $currentstring = '';
2204: if ($target eq 'web') {
2205: $currentstring = $token->[4];
2206: }
2207: return $currentstring;
2208: }
2209: sub end_layer {
2210: my ($target,$token) = @_;
2211: my $currentstring = '';
2212: if ($target eq 'web') {
2213: $currentstring = $token->[2];
2214: }
2215: return $currentstring;
2216: }
2217: #-- <legend> tag
2218: sub start_legend {
2219: my ($target,$token) = @_;
2220: my $currentstring = '';
2221: if ($target eq 'web') {
2222: $currentstring = $token->[4];
2223: }
2224: return $currentstring;
2225: }
2226: sub end_legend {
2227: my ($target,$token) = @_;
2228: my $currentstring = '';
2229: if ($target eq 'web') {
2230: $currentstring = $token->[2];
2231: }
2232: return $currentstring;
2233: }
2234: #-- <link> tag
2235: sub start_link {
2236: my ($target,$token) = @_;
2237: my $currentstring = '';
2238: if ($target eq 'web') {
2239: $currentstring = $token->[4];
2240: }
2241: return $currentstring;
2242: }
2243: sub end_link {
2244: my ($target,$token) = @_;
2245: my $currentstring = '';
2246: if ($target eq 'web') {
2247: $currentstring = $token->[2];
2248: }
2249: return $currentstring;
2250: }
2251: #-- <marquee> tag
2252: sub start_marquee {
2253: my ($target,$token) = @_;
2254: my $currentstring = '';
2255: if ($target eq 'web') {
2256: $currentstring = $token->[4];
2257: }
2258: return $currentstring;
2259: }
2260: sub end_marquee {
2261: my ($target,$token) = @_;
2262: my $currentstring = '';
2263: if ($target eq 'web') {
2264: $currentstring = $token->[2];
2265: }
2266: return $currentstring;
2267: }
2268: #-- <malticol> tag
2269: sub start_malticol {
2270: my ($target,$token) = @_;
2271: my $currentstring = '';
2272: if ($target eq 'web') {
2273: $currentstring = $token->[4];
2274: }
2275: return $currentstring;
2276: }
2277: sub end_malticol {
2278: my ($target,$token) = @_;
2279: my $currentstring = '';
2280: if ($target eq 'web') {
2281: $currentstring = $token->[2];
2282: }
2283: return $currentstring;
2284: }
2285: #-- <nobr> tag
2286: sub start_nobr {
2287: my ($target,$token) = @_;
2288: my $currentstring = '';
2289: if ($target eq 'web') {
2290: $currentstring = $token->[4];
2291: }
2292: return $currentstring;
2293: }
2294: sub end_nobr {
2295: my ($target,$token) = @_;
2296: my $currentstring = '';
2297: if ($target eq 'web') {
2298: $currentstring = $token->[2];
2299: }
2300: return $currentstring;
2301: }
2302: #-- <noembed> tag
2303: sub start_noembed {
2304: my ($target,$token) = @_;
2305: my $currentstring = '';
2306: if ($target eq 'web') {
2307: $currentstring = $token->[4];
2308: }
2309: return $currentstring;
2310: }
2311: sub end_noembed {
2312: my ($target,$token) = @_;
2313: my $currentstring = '';
2314: if ($target eq 'web') {
2315: $currentstring = $token->[2];
2316: }
2317: return $currentstring;
2318: }
2319: #-- <noframes> tag
2320: sub start_noframes {
2321: my ($target,$token) = @_;
2322: my $currentstring = '';
2323: if ($target eq 'web') {
2324: $currentstring = $token->[4];
2325: }
2326: return $currentstring;
2327: }
2328: sub end_noframes {
2329: my ($target,$token) = @_;
2330: my $currentstring = '';
2331: if ($target eq 'web') {
2332: $currentstring = $token->[2];
2333: }
2334: return $currentstring;
2335: }
2336: #-- <nolayer> tag
2337: sub start_nolayer {
2338: my ($target,$token) = @_;
2339: my $currentstring = '';
2340: if ($target eq 'web') {
2341: $currentstring = $token->[4];
2342: }
2343: return $currentstring;
2344: }
2345: sub end_nolayer {
2346: my ($target,$token) = @_;
2347: my $currentstring = '';
2348: if ($target eq 'web') {
2349: $currentstring = $token->[2];
2350: }
2351: return $currentstring;
2352: }
2353: #-- <noscript> tag
2354: sub start_noscript {
2355: my ($target,$token) = @_;
2356: my $currentstring = '';
2357: if ($target eq 'web') {
2358: $currentstring = $token->[4];
2359: }
2360: return $currentstring;
2361: }
2362: sub end_noscript {
2363: my ($target,$token) = @_;
2364: my $currentstring = '';
2365: if ($target eq 'web') {
2366: $currentstring = $token->[2];
2367: }
2368: return $currentstring;
2369: }
2370: #-- <object> tag
2371: sub start_object {
2372: my ($target,$token) = @_;
2373: my $currentstring = '';
2374: if ($target eq 'web') {
2375: $currentstring = $token->[4];
2376: }
2377: return $currentstring;
2378: }
2379: sub end_object {
2380: my ($target,$token) = @_;
2381: my $currentstring = '';
2382: if ($target eq 'web') {
2383: $currentstring = $token->[2];
2384: }
2385: return $currentstring;
2386: }
2387: #-- <optgroup> tag
2388: sub start_optgroup {
2389: my ($target,$token) = @_;
2390: my $currentstring = '';
2391: if ($target eq 'web') {
2392: $currentstring = $token->[4];
2393: }
2394: return $currentstring;
2395: }
2396: sub end_optgroup {
2397: my ($target,$token) = @_;
2398: my $currentstring = '';
2399: if ($target eq 'web') {
2400: $currentstring = $token->[2];
2401: }
2402: return $currentstring;
2403: }
2404: #-- <samp> tag
2405: sub start_samp {
2406: my ($target,$token) = @_;
2407: my $currentstring = '';
2408: if ($target eq 'web') {
2409: $currentstring = $token->[4];
2410: }
2411: return $currentstring;
2412: }
2413: sub end_samp {
2414: my ($target,$token) = @_;
2415: my $currentstring = '';
2416: if ($target eq 'web') {
2417: $currentstring = $token->[2];
2418: }
2419: return $currentstring;
2420: }
2421: #-- <server> tag
2422: sub start_server {
2423: my ($target,$token) = @_;
2424: my $currentstring = '';
2425: if ($target eq 'web') {
2426: $currentstring = $token->[4];
2427: }
2428: return $currentstring;
2429: }
2430: sub end_server {
2431: my ($target,$token) = @_;
2432: my $currentstring = '';
2433: if ($target eq 'web') {
2434: $currentstring = $token->[2];
2435: }
2436: return $currentstring;
2437: }
2438: #-- <spacer> tag
2439: sub start_spacer {
2440: my ($target,$token) = @_;
2441: my $currentstring = '';
2442: if ($target eq 'web') {
2443: $currentstring = $token->[4];
2444: }
2445: return $currentstring;
2446: }
2447: sub end_spacer {
2448: my ($target,$token) = @_;
2449: my $currentstring = '';
2450: if ($target eq 'web') {
2451: $currentstring = $token->[2];
2452: }
2453: return $currentstring;
2454: }
2455: #-- <span> tag
2456: sub start_span {
2457: my ($target,$token) = @_;
2458: my $currentstring = '';
2459: if ($target eq 'web') {
2460: $currentstring = $token->[4];
2461: }
2462: return $currentstring;
2463: }
2464: sub end_span {
2465: my ($target,$token) = @_;
2466: my $currentstring = '';
2467: if ($target eq 'web') {
2468: $currentstring = $token->[2];
2469: }
2470: return $currentstring;
2471: }
2472: #-- <tbody> tag
2473: sub start_tbody {
2474: my ($target,$token) = @_;
2475: my $currentstring = '';
2476: if ($target eq 'web') {
2477: $currentstring = $token->[4];
2478: }
2479: return $currentstring;
2480: }
2481: sub end_tbody {
2482: my ($target,$token) = @_;
2483: my $currentstring = '';
2484: if ($target eq 'web') {
2485: $currentstring = $token->[2];
2486: }
2487: return $currentstring;
2488: }
2489: #-- <tfoot> tag
2490: sub start_tfoot {
2491: my ($target,$token) = @_;
2492: my $currentstring = '';
2493: if ($target eq 'web') {
2494: $currentstring = $token->[4];
2495: }
2496: return $currentstring;
2497: }
2498: sub end_tfoot {
2499: my ($target,$token) = @_;
2500: my $currentstring = '';
2501: if ($target eq 'web') {
2502: $currentstring = $token->[2];
2503: }
2504: return $currentstring;
2505: }
2506: #-- <thead> tag
2507: sub start_thead {
2508: my ($target,$token) = @_;
2509: my $currentstring = '';
2510: if ($target eq 'web') {
2511: $currentstring = $token->[4];
2512: }
2513: return $currentstring;
2514: }
2515: sub end_thead {
2516: my ($target,$token) = @_;
2517: my $currentstring = '';
2518: if ($target eq 'web') {
2519: $currentstring = $token->[2];
2520: }
2521: return $currentstring;
2522: }
2523: #-- <var> tag
2524: sub start_var {
2525: my ($target,$token) = @_;
2526: my $currentstring = '';
2527: if ($target eq 'web') {
2528: $currentstring = $token->[4];
2529: }
2530: return $currentstring;
2531: }
2532: sub end_var {
2533: my ($target,$token) = @_;
2534: my $currentstring = '';
2535: if ($target eq 'web') {
2536: $currentstring = $token->[2];
2537: }
2538: return $currentstring;
2539: }
2540: #-- <wbr> tag
2541: sub start_wbr {
2542: my ($target,$token) = @_;
2543: my $currentstring = '';
2544: if ($target eq 'web') {
2545: $currentstring = $token->[4];
2546: }
2547: return $currentstring;
2548: }
2549: sub end_wbr {
2550: my ($target,$token) = @_;
2551: my $currentstring = '';
2552: if ($target eq 'web') {
2553: $currentstring = $token->[2];
2554: }
2555: return $currentstring;
2556: }
2557:
2558: sub image_replication {
2559: my $src = shift;
2560: if (not -e '/home/httpd/html'.$src) {
2561: #replicates image itself
2562: &Apache::lonnet::repcopy('/home/httpd/html'.$src);
2563: #replicates eps or ps
2564: my $newsrc = $src;
2565: $newsrc =~ s/\.(gif|jpg|png)$/.eps/;
2566: if (not-e $newsrc && &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc) ne 'OK') {
2567: $newsrc =~ s/\.ps$/\.eps/;
2568: &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc);
2569: }
2570: }
2571: return '';
2572: }
2573:
2574: 1;
2575: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>