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