File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.122: download - view: text, annotated - select for diffs
Tue Mar 18 15:32:15 2003 UTC (21 years, 2 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- this needed to happen a while ago

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

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