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