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