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