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