File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.102: download - view: text, annotated - select for diffs
Fri Nov 15 15:14:12 2002 UTC (21 years, 6 months ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
Added png to gif anf jpg (bug #936).

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>