File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.113: download - view: text, annotated - select for diffs
Fri Feb 14 19:35:55 2003 UTC (21 years, 3 months ago) by www
Branches: MAIN
CVS tags: HEAD
A lot of things happened here:

* everything menu-related was moved out of lonxml, and into lonmenu
* thus, function calls to registerurl, loadevents and unloadevents modified
* fixed lontex.pm, which actually did not call the right routines
* put in calls to lonmenu::menubuttons, which is supposed to insert buttons
  after the body tag in "textual mode" - this function and registerurl will
  be unified (buttons either in Remote or on top of page)

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

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