File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.119: download - view: text, annotated - select for diffs
Thu Feb 20 17:07:14 2003 UTC (21 years, 3 months ago) by www
Branches: MAIN
CVS tags: HEAD
Attempts to address the following earlier changes:

* switching the parser from HTML to XML mode. Parameters can now be lower-
and uppercase. Switching over to calling lonxml-routine rather than
$token->[2]->{'something'}

* switching of file references from always forcing absolute references
('/res/...') to allow relative URLs ('../stuff.gif')

Probably still a long ways to go to adapt all of this.

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

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