File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.100: download - view: text, annotated - select for diffs
Sat Nov 9 22:05:33 2002 UTC (21 years, 6 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- have the tth init code set the unicode encoding
- new ENV parm needed browser.unicode

    1: # The LearningOnline Network with CAPA
    2: # Tags Default Definition Module 
    3: #
    4: # $Id: londefdef.pm,v 1.100 2002/11/09 22:05:33 albertel 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);
 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);
 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 = ($NumberEmptyLength+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),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),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),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 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: 		  my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval); 
 1580: 		  my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval);
 1581: 		  if ($TeXwidth ne '') {  
 1582: 		      if ($TeXwidth=~/(\d+)\s*\%/) {
 1583: 			  $width_param = $1*$ENV{'form.textwidth'}/100;
 1584: 		      } else { 
 1585: 			  $width_param = $TeXwidth;
 1586: 		      }
 1587: 		  } elsif ($TeXheight ne '') {
 1588: 			  $width_param = $TeXheight/$height_param*$width_param;
 1589: 		  } elsif ($width ne '') {
 1590: 		      $width_param = $width*$scaling;      
 1591: 		  }
 1592: 		  my $file;
 1593: 		  my $path;	
 1594: 		  if ($src =~ m!(.*)/([^/]*)$!) {
 1595: 		      $file = $2; 
 1596: 		      $path = $1.'/'; 
 1597: 		  } 
 1598: 		  my $newsrc = $src;
 1599: 		  $newsrc =~ s/(\.gif|\.jpg)$/\.eps/i;
 1600: 		  $file=~s/(\.gif|\.jpg)$/\.eps/i;
 1601: 		  #where can we find the picture?
 1602: 		  if (-e $newsrc) {
 1603:                       #eps counterpart for image exist 
 1604: 		      if ($path) {
 1605: 			  $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} ';
 1606: 		      }
 1607: 		  } else {
 1608:                       #there is no eps counterpart for image - check for ps one
 1609: 		      $newsrc =~ s/\.eps$/\.ps/;
 1610: 		      if (-e $newsrc) {
 1611: 			  #ps counterpart for image exist 
 1612: 			  $file =~ s/\.eps$/\.ps/;
 1613: 			  if ($path) {
 1614: 			      $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} ';
 1615: 			  }
 1616: 		      } else {
 1617: 			  #there aren't eps or ps - so create eps 
 1618: 			  my $temp_file;
 1619: 			  my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
 1620: 			  $temp_file = Apache::File->new('>>'.$filename); 
 1621: 			  print $temp_file "$src\n";
 1622: 			  $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool/}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} ';
 1623: 		      }
 1624: 		  }
 1625: 	      } else {
 1626: 		  #original image file doesn't exist so check the alt attribute
 1627: 		  my $alt = &Apache::lonxml::get_param('alt',$parstack,$safeeval);
 1628:                   if ($alt) {
 1629: 		      $currentstring .= ' '.$alt.' ';
 1630: 		  } else {
 1631:                      #<allow> tag will care about replication 
 1632: 		  }
 1633: 	      }
 1634: 	    }
 1635: 	    return $currentstring;
 1636: 	}
 1637:         sub end_img {
 1638: 	    my ($target,$token) = @_;
 1639:             my $currentstring = '';
 1640:             if ($target eq 'web') {
 1641:               $currentstring = $token->[2];
 1642: 	    } elsif ($target eq 'tex') {
 1643:               $currentstring = '';
 1644: 	    }
 1645: 	   return $currentstring;
 1646: 	}
 1647: #-- <applet> tag
 1648: 
 1649:         sub start_applet {
 1650: 	    my ($target,$token) = @_;
 1651:               $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1652:                                         $token->[2]->{'code'};
 1653:               $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
 1654:                                         $token->[2]->{'archive'};
 1655:             my $currentstring = '';
 1656:             if ($target eq 'web') {
 1657:               $currentstring = $token->[4];
 1658: 	    } elsif ($target eq 'tex') {
 1659:               $currentstring = " \\begin{figure} ";
 1660: 	    } 
 1661: 	   return $currentstring;
 1662: 	}
 1663: sub end_applet {
 1664:     my ($target,$token) = @_;
 1665:     my $currentstring = '';
 1666:     if ($target eq 'web') {
 1667: 	$currentstring = $token->[2];
 1668:     } elsif ($target eq 'tex') {
 1669: 	$currentstring = " \\end{figure}";
 1670:     } 
 1671:     return $currentstring;
 1672: }
 1673: 
 1674: #-- <embed> tag
 1675: 
 1676: sub start_embed {    
 1677:     my ($target,$token) = @_;
 1678:     $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
 1679: 	$token->[2]->{'src'};
 1680:     my $currentstring = '';
 1681:     if ($target eq 'web') {
 1682: 	$currentstring = $token->[4];
 1683:     } elsif ($target eq 'tex') {
 1684: 	$currentstring = " \\begin{figure} ";  
 1685:     } 
 1686:     return $currentstring;
 1687: }
 1688:         sub end_embed {
 1689: 	    my ($target,$token) = @_;
 1690:             my $currentstring = '';
 1691:             if ($target eq 'web') {
 1692:               $currentstring = $token->[2];     
 1693: 	    } elsif ($target eq 'tex') {
 1694:               $currentstring = " \\end{figure}";  
 1695: 	    } 
 1696: 	   return $currentstring;
 1697: 	}
 1698: 
 1699: #-- <param> tag
 1700: 
 1701:         sub start_param {
 1702: 	    my ($target,$token) = @_;
 1703: 	    if ($token->[2]->{'name'} eq 'cabbase') {
 1704:                       $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
 1705: 					     $token->[2]->{'value'};
 1706:             }   
 1707:             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1708:                                         $token->[2]->{'src'};
 1709:             my $currentstring = '';
 1710:             if ($target eq 'web') {
 1711:               $currentstring = $token->[4];     
 1712: 	    } elsif ($target eq 'tex') {
 1713:               $currentstring = " \\begin{figure} ";  
 1714: 	    } 
 1715: 	   return $currentstring;
 1716: 	}
 1717:         sub end_param {
 1718: 	    my ($target,$token) = @_;
 1719:             my $currentstring = '';
 1720:             if ($target eq 'web') {
 1721:               $currentstring = $token->[2];     
 1722: 	    } elsif ($target eq 'tex') {
 1723:               $currentstring = " \\end{figure}";  
 1724: 	    } 
 1725: 	   return $currentstring;
 1726: 	}
 1727: #-- <allow> tag
 1728: sub start_allow {
 1729:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
 1730:     $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
 1731: 	$token->[2]->{'src'};
 1732:     my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval);
 1733:     &image_replication($src);
 1734:     my $result;
 1735:     if ($target eq 'edit') {
 1736: 	$result .=&Apache::edit::tag_start($target,$token);
 1737: 	$result .=&Apache::edit::text_arg('File Spec:','src',$token,70);
 1738: 	$result .=&Apache::edit::end_row();#.&Apache::edit::start_spanning_row();
 1739:     } elsif ($target eq 'modified') {
 1740: 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
 1741: 						     $safeeval,'src');
 1742: 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
 1743:     }
 1744:     return $result;
 1745: }
 1746: 
 1747: sub end_allow {
 1748:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
 1749:     if ( $target eq 'edit') { return (&Apache::edit::end_table()); }
 1750:     return '';
 1751: }
 1752: #-- Frames
 1753: 	sub start_frameset {
 1754: 	  my ($target,$token) = @_;
 1755: 	  my $currentstring = '';
 1756: 	  if ($target eq 'web') { 
 1757: 	    if (!$Apache::lonxml::registered) {
 1758: 	      $currentstring.='<head>'.
 1759: 		  &Apache::lonxml::registerurl(undef,$target).'</head>';
 1760: 	    }
 1761: 	    $currentstring .= $token->[4];
 1762: 	  }
 1763: 	  return $currentstring;
 1764: 	}
 1765:         sub end_frameset {
 1766: 	  my ($target,$token) = @_;
 1767: 	  my $currentstring = '';
 1768: 	  if ($target eq 'web') {
 1769: 	    $currentstring = $token->[2];
 1770: 	  }
 1771: 	  return $currentstring;
 1772: 	}
 1773: #-- <pre>
 1774: 	sub start_pre {
 1775: 	    my ($target,$token) = @_;
 1776:             my $currentstring = '';
 1777:             if ($target eq 'web') {
 1778: 	       $currentstring .= $token->[4];
 1779: 	    } elsif ($target eq 'tex') {
 1780: 		$currentstring .= '\begin{verbatim}';
 1781: 	    } 
 1782:            return $currentstring;
 1783: 	}
 1784:         sub end_pre {
 1785: 	    my ($target,$token) = @_;
 1786:             my $currentstring = '';
 1787:             if ($target eq 'web') {
 1788: 	       $currentstring .= $token->[2];
 1789: 	    } elsif ($target eq 'tex') {
 1790: 		$currentstring .= '\end{verbatim}';
 1791: 	    }
 1792:            return $currentstring;
 1793: 	}
 1794: #-- <insert>
 1795: 	sub start_insert {
 1796: 	    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
 1797:             my $currentstring = '';
 1798:             if ($target eq 'web') {
 1799: 		my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval);
 1800: 	       $currentstring .= '<b>'.$display.'</b>';;
 1801: 	    }
 1802:            return $currentstring;
 1803: 	}
 1804:         sub end_insert {
 1805: 	    my ($target,$token) = @_;
 1806:             my $currentstring = '';
 1807:             if ($target eq 'web') {
 1808: 	       $currentstring .= '';
 1809: 	    }
 1810:            return $currentstring;
 1811: 	}
 1812: #-- <externallink>
 1813: 	sub start_externallink {
 1814: 	    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
 1815:             my $currentstring = '';
 1816:             if ($target eq 'web') {
 1817: 		my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval);
 1818: 	       $currentstring .= '<b>'.$display.'</b>';;
 1819: 	    }
 1820:            return $currentstring;
 1821: 	}
 1822:         sub end_externallink {
 1823: 	    my ($target,$token) = @_;
 1824:             my $currentstring = '';
 1825:             if ($target eq 'web') {
 1826: 	       $currentstring .= '';
 1827: 	    }
 1828:            return $currentstring;
 1829: 	}
 1830: #-- <blankspace heigth="">
 1831:         sub start_blankspace {
 1832: 	    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
 1833:             my $currentstring = '';
 1834:             if ($target eq 'tex') {
 1835: 		my $howmuch = &Apache::lonxml::get_param('heigth',$parstack,$safeeval);
 1836: 		$currentstring .= '\vskip '.$howmuch.' ';
 1837: 	    }
 1838:            return $currentstring;
 1839: 	}
 1840:         sub end_blankspace {
 1841: 	    my ($target,$token) = @_;
 1842:             my $currentstring = '';
 1843:             if ($target eq 'tex') {
 1844: 	       $currentstring .= '';
 1845: 	    }
 1846:            return $currentstring;
 1847: 	}
 1848: #-- <abbr> tag
 1849:       sub start_abbr {
 1850: 	    my ($target,$token) = @_;
 1851:             my $currentstring = '';
 1852:             if ($target eq 'web') {
 1853:               $currentstring = $token->[4];     
 1854: 	    } 
 1855: 	   return $currentstring;
 1856: 	}
 1857:         sub end_abbr {
 1858: 	    my ($target,$token) = @_;
 1859:             my $currentstring = '';
 1860:             if ($target eq 'web') {
 1861:               $currentstring = $token->[2];    
 1862:             } 
 1863: 	   return $currentstring;
 1864: 	}
 1865: #-- <acronym> tag
 1866:       sub start_acronym {
 1867: 	    my ($target,$token) = @_;
 1868:             my $currentstring = '';
 1869:             if ($target eq 'web') {
 1870:               $currentstring = $token->[4];     
 1871: 	    } 
 1872: 	   return $currentstring;
 1873: 	}
 1874:         sub end_acronym {
 1875: 	    my ($target,$token) = @_;
 1876:             my $currentstring = '';
 1877:             if ($target eq 'web') {
 1878:               $currentstring = $token->[2];    
 1879:             } 
 1880: 	   return $currentstring;
 1881: 	}
 1882: #-- <area> tag
 1883:       sub start_area {
 1884: 	    my ($target,$token) = @_;
 1885:             my $currentstring = '';
 1886:             if ($target eq 'web') {
 1887:               $currentstring = $token->[4];     
 1888: 	    } 
 1889: 	   return $currentstring;
 1890: 	}
 1891:         sub end_area {
 1892: 	    my ($target,$token) = @_;
 1893:             my $currentstring = '';
 1894:             if ($target eq 'web') {
 1895:               $currentstring = $token->[2];    
 1896:             } 
 1897: 	   return $currentstring;
 1898: 	}
 1899: #-- <base> tag
 1900:       sub start_base {
 1901: 	    my ($target,$token) = @_;
 1902:             my $currentstring = '';
 1903:             if ($target eq 'web') {
 1904:               $currentstring = $token->[4];     
 1905: 	    } 
 1906: 	   return $currentstring;
 1907: 	}
 1908:         sub end_base {
 1909: 	    my ($target,$token) = @_;
 1910:             my $currentstring = '';
 1911:             if ($target eq 'web') {
 1912:               $currentstring = $token->[2];    
 1913:             } 
 1914: 	   return $currentstring;
 1915: 	}
 1916: #-- <bdo> tag
 1917:       sub start_bdo {
 1918: 	    my ($target,$token) = @_;
 1919:             my $currentstring = '';
 1920:             if ($target eq 'web') {
 1921:               $currentstring = $token->[4];     
 1922: 	    } 
 1923: 	   return $currentstring;
 1924: 	}
 1925:         sub end_bdo {
 1926: 	    my ($target,$token) = @_;
 1927:             my $currentstring = '';
 1928:             if ($target eq 'web') {
 1929:               $currentstring = $token->[2];    
 1930:             } 
 1931: 	   return $currentstring;
 1932: 	}
 1933: #-- <bgsound> tag
 1934:       sub start_bgsound {
 1935: 	    my ($target,$token) = @_;
 1936:             my $currentstring = '';
 1937:             if ($target eq 'web') {
 1938:               $currentstring = $token->[4];     
 1939: 	    } 
 1940: 	   return $currentstring;
 1941: 	}
 1942:         sub end_bgsound {
 1943: 	    my ($target,$token) = @_;
 1944:             my $currentstring = '';
 1945:             if ($target eq 'web') {
 1946:               $currentstring = $token->[2];    
 1947:             } 
 1948: 	   return $currentstring;
 1949: 	}
 1950: #-- <blink> tag
 1951:       sub start_blink {
 1952: 	    my ($target,$token) = @_;
 1953:             my $currentstring = '';
 1954:             if ($target eq 'web') {
 1955:               $currentstring = $token->[4];     
 1956: 	    } 
 1957: 	   return $currentstring;
 1958: 	}
 1959:         sub end_blink {
 1960: 	    my ($target,$token) = @_;
 1961:             my $currentstring = '';
 1962:             if ($target eq 'web') {
 1963:               $currentstring = $token->[2];    
 1964:             } 
 1965: 	   return $currentstring;
 1966: 	}
 1967: #-- <blockquote> tag
 1968:       sub start_blockquote {
 1969: 	    my ($target,$token) = @_;
 1970:             my $currentstring = '';
 1971:             if ($target eq 'web') {
 1972:               $currentstring = $token->[4];     
 1973: 	    } 
 1974: 	   return $currentstring;
 1975: 	}
 1976:         sub end_blockquote {
 1977: 	    my ($target,$token) = @_;
 1978:             my $currentstring = '';
 1979:             if ($target eq 'web') {
 1980:               $currentstring = $token->[2];    
 1981:             } 
 1982: 	   return $currentstring;
 1983: 	}
 1984: #-- <button> tag
 1985:       sub start_button {
 1986: 	    my ($target,$token) = @_;
 1987:             my $currentstring = '';
 1988:             if ($target eq 'web') {
 1989:               $currentstring = $token->[4];     
 1990: 	    } 
 1991: 	   return $currentstring;
 1992: 	}
 1993:         sub end_button {
 1994: 	    my ($target,$token) = @_;
 1995:             my $currentstring = '';
 1996:             if ($target eq 'web') {
 1997:               $currentstring = $token->[2];    
 1998:             } 
 1999: 	   return $currentstring;
 2000: 	}
 2001: #-- <caption> tag
 2002:       sub start_caption {
 2003: 	    my ($target,$token) = @_;
 2004:             my $currentstring = '';
 2005:             if ($target eq 'web') {
 2006:               $currentstring = $token->[4];     
 2007: 	    } 
 2008: 	   return $currentstring;
 2009: 	}
 2010:         sub end_caption {
 2011: 	    my ($target,$token) = @_;
 2012:             my $currentstring = '';
 2013:             if ($target eq 'web') {
 2014:               $currentstring = $token->[2];    
 2015:             } 
 2016: 	   return $currentstring;
 2017: 	}
 2018: #-- <col> tag
 2019:       sub start_col {
 2020: 	    my ($target,$token) = @_;
 2021:             my $currentstring = '';
 2022:             if ($target eq 'web') {
 2023:               $currentstring = $token->[4];     
 2024: 	    } 
 2025: 	   return $currentstring;
 2026: 	}
 2027:         sub end_col {
 2028: 	    my ($target,$token) = @_;
 2029:             my $currentstring = '';
 2030:             if ($target eq 'web') {
 2031:               $currentstring = $token->[2];    
 2032:             } 
 2033: 	   return $currentstring;
 2034: 	}
 2035: #-- <colgroup> tag
 2036:       sub start_colgroup {
 2037: 	    my ($target,$token) = @_;
 2038:             my $currentstring = '';
 2039:             if ($target eq 'web') {
 2040:               $currentstring = $token->[4];     
 2041: 	    } 
 2042: 	   return $currentstring;
 2043: 	}
 2044:         sub end_colgroup {
 2045: 	    my ($target,$token) = @_;
 2046:             my $currentstring = '';
 2047:             if ($target eq 'web') {
 2048:               $currentstring = $token->[2];    
 2049:             } 
 2050: 	   return $currentstring;
 2051: 	}
 2052: #-- <del> tag
 2053:       sub start_del {
 2054: 	    my ($target,$token) = @_;
 2055:             my $currentstring = '';
 2056:             if ($target eq 'web') {
 2057:               $currentstring = $token->[4];     
 2058: 	    } 
 2059: 	   return $currentstring;
 2060: 	}
 2061:         sub end_del {
 2062: 	    my ($target,$token) = @_;
 2063:             my $currentstring = '';
 2064:             if ($target eq 'web') {
 2065:               $currentstring = $token->[2];    
 2066:             } 
 2067: 	   return $currentstring;
 2068: 	}
 2069: #-- <fieldset> tag
 2070:       sub start_fieldset {
 2071: 	    my ($target,$token) = @_;
 2072:             my $currentstring = '';
 2073:             if ($target eq 'web') {
 2074:               $currentstring = $token->[4];     
 2075: 	    } 
 2076: 	   return $currentstring;
 2077: 	}
 2078:         sub end_fieldset {
 2079: 	    my ($target,$token) = @_;
 2080:             my $currentstring = '';
 2081:             if ($target eq 'web') {
 2082:               $currentstring = $token->[2];    
 2083:             } 
 2084: 	   return $currentstring;
 2085: 	}
 2086: #-- <frame> tag
 2087:       sub start_frame {
 2088: 	    my ($target,$token) = @_;
 2089:             my $currentstring = '';
 2090:             if ($target eq 'web') {
 2091:               $currentstring = $token->[4];     
 2092: 	    } 
 2093: 	   return $currentstring;
 2094: 	}
 2095:         sub end_frame {
 2096: 	    my ($target,$token) = @_;
 2097:             my $currentstring = '';
 2098:             if ($target eq 'web') {
 2099:               $currentstring = $token->[2];    
 2100:             } 
 2101: 	   return $currentstring;
 2102: 	}
 2103: #-- <iframe> tag
 2104:       sub start_iframe {
 2105: 	    my ($target,$token) = @_;
 2106:             my $currentstring = '';
 2107:             if ($target eq 'web') {
 2108:               $currentstring = $token->[4];     
 2109: 	    } 
 2110: 	   return $currentstring;
 2111: 	}
 2112:         sub end_iframe {
 2113: 	    my ($target,$token) = @_;
 2114:             my $currentstring = '';
 2115:             if ($target eq 'web') {
 2116:               $currentstring = $token->[2];    
 2117:             } 
 2118: 	   return $currentstring;
 2119: 	}
 2120: #-- <ins> tag
 2121:       sub start_ins {
 2122: 	    my ($target,$token) = @_;
 2123:             my $currentstring = '';
 2124:             if ($target eq 'web') {
 2125:               $currentstring = $token->[4];     
 2126: 	    } 
 2127: 	   return $currentstring;
 2128: 	}
 2129:         sub end_ins {
 2130: 	    my ($target,$token) = @_;
 2131:             my $currentstring = '';
 2132:             if ($target eq 'web') {
 2133:               $currentstring = $token->[2];    
 2134:             } 
 2135: 	   return $currentstring;
 2136: 	}
 2137: #-- <isindex> tag
 2138:       sub start_isindex {
 2139: 	    my ($target,$token) = @_;
 2140:             my $currentstring = '';
 2141:             if ($target eq 'web') {
 2142:               $currentstring = $token->[4];     
 2143: 	    } 
 2144: 	   return $currentstring;
 2145: 	}
 2146:         sub end_isindex {
 2147: 	    my ($target,$token) = @_;
 2148:             my $currentstring = '';
 2149:             if ($target eq 'web') {
 2150:               $currentstring = $token->[2];    
 2151:             } 
 2152: 	   return $currentstring;
 2153: 	}
 2154: #-- <keygen> tag
 2155:       sub start_keygen {
 2156: 	    my ($target,$token) = @_;
 2157:             my $currentstring = '';
 2158:             if ($target eq 'web') {
 2159:               $currentstring = $token->[4];     
 2160: 	    } 
 2161: 	   return $currentstring;
 2162: 	}
 2163:         sub end_keygen {
 2164: 	    my ($target,$token) = @_;
 2165:             my $currentstring = '';
 2166:             if ($target eq 'web') {
 2167:               $currentstring = $token->[2];    
 2168:             } 
 2169: 	   return $currentstring;
 2170: 	}
 2171: #-- <label> tag
 2172:       sub start_label {
 2173: 	    my ($target,$token) = @_;
 2174:             my $currentstring = '';
 2175:             if ($target eq 'web') {
 2176:               $currentstring = $token->[4];     
 2177: 	    } 
 2178: 	   return $currentstring;
 2179: 	}
 2180:         sub end_label {
 2181: 	    my ($target,$token) = @_;
 2182:             my $currentstring = '';
 2183:             if ($target eq 'web') {
 2184:               $currentstring = $token->[2];    
 2185:             } 
 2186: 	   return $currentstring;
 2187: 	}
 2188: #-- <layer> tag
 2189:       sub start_layer {
 2190: 	    my ($target,$token) = @_;
 2191:             my $currentstring = '';
 2192:             if ($target eq 'web') {
 2193:               $currentstring = $token->[4];     
 2194: 	    } 
 2195: 	   return $currentstring;
 2196: 	}
 2197:         sub end_layer {
 2198: 	    my ($target,$token) = @_;
 2199:             my $currentstring = '';
 2200:             if ($target eq 'web') {
 2201:               $currentstring = $token->[2];    
 2202:             } 
 2203: 	   return $currentstring;
 2204: 	}
 2205: #-- <legend> tag
 2206:       sub start_legend {
 2207: 	    my ($target,$token) = @_;
 2208:             my $currentstring = '';
 2209:             if ($target eq 'web') {
 2210:               $currentstring = $token->[4];     
 2211: 	    } 
 2212: 	   return $currentstring;
 2213: 	}
 2214:         sub end_legend {
 2215: 	    my ($target,$token) = @_;
 2216:             my $currentstring = '';
 2217:             if ($target eq 'web') {
 2218:               $currentstring = $token->[2];    
 2219:             } 
 2220: 	   return $currentstring;
 2221: 	}
 2222: #-- <link> tag
 2223:       sub start_link {
 2224: 	    my ($target,$token) = @_;
 2225:             my $currentstring = '';
 2226:             if ($target eq 'web') {
 2227:               $currentstring = $token->[4];     
 2228: 	    } 
 2229: 	   return $currentstring;
 2230: 	}
 2231:         sub end_link {
 2232: 	    my ($target,$token) = @_;
 2233:             my $currentstring = '';
 2234:             if ($target eq 'web') {
 2235:               $currentstring = $token->[2];    
 2236:             } 
 2237: 	   return $currentstring;
 2238: 	}
 2239: #-- <marquee> tag
 2240:       sub start_marquee {
 2241: 	    my ($target,$token) = @_;
 2242:             my $currentstring = '';
 2243:             if ($target eq 'web') {
 2244:               $currentstring = $token->[4];     
 2245: 	    } 
 2246: 	   return $currentstring;
 2247: 	}
 2248:         sub end_marquee {
 2249: 	    my ($target,$token) = @_;
 2250:             my $currentstring = '';
 2251:             if ($target eq 'web') {
 2252:               $currentstring = $token->[2];    
 2253:             } 
 2254: 	   return $currentstring;
 2255: 	}
 2256: #-- <malticol> tag
 2257:       sub start_malticol {
 2258: 	    my ($target,$token) = @_;
 2259:             my $currentstring = '';
 2260:             if ($target eq 'web') {
 2261:               $currentstring = $token->[4];     
 2262: 	    } 
 2263: 	   return $currentstring;
 2264: 	}
 2265:         sub end_malticol {
 2266: 	    my ($target,$token) = @_;
 2267:             my $currentstring = '';
 2268:             if ($target eq 'web') {
 2269:               $currentstring = $token->[2];    
 2270:             } 
 2271: 	   return $currentstring;
 2272: 	}
 2273: #-- <nobr> tag
 2274:       sub start_nobr {
 2275: 	    my ($target,$token) = @_;
 2276:             my $currentstring = '';
 2277:             if ($target eq 'web') {
 2278:               $currentstring = $token->[4];     
 2279: 	    } 
 2280: 	   return $currentstring;
 2281: 	}
 2282:         sub end_nobr {
 2283: 	    my ($target,$token) = @_;
 2284:             my $currentstring = '';
 2285:             if ($target eq 'web') {
 2286:               $currentstring = $token->[2];    
 2287:             } 
 2288: 	   return $currentstring;
 2289: 	}
 2290: #-- <noembed> tag
 2291:       sub start_noembed {
 2292: 	    my ($target,$token) = @_;
 2293:             my $currentstring = '';
 2294:             if ($target eq 'web') {
 2295:               $currentstring = $token->[4];     
 2296: 	    } 
 2297: 	   return $currentstring;
 2298: 	}
 2299:         sub end_noembed {
 2300: 	    my ($target,$token) = @_;
 2301:             my $currentstring = '';
 2302:             if ($target eq 'web') {
 2303:               $currentstring = $token->[2];    
 2304:             } 
 2305: 	   return $currentstring;
 2306: 	}
 2307: #-- <noframes> tag
 2308:       sub start_noframes {
 2309: 	    my ($target,$token) = @_;
 2310:             my $currentstring = '';
 2311:             if ($target eq 'web') {
 2312:               $currentstring = $token->[4];     
 2313: 	    } 
 2314: 	   return $currentstring;
 2315: 	}
 2316:         sub end_noframes {
 2317: 	    my ($target,$token) = @_;
 2318:             my $currentstring = '';
 2319:             if ($target eq 'web') {
 2320:               $currentstring = $token->[2];    
 2321:             } 
 2322: 	   return $currentstring;
 2323: 	}
 2324: #-- <nolayer> tag
 2325:       sub start_nolayer {
 2326: 	    my ($target,$token) = @_;
 2327:             my $currentstring = '';
 2328:             if ($target eq 'web') {
 2329:               $currentstring = $token->[4];     
 2330: 	    } 
 2331: 	   return $currentstring;
 2332: 	}
 2333:         sub end_nolayer {
 2334: 	    my ($target,$token) = @_;
 2335:             my $currentstring = '';
 2336:             if ($target eq 'web') {
 2337:               $currentstring = $token->[2];    
 2338:             } 
 2339: 	   return $currentstring;
 2340: 	}
 2341: #-- <noscript> tag
 2342:       sub start_noscript {
 2343: 	    my ($target,$token) = @_;
 2344:             my $currentstring = '';
 2345:             if ($target eq 'web') {
 2346:               $currentstring = $token->[4];     
 2347: 	    } 
 2348: 	   return $currentstring;
 2349: 	}
 2350:         sub end_noscript {
 2351: 	    my ($target,$token) = @_;
 2352:             my $currentstring = '';
 2353:             if ($target eq 'web') {
 2354:               $currentstring = $token->[2];    
 2355:             } 
 2356: 	   return $currentstring;
 2357: 	}
 2358: #-- <object> tag
 2359:       sub start_object {
 2360: 	    my ($target,$token) = @_;
 2361:             my $currentstring = '';
 2362:             if ($target eq 'web') {
 2363:               $currentstring = $token->[4];     
 2364: 	    } 
 2365: 	   return $currentstring;
 2366: 	}
 2367:         sub end_object {
 2368: 	    my ($target,$token) = @_;
 2369:             my $currentstring = '';
 2370:             if ($target eq 'web') {
 2371:               $currentstring = $token->[2];    
 2372:             } 
 2373: 	   return $currentstring;
 2374: 	}
 2375: #-- <optgroup> tag
 2376:       sub start_optgroup {
 2377: 	    my ($target,$token) = @_;
 2378:             my $currentstring = '';
 2379:             if ($target eq 'web') {
 2380:               $currentstring = $token->[4];     
 2381: 	    } 
 2382: 	   return $currentstring;
 2383: 	}
 2384:         sub end_optgroup {
 2385: 	    my ($target,$token) = @_;
 2386:             my $currentstring = '';
 2387:             if ($target eq 'web') {
 2388:               $currentstring = $token->[2];    
 2389:             } 
 2390: 	   return $currentstring;
 2391: 	}
 2392: #-- <samp> tag
 2393:       sub start_samp {
 2394: 	    my ($target,$token) = @_;
 2395:             my $currentstring = '';
 2396:             if ($target eq 'web') {
 2397:               $currentstring = $token->[4];     
 2398: 	    } 
 2399: 	   return $currentstring;
 2400: 	}
 2401:         sub end_samp {
 2402: 	    my ($target,$token) = @_;
 2403:             my $currentstring = '';
 2404:             if ($target eq 'web') {
 2405:               $currentstring = $token->[2];    
 2406:             } 
 2407: 	   return $currentstring;
 2408: 	}
 2409: #-- <server> tag
 2410:       sub start_server {
 2411: 	    my ($target,$token) = @_;
 2412:             my $currentstring = '';
 2413:             if ($target eq 'web') {
 2414:               $currentstring = $token->[4];     
 2415: 	    } 
 2416: 	   return $currentstring;
 2417: 	}
 2418:         sub end_server {
 2419: 	    my ($target,$token) = @_;
 2420:             my $currentstring = '';
 2421:             if ($target eq 'web') {
 2422:               $currentstring = $token->[2];    
 2423:             } 
 2424: 	   return $currentstring;
 2425: 	}
 2426: #-- <spacer> tag
 2427:       sub start_spacer {
 2428: 	    my ($target,$token) = @_;
 2429:             my $currentstring = '';
 2430:             if ($target eq 'web') {
 2431:               $currentstring = $token->[4];     
 2432: 	    } 
 2433: 	   return $currentstring;
 2434: 	}
 2435:         sub end_spacer {
 2436: 	    my ($target,$token) = @_;
 2437:             my $currentstring = '';
 2438:             if ($target eq 'web') {
 2439:               $currentstring = $token->[2];    
 2440:             } 
 2441: 	   return $currentstring;
 2442: 	}
 2443: #-- <span> tag
 2444:       sub start_span {
 2445: 	    my ($target,$token) = @_;
 2446:             my $currentstring = '';
 2447:             if ($target eq 'web') {
 2448:               $currentstring = $token->[4];     
 2449: 	    } 
 2450: 	   return $currentstring;
 2451: 	}
 2452:         sub end_span {
 2453: 	    my ($target,$token) = @_;
 2454:             my $currentstring = '';
 2455:             if ($target eq 'web') {
 2456:               $currentstring = $token->[2];    
 2457:             } 
 2458: 	   return $currentstring;
 2459: 	}
 2460: #-- <tbody> tag
 2461:       sub start_tbody {
 2462: 	    my ($target,$token) = @_;
 2463:             my $currentstring = '';
 2464:             if ($target eq 'web') {
 2465:               $currentstring = $token->[4];     
 2466: 	    } 
 2467: 	   return $currentstring;
 2468: 	}
 2469:         sub end_tbody {
 2470: 	    my ($target,$token) = @_;
 2471:             my $currentstring = '';
 2472:             if ($target eq 'web') {
 2473:               $currentstring = $token->[2];    
 2474:             } 
 2475: 	   return $currentstring;
 2476: 	}
 2477: #-- <tfoot> tag
 2478:       sub start_tfoot {
 2479: 	    my ($target,$token) = @_;
 2480:             my $currentstring = '';
 2481:             if ($target eq 'web') {
 2482:               $currentstring = $token->[4];     
 2483: 	    } 
 2484: 	   return $currentstring;
 2485: 	}
 2486:         sub end_tfoot {
 2487: 	    my ($target,$token) = @_;
 2488:             my $currentstring = '';
 2489:             if ($target eq 'web') {
 2490:               $currentstring = $token->[2];    
 2491:             } 
 2492: 	   return $currentstring;
 2493: 	}
 2494: #-- <thead> tag
 2495:       sub start_thead {
 2496: 	    my ($target,$token) = @_;
 2497:             my $currentstring = '';
 2498:             if ($target eq 'web') {
 2499:               $currentstring = $token->[4];     
 2500: 	    } 
 2501: 	   return $currentstring;
 2502: 	}
 2503:         sub end_thead {
 2504: 	    my ($target,$token) = @_;
 2505:             my $currentstring = '';
 2506:             if ($target eq 'web') {
 2507:               $currentstring = $token->[2];    
 2508:             } 
 2509: 	   return $currentstring;
 2510: 	}
 2511: #-- <var> tag
 2512:       sub start_var {
 2513: 	    my ($target,$token) = @_;
 2514:             my $currentstring = '';
 2515:             if ($target eq 'web') {
 2516:               $currentstring = $token->[4];     
 2517: 	    } 
 2518: 	   return $currentstring;
 2519: 	}
 2520:         sub end_var {
 2521: 	    my ($target,$token) = @_;
 2522:             my $currentstring = '';
 2523:             if ($target eq 'web') {
 2524:               $currentstring = $token->[2];    
 2525:             } 
 2526: 	   return $currentstring;
 2527: 	}
 2528: #-- <wbr> tag
 2529:       sub start_wbr {
 2530: 	    my ($target,$token) = @_;
 2531:             my $currentstring = '';
 2532:             if ($target eq 'web') {
 2533:               $currentstring = $token->[4];     
 2534: 	    } 
 2535: 	   return $currentstring;
 2536: 	}
 2537:         sub end_wbr {
 2538: 	    my ($target,$token) = @_;
 2539:             my $currentstring = '';
 2540:             if ($target eq 'web') {
 2541:               $currentstring = $token->[2];    
 2542:             } 
 2543: 	   return $currentstring;
 2544: 	}
 2545: 
 2546: sub image_replication {
 2547:     my $src = shift;
 2548:     if (not -e '/home/httpd/html'.$src) {
 2549: 	#replicates image itself
 2550: 	&Apache::lonnet::repcopy('/home/httpd/html'.$src);
 2551: 	#replicates eps or ps 
 2552: 	my $newsrc = $src;
 2553: 	$newsrc =~ s/(.gif|.jpg)$/.eps/;
 2554: 	if (not-e $newsrc && &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc) ne 'OK') {
 2555: 	    $newsrc =~ s/\.ps$/\.eps/;
 2556: 	    &Apache::lonnet::repcopy('/home/httpd/html'.$newsrc);
 2557: 	}
 2558:     }
 2559:     return '';
 2560: }
 2561: 
 2562: 1;
 2563: __END__

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