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