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