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