Annotation of loncom/xml/londefdef.pm, revision 1.117
1.1 sakharuk 1: # The LearningOnline Network with CAPA
2: # Tags Default Definition Module
3: #
1.117 ! www 4: # $Id: londefdef.pm,v 1.116 2003/02/18 21:14: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 {
1.117 ! www 1605: my $alttag= &Apache::lonxml::get_param
! 1606: ('alt',$parstack,$safeeval,undef,1);
1.116 www 1607: unless ($alttag) {
1.117 ! www 1608: $alttag=&Apache::lonmeta::alttag
! 1609: ($Apache::lonxml::pwd[-1],$src);
1.116 www 1610: }
1611: $currentstring='[IMAGE: '.$alttag.']';
1612: }
1.10 www 1613: } elsif ($target eq 'tex') {
1.117 ! www 1614: $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
! 1615: &image_replication($src);
! 1616:
1.102 sakharuk 1617: #if original gif/jpg/png file exist do following:
1.84 sakharuk 1618: if (-e $src) {
1619: #defines the default size of image
1.80 sakharuk 1620: my $image = Image::Magick->new;
1621: my $current_figure = $image->Read($src);
1622: $width_param = $image->Get('width') * $scaling;;
1623: $height_param = $image->Get('height') * $scaling;;
1624: undef $image;
1625: #do we have any specified size of the picture?
1.104 sakharuk 1626: my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval);
1627: my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval);
1.101 sakharuk 1628: my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval,
1629: undef,1);
1.90 sakharuk 1630: if ($TeXwidth ne '') {
1631: if ($TeXwidth=~/(\d+)\s*\%/) {
1632: $width_param = $1*$ENV{'form.textwidth'}/100;
1633: } else {
1634: $width_param = $TeXwidth;
1635: }
1636: } elsif ($TeXheight ne '') {
1637: $width_param = $TeXheight/$height_param*$width_param;
1.80 sakharuk 1638: } elsif ($width ne '') {
1639: $width_param = $width*$scaling;
1640: }
1.84 sakharuk 1641: my $file;
1642: my $path;
1643: if ($src =~ m!(.*)/([^/]*)$!) {
1644: $file = $2;
1645: $path = $1.'/';
1646: }
1647: my $newsrc = $src;
1.103 sakharuk 1648: $newsrc =~ s/\.(gif|jpg|png)$/.eps/i;
1649: $file=~s/\.(gif|jpg|png)$/.eps/i;
1.80 sakharuk 1650: #where can we find the picture?
1651: if (-e $newsrc) {
1.84 sakharuk 1652: #eps counterpart for image exist
1.80 sakharuk 1653: if ($path) {
1.107 albertel 1654: $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1.62 sakharuk 1655: }
1.80 sakharuk 1656: } else {
1.84 sakharuk 1657: #there is no eps counterpart for image - check for ps one
1658: $newsrc =~ s/\.eps$/\.ps/;
1659: if (-e $newsrc) {
1660: #ps counterpart for image exist
1661: $file =~ s/\.eps$/\.ps/;
1662: if ($path) {
1.107 albertel 1663: $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1.84 sakharuk 1664: }
1665: } else {
1666: #there aren't eps or ps - so create eps
1667: my $temp_file;
1668: my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
1669: $temp_file = Apache::File->new('>>'.$filename);
1670: print $temp_file "$src\n";
1.107 albertel 1671: $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool/}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
1.84 sakharuk 1672: }
1.62 sakharuk 1673: }
1.80 sakharuk 1674: } else {
1.84 sakharuk 1675: #original image file doesn't exist so check the alt attribute
1.101 sakharuk 1676: my $alt = &Apache::lonxml::get_param('alt',$parstack,$safeeval,undef,1);
1.80 sakharuk 1677: if ($alt) {
1678: $currentstring .= ' '.$alt.' ';
1.62 sakharuk 1679: } else {
1.92 sakharuk 1680: #<allow> tag will care about replication
1.57 sakharuk 1681: }
1.42 albertel 1682: }
1683: }
1684: return $currentstring;
1.10 www 1685: }
1686: sub end_img {
1687: my ($target,$token) = @_;
1688: my $currentstring = '';
1689: if ($target eq 'web') {
1.44 sakharuk 1690: $currentstring = $token->[2];
1.10 www 1691: } elsif ($target eq 'tex') {
1.44 sakharuk 1692: $currentstring = '';
1693: }
1.10 www 1694: return $currentstring;
1695: }
1.35 sakharuk 1696: #-- <applet> tag
1.10 www 1697:
1698: sub start_applet {
1699: my ($target,$token) = @_;
1700: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1701: $token->[2]->{'code'};
1.44 sakharuk 1702: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1703: $token->[2]->{'archive'};
1704: my $currentstring = '';
1705: if ($target eq 'web') {
1.116 www 1706: if ($ENV{'browser.appletsuppress'} ne 'on') {
1707: $currentstring = $token->[4];
1708: } else {
1709: my $alttag=$token->[2]->{'alt'};
1710: unless ($alttag) {
1.117 ! www 1711: $alttag=&Apache::lonmeta::alttag($ENV{'REQUEST_URI'},
! 1712: $token->[2]->{'code'});
1.116 www 1713: }
1714: $currentstring='[APPLET: '.$alttag.']';
1715: }
1.10 www 1716: } elsif ($target eq 'tex') {
1.44 sakharuk 1717: $currentstring = " \\begin{figure} ";
1.10 www 1718: }
1719: return $currentstring;
1720: }
1.44 sakharuk 1721: sub end_applet {
1722: my ($target,$token) = @_;
1723: my $currentstring = '';
1724: if ($target eq 'web') {
1725: $currentstring = $token->[2];
1726: } elsif ($target eq 'tex') {
1727: $currentstring = " \\end{figure}";
1728: }
1729: return $currentstring;
1730: }
1.10 www 1731:
1.35 sakharuk 1732: #-- <embed> tag
1.10 www 1733:
1.45 sakharuk 1734: sub start_embed {
1.44 sakharuk 1735: my ($target,$token) = @_;
1736: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1737: $token->[2]->{'src'};
1738: my $currentstring = '';
1739: if ($target eq 'web') {
1.116 www 1740: if ($ENV{'browser.embedsuppress'} ne 'on') {
1741: $currentstring = $token->[4];
1742: } else {
1743: my $alttag=$token->[2]->{'alt'};
1744: unless ($alttag) {
1.117 ! www 1745: $alttag=&Apache::lonmeta::alttag($ENV{'REQUEST_URI'},
! 1746: $token->[2]->{'src'});
1.116 www 1747: }
1748: $currentstring='[EMBED: '.$alttag.']';
1749: }
1.44 sakharuk 1750: } elsif ($target eq 'tex') {
1751: $currentstring = " \\begin{figure} ";
1752: }
1753: return $currentstring;
1754: }
1.10 www 1755: sub end_embed {
1756: my ($target,$token) = @_;
1757: my $currentstring = '';
1758: if ($target eq 'web') {
1759: $currentstring = $token->[2];
1760: } elsif ($target eq 'tex') {
1761: $currentstring = " \\end{figure}";
1762: }
1763: return $currentstring;
1764: }
1765:
1.35 sakharuk 1766: #-- <param> tag
1.10 www 1767:
1.11 www 1768: sub start_param {
1.10 www 1769: my ($target,$token) = @_;
1770: if ($token->[2]->{'name'} eq 'cabbase') {
1771: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1772: $token->[2]->{'value'};
1773: }
1.20 www 1774: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1775: $token->[2]->{'src'};
1776: my $currentstring = '';
1777: if ($target eq 'web') {
1778: $currentstring = $token->[4];
1779: } elsif ($target eq 'tex') {
1780: $currentstring = " \\begin{figure} ";
1781: }
1782: return $currentstring;
1783: }
1.11 www 1784: sub end_param {
1.10 www 1785: my ($target,$token) = @_;
1786: my $currentstring = '';
1787: if ($target eq 'web') {
1788: $currentstring = $token->[2];
1789: } elsif ($target eq 'tex') {
1790: $currentstring = " \\end{figure}";
1791: }
1792: return $currentstring;
1793: }
1.35 sakharuk 1794: #-- <allow> tag
1.98 albertel 1795: sub start_allow {
1796: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1797: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1798: $token->[2]->{'src'};
1.101 sakharuk 1799: my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
1.98 albertel 1800: &image_replication($src);
1801: my $result;
1802: if ($target eq 'edit') {
1803: $result .=&Apache::edit::tag_start($target,$token);
1804: $result .=&Apache::edit::text_arg('File Spec:','src',$token,70);
1805: $result .=&Apache::edit::end_row();#.&Apache::edit::start_spanning_row();
1806: } elsif ($target eq 'modified') {
1807: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1808: $safeeval,'src');
1809: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1810: }
1811: return $result;
1812: }
1813:
1814: sub end_allow {
1815: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1816: if ( $target eq 'edit') { return (&Apache::edit::end_table()); }
1817: return '';
1818: }
1.35 sakharuk 1819: #-- Frames
1.31 albertel 1820: sub start_frameset {
1821: my ($target,$token) = @_;
1822: my $currentstring = '';
1823: if ($target eq 'web') {
1824: if (!$Apache::lonxml::registered) {
1.47 matthew 1825: $currentstring.='<head>'.
1.113 www 1826: &Apache::lonmenu::registerurl(undef,$target).'</head>';
1.31 albertel 1827: }
1828: $currentstring .= $token->[4];
1829: }
1830: return $currentstring;
1831: }
1832: sub end_frameset {
1833: my ($target,$token) = @_;
1834: my $currentstring = '';
1835: if ($target eq 'web') {
1836: $currentstring = $token->[2];
1837: }
1838: return $currentstring;
1.41 sakharuk 1839: }
1840: #-- <pre>
1841: sub start_pre {
1842: my ($target,$token) = @_;
1843: my $currentstring = '';
1844: if ($target eq 'web') {
1845: $currentstring .= $token->[4];
1846: } elsif ($target eq 'tex') {
1847: $currentstring .= '\begin{verbatim}';
1848: }
1849: return $currentstring;
1850: }
1851: sub end_pre {
1852: my ($target,$token) = @_;
1853: my $currentstring = '';
1854: if ($target eq 'web') {
1855: $currentstring .= $token->[2];
1856: } elsif ($target eq 'tex') {
1857: $currentstring .= '\end{verbatim}';
1.44 sakharuk 1858: }
1859: return $currentstring;
1860: }
1861: #-- <insert>
1862: sub start_insert {
1.46 sakharuk 1863: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1.44 sakharuk 1864: my $currentstring = '';
1865: if ($target eq 'web') {
1.101 sakharuk 1866: my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
1.46 sakharuk 1867: $currentstring .= '<b>'.$display.'</b>';;
1.44 sakharuk 1868: }
1869: return $currentstring;
1870: }
1871: sub end_insert {
1.48 sakharuk 1872: my ($target,$token) = @_;
1873: my $currentstring = '';
1874: if ($target eq 'web') {
1875: $currentstring .= '';
1876: }
1877: return $currentstring;
1878: }
1879: #-- <externallink>
1880: sub start_externallink {
1881: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1882: my $currentstring = '';
1883: if ($target eq 'web') {
1.101 sakharuk 1884: my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
1.48 sakharuk 1885: $currentstring .= '<b>'.$display.'</b>';;
1886: }
1887: return $currentstring;
1888: }
1889: sub end_externallink {
1.44 sakharuk 1890: my ($target,$token) = @_;
1891: my $currentstring = '';
1892: if ($target eq 'web') {
1893: $currentstring .= '';
1.65 sakharuk 1894: }
1895: return $currentstring;
1896: }
1897: #-- <blankspace heigth="">
1898: sub start_blankspace {
1899: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1900: my $currentstring = '';
1901: if ($target eq 'tex') {
1.101 sakharuk 1902: my $howmuch = &Apache::lonxml::get_param('heigth',$parstack,$safeeval,undef,1);
1.65 sakharuk 1903: $currentstring .= '\vskip '.$howmuch.' ';
1904: }
1905: return $currentstring;
1906: }
1907: sub end_blankspace {
1908: my ($target,$token) = @_;
1909: my $currentstring = '';
1910: if ($target eq 'tex') {
1911: $currentstring .= '';
1912: }
1913: return $currentstring;
1914: }
1.88 sakharuk 1915: #-- <abbr> tag
1916: sub start_abbr {
1917: my ($target,$token) = @_;
1918: my $currentstring = '';
1919: if ($target eq 'web') {
1920: $currentstring = $token->[4];
1921: }
1922: return $currentstring;
1923: }
1924: sub end_abbr {
1925: my ($target,$token) = @_;
1926: my $currentstring = '';
1927: if ($target eq 'web') {
1928: $currentstring = $token->[2];
1929: }
1930: return $currentstring;
1931: }
1932: #-- <acronym> tag
1933: sub start_acronym {
1934: my ($target,$token) = @_;
1935: my $currentstring = '';
1936: if ($target eq 'web') {
1937: $currentstring = $token->[4];
1938: }
1939: return $currentstring;
1940: }
1941: sub end_acronym {
1942: my ($target,$token) = @_;
1943: my $currentstring = '';
1944: if ($target eq 'web') {
1945: $currentstring = $token->[2];
1946: }
1947: return $currentstring;
1948: }
1949: #-- <area> tag
1950: sub start_area {
1951: my ($target,$token) = @_;
1952: my $currentstring = '';
1953: if ($target eq 'web') {
1954: $currentstring = $token->[4];
1955: }
1956: return $currentstring;
1957: }
1958: sub end_area {
1959: my ($target,$token) = @_;
1960: my $currentstring = '';
1961: if ($target eq 'web') {
1962: $currentstring = $token->[2];
1963: }
1964: return $currentstring;
1965: }
1966: #-- <base> tag
1967: sub start_base {
1968: my ($target,$token) = @_;
1969: my $currentstring = '';
1970: if ($target eq 'web') {
1971: $currentstring = $token->[4];
1972: }
1973: return $currentstring;
1974: }
1975: sub end_base {
1976: my ($target,$token) = @_;
1977: my $currentstring = '';
1978: if ($target eq 'web') {
1979: $currentstring = $token->[2];
1980: }
1981: return $currentstring;
1982: }
1983: #-- <bdo> tag
1984: sub start_bdo {
1985: my ($target,$token) = @_;
1986: my $currentstring = '';
1987: if ($target eq 'web') {
1988: $currentstring = $token->[4];
1989: }
1990: return $currentstring;
1991: }
1992: sub end_bdo {
1993: my ($target,$token) = @_;
1994: my $currentstring = '';
1995: if ($target eq 'web') {
1996: $currentstring = $token->[2];
1997: }
1998: return $currentstring;
1999: }
2000: #-- <bgsound> tag
2001: sub start_bgsound {
2002: my ($target,$token) = @_;
2003: my $currentstring = '';
2004: if ($target eq 'web') {
2005: $currentstring = $token->[4];
2006: }
2007: return $currentstring;
2008: }
2009: sub end_bgsound {
2010: my ($target,$token) = @_;
2011: my $currentstring = '';
2012: if ($target eq 'web') {
2013: $currentstring = $token->[2];
2014: }
2015: return $currentstring;
2016: }
2017: #-- <blink> tag
2018: sub start_blink {
2019: my ($target,$token) = @_;
2020: my $currentstring = '';
2021: if ($target eq 'web') {
2022: $currentstring = $token->[4];
2023: }
2024: return $currentstring;
2025: }
2026: sub end_blink {
2027: my ($target,$token) = @_;
2028: my $currentstring = '';
2029: if ($target eq 'web') {
2030: $currentstring = $token->[2];
2031: }
2032: return $currentstring;
2033: }
2034: #-- <blockquote> tag
2035: sub start_blockquote {
2036: my ($target,$token) = @_;
2037: my $currentstring = '';
2038: if ($target eq 'web') {
2039: $currentstring = $token->[4];
2040: }
2041: return $currentstring;
2042: }
2043: sub end_blockquote {
2044: my ($target,$token) = @_;
2045: my $currentstring = '';
2046: if ($target eq 'web') {
2047: $currentstring = $token->[2];
2048: }
2049: return $currentstring;
2050: }
2051: #-- <button> tag
2052: sub start_button {
2053: my ($target,$token) = @_;
2054: my $currentstring = '';
2055: if ($target eq 'web') {
2056: $currentstring = $token->[4];
2057: }
2058: return $currentstring;
2059: }
2060: sub end_button {
2061: my ($target,$token) = @_;
2062: my $currentstring = '';
2063: if ($target eq 'web') {
2064: $currentstring = $token->[2];
2065: }
2066: return $currentstring;
2067: }
2068: #-- <caption> tag
2069: sub start_caption {
2070: my ($target,$token) = @_;
2071: my $currentstring = '';
2072: if ($target eq 'web') {
2073: $currentstring = $token->[4];
2074: }
2075: return $currentstring;
2076: }
2077: sub end_caption {
2078: my ($target,$token) = @_;
2079: my $currentstring = '';
2080: if ($target eq 'web') {
2081: $currentstring = $token->[2];
2082: }
2083: return $currentstring;
2084: }
2085: #-- <col> tag
2086: sub start_col {
2087: my ($target,$token) = @_;
2088: my $currentstring = '';
2089: if ($target eq 'web') {
2090: $currentstring = $token->[4];
2091: }
2092: return $currentstring;
2093: }
2094: sub end_col {
2095: my ($target,$token) = @_;
2096: my $currentstring = '';
2097: if ($target eq 'web') {
2098: $currentstring = $token->[2];
2099: }
2100: return $currentstring;
2101: }
2102: #-- <colgroup> tag
2103: sub start_colgroup {
2104: my ($target,$token) = @_;
2105: my $currentstring = '';
2106: if ($target eq 'web') {
2107: $currentstring = $token->[4];
2108: }
2109: return $currentstring;
2110: }
2111: sub end_colgroup {
2112: my ($target,$token) = @_;
2113: my $currentstring = '';
2114: if ($target eq 'web') {
2115: $currentstring = $token->[2];
2116: }
2117: return $currentstring;
2118: }
2119: #-- <del> tag
2120: sub start_del {
2121: my ($target,$token) = @_;
2122: my $currentstring = '';
2123: if ($target eq 'web') {
2124: $currentstring = $token->[4];
2125: }
2126: return $currentstring;
2127: }
2128: sub end_del {
2129: my ($target,$token) = @_;
2130: my $currentstring = '';
2131: if ($target eq 'web') {
2132: $currentstring = $token->[2];
2133: }
2134: return $currentstring;
2135: }
2136: #-- <fieldset> tag
2137: sub start_fieldset {
2138: my ($target,$token) = @_;
2139: my $currentstring = '';
2140: if ($target eq 'web') {
2141: $currentstring = $token->[4];
2142: }
2143: return $currentstring;
2144: }
2145: sub end_fieldset {
2146: my ($target,$token) = @_;
2147: my $currentstring = '';
2148: if ($target eq 'web') {
2149: $currentstring = $token->[2];
2150: }
2151: return $currentstring;
2152: }
2153: #-- <frame> tag
2154: sub start_frame {
2155: my ($target,$token) = @_;
2156: my $currentstring = '';
2157: if ($target eq 'web') {
2158: $currentstring = $token->[4];
2159: }
2160: return $currentstring;
2161: }
2162: sub end_frame {
2163: my ($target,$token) = @_;
2164: my $currentstring = '';
2165: if ($target eq 'web') {
2166: $currentstring = $token->[2];
2167: }
2168: return $currentstring;
2169: }
2170: #-- <iframe> tag
2171: sub start_iframe {
2172: my ($target,$token) = @_;
2173: my $currentstring = '';
2174: if ($target eq 'web') {
2175: $currentstring = $token->[4];
2176: }
2177: return $currentstring;
2178: }
2179: sub end_iframe {
2180: my ($target,$token) = @_;
2181: my $currentstring = '';
2182: if ($target eq 'web') {
2183: $currentstring = $token->[2];
2184: }
2185: return $currentstring;
2186: }
2187: #-- <ins> tag
2188: sub start_ins {
2189: my ($target,$token) = @_;
2190: my $currentstring = '';
2191: if ($target eq 'web') {
2192: $currentstring = $token->[4];
2193: }
2194: return $currentstring;
2195: }
2196: sub end_ins {
2197: my ($target,$token) = @_;
2198: my $currentstring = '';
2199: if ($target eq 'web') {
2200: $currentstring = $token->[2];
2201: }
2202: return $currentstring;
2203: }
2204: #-- <isindex> tag
2205: sub start_isindex {
2206: my ($target,$token) = @_;
2207: my $currentstring = '';
2208: if ($target eq 'web') {
2209: $currentstring = $token->[4];
2210: }
2211: return $currentstring;
2212: }
2213: sub end_isindex {
2214: my ($target,$token) = @_;
2215: my $currentstring = '';
2216: if ($target eq 'web') {
2217: $currentstring = $token->[2];
2218: }
2219: return $currentstring;
2220: }
2221: #-- <keygen> tag
2222: sub start_keygen {
2223: my ($target,$token) = @_;
2224: my $currentstring = '';
2225: if ($target eq 'web') {
2226: $currentstring = $token->[4];
2227: }
2228: return $currentstring;
2229: }
2230: sub end_keygen {
2231: my ($target,$token) = @_;
2232: my $currentstring = '';
2233: if ($target eq 'web') {
2234: $currentstring = $token->[2];
2235: }
2236: return $currentstring;
2237: }
2238: #-- <label> tag
2239: sub start_label {
2240: my ($target,$token) = @_;
2241: my $currentstring = '';
2242: if ($target eq 'web') {
2243: $currentstring = $token->[4];
2244: }
2245: return $currentstring;
2246: }
2247: sub end_label {
2248: my ($target,$token) = @_;
2249: my $currentstring = '';
2250: if ($target eq 'web') {
2251: $currentstring = $token->[2];
2252: }
2253: return $currentstring;
2254: }
2255: #-- <layer> tag
2256: sub start_layer {
2257: my ($target,$token) = @_;
2258: my $currentstring = '';
2259: if ($target eq 'web') {
2260: $currentstring = $token->[4];
2261: }
2262: return $currentstring;
2263: }
2264: sub end_layer {
2265: my ($target,$token) = @_;
2266: my $currentstring = '';
2267: if ($target eq 'web') {
2268: $currentstring = $token->[2];
2269: }
2270: return $currentstring;
2271: }
2272: #-- <legend> tag
2273: sub start_legend {
2274: my ($target,$token) = @_;
2275: my $currentstring = '';
2276: if ($target eq 'web') {
2277: $currentstring = $token->[4];
2278: }
2279: return $currentstring;
2280: }
2281: sub end_legend {
2282: my ($target,$token) = @_;
2283: my $currentstring = '';
2284: if ($target eq 'web') {
2285: $currentstring = $token->[2];
2286: }
2287: return $currentstring;
2288: }
2289: #-- <link> tag
2290: sub start_link {
2291: my ($target,$token) = @_;
2292: my $currentstring = '';
2293: if ($target eq 'web') {
2294: $currentstring = $token->[4];
2295: }
2296: return $currentstring;
2297: }
2298: sub end_link {
2299: my ($target,$token) = @_;
2300: my $currentstring = '';
2301: if ($target eq 'web') {
2302: $currentstring = $token->[2];
2303: }
2304: return $currentstring;
2305: }
2306: #-- <marquee> tag
2307: sub start_marquee {
2308: my ($target,$token) = @_;
2309: my $currentstring = '';
2310: if ($target eq 'web') {
2311: $currentstring = $token->[4];
2312: }
2313: return $currentstring;
2314: }
2315: sub end_marquee {
2316: my ($target,$token) = @_;
2317: my $currentstring = '';
2318: if ($target eq 'web') {
2319: $currentstring = $token->[2];
2320: }
2321: return $currentstring;
2322: }
2323: #-- <malticol> tag
2324: sub start_malticol {
2325: my ($target,$token) = @_;
2326: my $currentstring = '';
2327: if ($target eq 'web') {
2328: $currentstring = $token->[4];
2329: }
2330: return $currentstring;
2331: }
2332: sub end_malticol {
2333: my ($target,$token) = @_;
2334: my $currentstring = '';
2335: if ($target eq 'web') {
2336: $currentstring = $token->[2];
2337: }
2338: return $currentstring;
2339: }
2340: #-- <nobr> tag
2341: sub start_nobr {
2342: my ($target,$token) = @_;
2343: my $currentstring = '';
2344: if ($target eq 'web') {
2345: $currentstring = $token->[4];
2346: }
2347: return $currentstring;
2348: }
2349: sub end_nobr {
2350: my ($target,$token) = @_;
2351: my $currentstring = '';
2352: if ($target eq 'web') {
2353: $currentstring = $token->[2];
2354: }
2355: return $currentstring;
2356: }
2357: #-- <noembed> tag
2358: sub start_noembed {
2359: my ($target,$token) = @_;
2360: my $currentstring = '';
2361: if ($target eq 'web') {
2362: $currentstring = $token->[4];
2363: }
2364: return $currentstring;
2365: }
2366: sub end_noembed {
2367: my ($target,$token) = @_;
2368: my $currentstring = '';
2369: if ($target eq 'web') {
2370: $currentstring = $token->[2];
2371: }
2372: return $currentstring;
2373: }
2374: #-- <noframes> tag
2375: sub start_noframes {
2376: my ($target,$token) = @_;
2377: my $currentstring = '';
2378: if ($target eq 'web') {
2379: $currentstring = $token->[4];
2380: }
2381: return $currentstring;
2382: }
2383: sub end_noframes {
2384: my ($target,$token) = @_;
2385: my $currentstring = '';
2386: if ($target eq 'web') {
2387: $currentstring = $token->[2];
2388: }
2389: return $currentstring;
2390: }
2391: #-- <nolayer> tag
2392: sub start_nolayer {
2393: my ($target,$token) = @_;
2394: my $currentstring = '';
2395: if ($target eq 'web') {
2396: $currentstring = $token->[4];
2397: }
2398: return $currentstring;
2399: }
2400: sub end_nolayer {
2401: my ($target,$token) = @_;
2402: my $currentstring = '';
2403: if ($target eq 'web') {
2404: $currentstring = $token->[2];
2405: }
2406: return $currentstring;
2407: }
2408: #-- <noscript> tag
2409: sub start_noscript {
2410: my ($target,$token) = @_;
2411: my $currentstring = '';
2412: if ($target eq 'web') {
2413: $currentstring = $token->[4];
2414: }
2415: return $currentstring;
2416: }
2417: sub end_noscript {
2418: my ($target,$token) = @_;
2419: my $currentstring = '';
2420: if ($target eq 'web') {
2421: $currentstring = $token->[2];
2422: }
2423: return $currentstring;
2424: }
2425: #-- <object> tag
2426: sub start_object {
2427: my ($target,$token) = @_;
2428: my $currentstring = '';
2429: if ($target eq 'web') {
2430: $currentstring = $token->[4];
2431: }
2432: return $currentstring;
2433: }
2434: sub end_object {
2435: my ($target,$token) = @_;
2436: my $currentstring = '';
2437: if ($target eq 'web') {
2438: $currentstring = $token->[2];
2439: }
2440: return $currentstring;
2441: }
2442: #-- <optgroup> tag
2443: sub start_optgroup {
2444: my ($target,$token) = @_;
2445: my $currentstring = '';
2446: if ($target eq 'web') {
2447: $currentstring = $token->[4];
2448: }
2449: return $currentstring;
2450: }
2451: sub end_optgroup {
2452: my ($target,$token) = @_;
2453: my $currentstring = '';
2454: if ($target eq 'web') {
2455: $currentstring = $token->[2];
2456: }
2457: return $currentstring;
2458: }
2459: #-- <samp> tag
2460: sub start_samp {
2461: my ($target,$token) = @_;
2462: my $currentstring = '';
2463: if ($target eq 'web') {
2464: $currentstring = $token->[4];
2465: }
2466: return $currentstring;
2467: }
2468: sub end_samp {
2469: my ($target,$token) = @_;
2470: my $currentstring = '';
2471: if ($target eq 'web') {
2472: $currentstring = $token->[2];
2473: }
2474: return $currentstring;
2475: }
2476: #-- <server> tag
2477: sub start_server {
2478: my ($target,$token) = @_;
2479: my $currentstring = '';
2480: if ($target eq 'web') {
2481: $currentstring = $token->[4];
2482: }
2483: return $currentstring;
2484: }
2485: sub end_server {
2486: my ($target,$token) = @_;
2487: my $currentstring = '';
2488: if ($target eq 'web') {
2489: $currentstring = $token->[2];
2490: }
2491: return $currentstring;
2492: }
2493: #-- <spacer> tag
2494: sub start_spacer {
2495: my ($target,$token) = @_;
2496: my $currentstring = '';
2497: if ($target eq 'web') {
2498: $currentstring = $token->[4];
2499: }
2500: return $currentstring;
2501: }
2502: sub end_spacer {
2503: my ($target,$token) = @_;
2504: my $currentstring = '';
2505: if ($target eq 'web') {
2506: $currentstring = $token->[2];
2507: }
2508: return $currentstring;
2509: }
2510: #-- <span> tag
2511: sub start_span {
2512: my ($target,$token) = @_;
2513: my $currentstring = '';
2514: if ($target eq 'web') {
2515: $currentstring = $token->[4];
2516: }
2517: return $currentstring;
2518: }
2519: sub end_span {
2520: my ($target,$token) = @_;
2521: my $currentstring = '';
2522: if ($target eq 'web') {
2523: $currentstring = $token->[2];
2524: }
2525: return $currentstring;
2526: }
2527: #-- <tbody> tag
2528: sub start_tbody {
2529: my ($target,$token) = @_;
2530: my $currentstring = '';
2531: if ($target eq 'web') {
2532: $currentstring = $token->[4];
2533: }
2534: return $currentstring;
2535: }
2536: sub end_tbody {
2537: my ($target,$token) = @_;
2538: my $currentstring = '';
2539: if ($target eq 'web') {
2540: $currentstring = $token->[2];
2541: }
2542: return $currentstring;
2543: }
2544: #-- <tfoot> tag
2545: sub start_tfoot {
2546: my ($target,$token) = @_;
2547: my $currentstring = '';
2548: if ($target eq 'web') {
2549: $currentstring = $token->[4];
2550: }
2551: return $currentstring;
2552: }
2553: sub end_tfoot {
2554: my ($target,$token) = @_;
2555: my $currentstring = '';
2556: if ($target eq 'web') {
2557: $currentstring = $token->[2];
2558: }
2559: return $currentstring;
2560: }
2561: #-- <thead> tag
2562: sub start_thead {
2563: my ($target,$token) = @_;
2564: my $currentstring = '';
2565: if ($target eq 'web') {
2566: $currentstring = $token->[4];
2567: }
2568: return $currentstring;
2569: }
2570: sub end_thead {
2571: my ($target,$token) = @_;
2572: my $currentstring = '';
2573: if ($target eq 'web') {
2574: $currentstring = $token->[2];
2575: }
2576: return $currentstring;
2577: }
2578: #-- <var> tag
2579: sub start_var {
2580: my ($target,$token) = @_;
2581: my $currentstring = '';
2582: if ($target eq 'web') {
2583: $currentstring = $token->[4];
2584: }
2585: return $currentstring;
2586: }
2587: sub end_var {
2588: my ($target,$token) = @_;
2589: my $currentstring = '';
2590: if ($target eq 'web') {
2591: $currentstring = $token->[2];
2592: }
2593: return $currentstring;
2594: }
2595: #-- <wbr> tag
2596: sub start_wbr {
2597: my ($target,$token) = @_;
2598: my $currentstring = '';
2599: if ($target eq 'web') {
2600: $currentstring = $token->[4];
2601: }
2602: return $currentstring;
2603: }
2604: sub end_wbr {
2605: my ($target,$token) = @_;
2606: my $currentstring = '';
2607: if ($target eq 'web') {
2608: $currentstring = $token->[2];
2609: }
2610: return $currentstring;
2611: }
1.94 sakharuk 2612:
2613: sub image_replication {
2614: my $src = shift;
2615: if (not -e '/home/httpd/html'.$src) {
2616: #replicates image itself
2617: &Apache::lonnet::repcopy('/home/httpd/html'.$src);
2618: #replicates eps or ps
2619: my $newsrc = $src;
1.105 sakharuk 2620: $newsrc =~ s/\.(gif|jpg|png)$/.eps/;
1.94 sakharuk 2621: if (not-e $newsrc && &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc) ne 'OK') {
1.111 albertel 2622: $newsrc =~ s/\.eps$/\.ps/;
1.94 sakharuk 2623: &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc);
2624: }
2625: }
2626: return '';
2627: }
2628:
1.1 sakharuk 2629: 1;
2630: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>