File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.34: download - view: text, annotated - select for diffs
Thu Nov 29 19:03:58 2001 UTC (22 years, 5 months ago) by www
Branches: MAIN
CVS tags: HEAD
GPL

    1: # The LearningOnline Network with CAPA
    2: # Tags Default Definition Module 
    3: #
    4: # $Id: londefdef.pm,v 1.34 2001/11/29 19:03:58 www Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: # Copyright for TtHfunc and TtMfunc by Ian Hutchinson. 
   29: # TtHfunc and TtMfunc (the "Code") may be compiled and linked into 
   30: # binary executable programs or libraries distributed by the 
   31: # Michigan State University (the "Licensee"), but any binaries so 
   32: # distributed are hereby licensed only for use in the context
   33: # of a program or computational system for which the Licensee is the 
   34: # primary author or distributor, and which performs substantial 
   35: # additional tasks beyond the translation of (La)TeX into HTML.
   36: # The C source of the Code may not be distributed by the Licensee
   37: # to any other parties under any circumstances.
   38: #
   39: #
   40: # last modified 06/26/00 by Alexander Sakharuk
   41: # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer
   42: 
   43: package Apache::londefdef; 
   44: 
   45: use strict;
   46: use Apache::lonxml;
   47: 
   48: sub BEGIN {
   49: 
   50:     &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','select','option','input','textarea','form','meta','title','body','center','b','strong','table','dt','h1','h2','h3','h4','h5','h6','cite','i','address','dd','dl','dir','ol','ul','menu','dfn','kbd','tt','code','em','q','p','br','big','small','basefont','font','s','sub','strike','sup','hr','a','li','u','output','param','applet','img','embed','tr','td','allow','frameset'));
   51: 
   52: }
   53: 
   54: #===================================================================== TAG SUBROUTINES
   55: #-- <output>
   56: sub start_output {
   57:   my ($target) = @_;
   58:   if ($target eq 'meta') { $Apache::lonxml::metamode--; }
   59:   return '';
   60: }
   61: sub end_output {
   62:   my ($target) = @_;
   63:   if ($target eq 'meta') { $Apache::lonxml::metamode++; }
   64:   return '';
   65: }
   66: #-- <m> tag
   67: sub start_m {
   68:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
   69:   my $currentstring = '';
   70:   if ($target eq 'web') {
   71:     my $inside = &Apache::lonxml::get_all_text("/m",$$parser[-1]);
   72:     $inside ='\\documentstyle{article}'.$inside;
   73:     #&Apache::lonxml::debug("M is starting with:$inside:");
   74:     my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
   75:     if ($eval eq 'on') {
   76:       $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
   77:       #&Apache::lonxml::debug("M is evaulated to:$inside:");
   78:     }
   79:     $currentstring = &Apache::lontexconvert::converted(\$inside);
   80:     #&Apache::lonxml::debug("M is ends with:$currentstring:");
   81:   } elsif ($target eq 'tex') {
   82:     $currentstring = "";
   83:   }
   84:   return $currentstring;
   85: }
   86: sub end_m {
   87:   my ($target,$token) = @_;
   88:   my $currentstring = '';
   89:   if ($target eq 'web') {
   90:   } elsif ($target eq 'tex') {
   91:     $currentstring = "";
   92:   } elsif ($target eq 'meta') {
   93:   }
   94:   return $currentstring;
   95: }
   96: #-------------------------------------------------------------------------- <html> tag    
   97:       sub start_html {
   98: 	    my ($target,$token) = @_;
   99:             my $currentstring = '';
  100:             if ($target eq 'web') {
  101:               $currentstring = &Apache::lonxml::xmlbegin().
  102:                                &Apache::lonxml::fontsettings();     
  103: 	    } 
  104: 	   return $currentstring;
  105: 	}
  106:         sub end_html {
  107: 	    my ($target,$token) = @_;
  108:             my $currentstring = '';
  109:             if ($target eq 'web') {
  110: 		$currentstring = &Apache::lonxml::xmlend();
  111:             } 
  112: 	   return $currentstring;
  113: 	}
  114: #-------------------------------------------------------------------------- <head> tag
  115:       sub start_head {
  116: 	    my ($target,$token) = @_;
  117:             my $currentstring = '';
  118:             if ($target eq 'web') {
  119:               $currentstring = $token->[4];     
  120: 	    } 
  121: 	   return $currentstring;
  122: 	}
  123:         sub end_head {
  124: 	    my ($target,$token) = @_;
  125:             my $currentstring = '';
  126:             if ($target eq 'web') {
  127:               $currentstring = &Apache::lonxml::registerurl().
  128:                                $token->[2];    
  129:             } 
  130: 	   return $currentstring;
  131: 	}
  132: #--------------------------------------------------------------------------- <map> tag
  133:       sub start_map {
  134: 	    my ($target,$token) = @_;
  135:             my $currentstring = '';
  136:             if ($target eq 'web') {
  137:               $currentstring = $token->[4];     
  138: 	    } 
  139: 	   return $currentstring;
  140: 	}
  141:         sub end_map {
  142: 	    my ($target,$token) = @_;
  143:             my $currentstring = '';
  144:             if ($target eq 'web') {
  145:               $currentstring = $token->[2];    
  146:             } 
  147: 	   return $currentstring;
  148: 	}
  149: 
  150: #------------------------------------------------------------------------ <select> tag
  151:       sub start_select {
  152: 	    my ($target,$token) = @_;
  153:             my $currentstring = '';
  154:             if ($target eq 'web') {
  155:               $currentstring = $token->[4];     
  156: 	    } 
  157: 	   return $currentstring;
  158: 	}
  159:         sub end_select {
  160: 	    my ($target,$token) = @_;
  161:             my $currentstring = '';
  162:             if ($target eq 'web') {
  163:               $currentstring = $token->[2];    
  164:             } 
  165: 	   return $currentstring;
  166: 	}
  167: #------------------------------------------------------------------------ <option> tag
  168:       sub start_option {
  169: 	    my ($target,$token) = @_;
  170:             my $currentstring = '';
  171:             if ($target eq 'web') {
  172:               $currentstring = $token->[4];     
  173: 	    } 
  174: 	   return $currentstring;
  175: 	}
  176:         sub end_option {
  177: 	    my ($target,$token) = @_;
  178:             my $currentstring = '';
  179:             if ($target eq 'web') {
  180:               $currentstring = $token->[2];    
  181:             } 
  182: 	   return $currentstring;
  183: 	}
  184: #------------------------------------------------------------------------- <input> tag
  185:       sub start_input {
  186: 	    my ($target,$token) = @_;
  187:             my $currentstring = '';
  188:             if ($target eq 'web') {
  189:               $currentstring = $token->[4];     
  190: 	    } 
  191: 	   return $currentstring;
  192: 	}
  193:         sub end_input {
  194: 	    my ($target,$token) = @_;
  195:             my $currentstring = '';
  196:             if ($target eq 'web') {
  197:               $currentstring = $token->[2];    
  198:             } 
  199: 	   return $currentstring;
  200: 	}
  201: #---------------------------------------------------------------------- <textarea> tag
  202:       sub start_textarea {
  203: 	    my ($target,$token) = @_;
  204:             my $currentstring = '';
  205:             if ($target eq 'web') {
  206:               $currentstring = $token->[4];     
  207: 	    } 
  208: 	   return $currentstring;
  209: 	}
  210:         sub end_textarea {
  211: 	    my ($target,$token) = @_;
  212:             my $currentstring = '';
  213:             if ($target eq 'web') {
  214:               $currentstring = $token->[2];    
  215:             } 
  216: 	   return $currentstring;
  217: 	}
  218: #-------------------------------------------------------------------------- <form> tag
  219:       sub start_form {
  220: 	    my ($target,$token) = @_;
  221:             my $currentstring = '';
  222:             if ($target eq 'web') {
  223:               $currentstring = $token->[4];     
  224: 	    } 
  225: 	   return $currentstring;
  226: 	}
  227:         sub end_form {
  228: 	    my ($target,$token) = @_;
  229:             my $currentstring = '';
  230:             if ($target eq 'web') {
  231:               $currentstring = $token->[2];    
  232:             } 
  233: 	   return $currentstring;
  234: 	}
  235: #------------------------------------------------------------------------- <title> tag
  236:       sub start_title {
  237: 	    my ($target,$token) = @_;
  238:             my $currentstring = '';
  239:             if ($target eq 'web') {
  240:               $currentstring = $token->[4];     
  241: 	    }
  242:             if ($target eq 'meta') {
  243: 		$currentstring='<title>';
  244:                 &start_output();
  245:             }
  246: 	   return $currentstring;
  247: 	}
  248:         sub end_title {
  249: 	    my ($target,$token) = @_;
  250:             my $currentstring = '';
  251:             if ($target eq 'web') {
  252:               $currentstring = $token->[2];    
  253:             }
  254:             if ($target eq 'meta') {
  255:                &end_output();
  256:                $currentstring='</title>';
  257:             } 
  258: 	   return $currentstring;
  259: 	}
  260: #-------------------------------------------------------------------------- <meta> tag
  261:       sub start_meta {
  262: 	    my ($target,$token,$tagstack,$parstack,$parser) = @_;
  263:             my $currentstring = '';
  264:             if ($target eq 'web') {
  265: 	      my $args='';
  266: 	      if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
  267: 	      if ($args eq '') {
  268: 		&Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]);
  269: 	      } else {
  270: 		$currentstring = $token->[4];
  271: 	      }
  272: 	    }
  273:             if ($target eq 'meta') {
  274: 		unless ($token->[2]->{'http-equiv'}) {
  275: 		    my $name=$token->[2]->{'name'};
  276:                     $name=~tr/A-Z/a-z/;
  277:                     $name=~s/\s/\_/g;
  278:                     if ($name) {
  279:                        $currentstring='<'.$name.'>'.
  280:                                          $token->[2]->{'content'}.
  281: 			              '</'.$name.'>';
  282: 		    }
  283:                 }
  284: 	    }
  285: 	   return $currentstring;
  286: 	}
  287:       sub end_meta {
  288: 	my ($target,$token,$tagstack,$parstack,$parser) = @_;
  289: 	my $currentstring = '';
  290: 	if ($target eq 'web') {
  291: 	  my $args='';
  292: 	  if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
  293: 	  if ($args ne '') {
  294: 	    $currentstring = $token->[4];
  295: 	  }
  296: 	} 
  297: 	return $currentstring;
  298:       }
  299: #-------------------------------------------------------------------------- <body> tag
  300:         sub start_body {
  301: 	    my ($target,$token) = @_;
  302:             my $currentstring = '';
  303:             if ($target eq 'web') {
  304: 	      if (!$Apache::lonxml::registered) {
  305: 		$currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
  306: 	      }
  307: 	      my $onLoad='';
  308: 	      foreach my $key (keys(%{$token->[2]})) {
  309: 		if ($key =~ /^onload$/i) {
  310: 		  $onLoad.=$token->[2]->{$key}.';';
  311: 		  delete($token->[2]->{$key});
  312: 		}
  313: 	      }
  314: 	      $token->[2]->{'onLoad'}=$onLoad.&Apache::lonxml::loadevents();
  315: 	      my $onUnload='';
  316: 	      foreach my $key (keys(%{$token->[2]})) {
  317: 		if ($key =~ /^onunload$/i) {
  318: 		  $onUnload.=$token->[2]->{$key}.';';
  319: 		  delete($token->[2]->{$key});
  320: 		}
  321: 	      }
  322: 	      $token->[2]->{'onUnload'}=$onUnload.
  323: 		&Apache::lonxml::unloadevents();
  324: 
  325: 	      $currentstring .= '<'.$token->[1];
  326: 	      map {
  327: 		$currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
  328: 	      } keys %{$token->[2]};
  329: 	      $currentstring.='>';
  330:        	    } elsif ($target eq 'tex') {
  331:               $currentstring = " \\begin{document} ";  
  332: 	    } 
  333: 	   return $currentstring;
  334: 	}
  335:         sub end_body {
  336: 	    my ($target,$token) = @_;
  337:             my $currentstring = '';
  338:             if ($target eq 'web') {
  339:               $currentstring = $token->[2];     
  340: 	    } elsif ($target eq 'tex') {
  341:               $currentstring = " \\end{document}";  
  342: 	    } 
  343: 	   return $currentstring;
  344: 	}
  345: #------------------------------------------------------------------------ <center> tag
  346:         sub start_center {
  347: 	    my ($target,$token) = @_;
  348:             my $currentstring = '';
  349:             if ($target eq 'web') {
  350:               $currentstring = $token->[4];     
  351: 	    } elsif ($target eq 'tex') {
  352:               $currentstring = " \\begin{center} ";  
  353: 	    }  elsif ($target eq 'latexsource') {
  354:               $currentstring = " \\begin{center} ";  
  355: 	    } 
  356: 	   return $currentstring;
  357: 	}
  358:         sub end_center {
  359: 	    my ($target,$token) = @_;
  360:             my $currentstring = '';
  361:             if ($target eq 'web') {
  362:               $currentstring = $token->[2];     
  363: 	    } elsif ($target eq 'tex') {
  364:               $currentstring = " \\end{center}";  
  365: 	    }  elsif ($target eq 'latexsource') {
  366:               $currentstring = " \\end{center}";  
  367: 	    } 
  368: 	   return $currentstring;
  369: 	}
  370: #----------------------------------------------------------------------------- <b> tag
  371:         sub start_b {
  372: 	    my ($target,$token) = @_;
  373:             my $currentstring = '';
  374:             if ($target eq 'web') {
  375:               $currentstring = $token->[4];     
  376: 	    } elsif ($target eq 'tex') {
  377:               $currentstring = " \\textbf{";  
  378: 	    }  elsif ($target eq 'latexsource') {
  379:               $currentstring = " \\textbf{";  
  380: 	    } 
  381: 	   return $currentstring;
  382: 	}
  383:         sub end_b {
  384: 	    my ($target,$token) = @_;
  385:             my $currentstring = '';
  386:             if ($target eq 'web') {
  387:               $currentstring = $token->[2];     
  388: 	    } elsif ($target eq 'tex') {
  389:               $currentstring = "}";  
  390: 	    } elsif ($target eq 'latexsource') {
  391:               $currentstring = "}";  
  392: 	    } 
  393: 	   return $currentstring;
  394: 	}
  395: #------------------------------------------------------------------------ <strong> tag
  396:         sub start_strong {
  397: 	    my ($target,$token) = @_;
  398:             my $currentstring = '';
  399:             if ($target eq 'web') {
  400:               $currentstring = $token->[4];     
  401: 	    } elsif ($target eq 'tex') {
  402:               $currentstring = " \\textbf{";  
  403: 	    } elsif ($target eq 'latexsource') {
  404:               $currentstring = " \\textbf{";  
  405: 	    } 
  406: 	   return $currentstring;
  407: 	}
  408:         sub end_strong {
  409: 	    my ($target,$token) = @_;
  410:             my $currentstring = '';
  411:             if ($target eq 'web') {
  412: 
  413:               $currentstring = $token->[2];     
  414: 	    } elsif ($target eq 'tex') {
  415:               $currentstring = "}";  
  416: 	    }  elsif ($target eq 'latexsource') {
  417:               $currentstring = "}";  
  418: 	    } 
  419: 	   return $currentstring;
  420: 	}
  421: #---------------------------------------------------------------------------- <h1> tag
  422:         sub start_h1 {
  423: 	    my ($target,$token) = @_;
  424:             my $currentstring = '';
  425:             if ($target eq 'web') {
  426: 	       $currentstring .= $token->[4];
  427: 	    } elsif ($target eq 'tex') {
  428: 		$currentstring .= "\\chapter{ ";
  429: 	    } elsif ($target eq 'meta') {
  430: 		$currentstring='<subject>';
  431:                 &start_output();
  432:             }
  433:            return $currentstring;
  434: 	}
  435:         sub end_h1 {
  436: 	    my ($target,$token) = @_;
  437:             my $currentstring = '';
  438:             if ($target eq 'web') {
  439: 	       $currentstring .= $token->[2];
  440: 	    } elsif ($target eq 'tex') {
  441: 		$currentstring .= "}";
  442: 	    } elsif ($target eq 'meta') {
  443:                 &end_output();
  444: 		$currentstring='</subject>';
  445:             } 
  446:            return $currentstring;
  447: 	}
  448: #---------------------------------------------------------------------------- <h2> tag
  449:         sub start_h2 {
  450: 	    my ($target,$token) = @_;
  451:             my $currentstring = '';
  452:             if ($target eq 'web') {
  453: 	       $currentstring .= $token->[4];
  454: 	    } elsif ($target eq 'tex') {
  455: 		$currentstring .= "\\section{ ";
  456: 	    } 
  457:            return $currentstring;
  458: 	}
  459:         sub end_h2 {
  460: 	    my ($target,$token) = @_;
  461:             my $currentstring = '';
  462:             if ($target eq 'web') {
  463: 	       $currentstring .= $token->[2];
  464: 	    } elsif ($target eq 'tex') {
  465: 		$currentstring .= "}";
  466: 	    } 
  467:            return $currentstring;
  468: 	}
  469: #---------------------------------------------------------------------------- <h3> tag
  470:         sub start_h3 {
  471: 	    my ($target,$token) = @_;
  472:             my $currentstring = '';
  473:             if ($target eq 'web') {
  474: 	       $currentstring .= $token->[4];
  475: 	    } elsif ($target eq 'tex') {
  476: 		$currentstring .= "\\subsection{ ";
  477: 	    } 
  478:            return $currentstring;
  479: 	}
  480:         sub end_h3 {
  481: 	    my ($target,$token) = @_;
  482:             my $currentstring = '';
  483:             if ($target eq 'web') {
  484: 	       $currentstring .= $token->[2];
  485: 	    } elsif ($target eq 'tex') {
  486: 		$currentstring .= "}";
  487: 	    } 
  488:            return $currentstring;
  489: 	}
  490: #---------------------------------------------------------------------------- <h4> tag
  491:         sub start_h4 {
  492: 	    my ($target,$token) = @_;
  493:             my $currentstring = '';
  494:             if ($target eq 'web') {
  495: 	       $currentstring .= $token->[4];
  496: 	    } elsif ($target eq 'tex') {
  497: 		$currentstring .= "\\subsubsection{ ";
  498: 	    } 
  499:            return $currentstring;
  500: 	}
  501:         sub end_h4 {
  502: 	    my ($target,$token) = @_;
  503:             my $currentstring = '';
  504:             if ($target eq 'web') {
  505: 	       $currentstring .= $token->[2];
  506: 	    } elsif ($target eq 'tex') {
  507: 		$currentstring .= "}";
  508: 	    } 
  509:            return $currentstring;
  510: 	}
  511: #---------------------------------------------------------------------------- <h5> tag
  512:         sub start_h5 {
  513: 	    my ($target,$token) = @_;
  514:             my $currentstring = '';
  515:             if ($target eq 'web') {
  516: 	       $currentstring .= $token->[4];
  517: 	    } elsif ($target eq 'tex') {
  518: 		$currentstring .= "\\paragraph{ ";
  519: 	    } 
  520:            return $currentstring;
  521: 	}
  522:         sub end_h5 {
  523: 	    my ($target,$token) = @_;
  524:             my $currentstring = '';
  525:             if ($target eq 'web') {
  526: 	       $currentstring .= $token->[2];
  527: 	    } elsif ($target eq 'tex') {
  528: 		$currentstring .= "}";
  529: 	    } 
  530:            return $currentstring;
  531: 	}
  532: #---------------------------------------------------------------------------- <h6> tag
  533:         sub start_h6 {
  534: 	    my ($target,$token) = @_;
  535:             my $currentstring = '';
  536:             if ($target eq 'web') {
  537: 	       $currentstring .= $token->[4];
  538: 	    } elsif ($target eq 'tex') {
  539: 		$currentstring .= "\\subparagraph{ ";
  540: 	    } 
  541:            return $currentstring;
  542: 	}
  543:         sub end_h6 {
  544: 	    my ($target,$token) = @_;
  545:             my $currentstring = '';
  546:             if ($target eq 'web') {
  547: 	       $currentstring .= $token->[2];
  548: 	    } elsif ($target eq 'tex') {
  549: 		$currentstring .= "}";
  550: 	    } 
  551:            return $currentstring;
  552: 	}
  553: #-------------------------------------------------------------------------- <cite> tag
  554:         sub start_cite {
  555: 	    my ($target,$token) = @_;
  556:             my $currentstring = '';
  557:             if ($target eq 'web') {
  558: 	       $currentstring .= $token->[4];
  559: 	    } elsif ($target eq 'tex') {
  560: 		$currentstring .= "\\textit{";
  561: 	    }  elsif ($target eq 'latexsource') {
  562: 		$currentstring .= "\\textit{";
  563: 	    } 
  564:            return $currentstring;
  565: 	}
  566:         sub end_cite {
  567: 	    my ($target,$token) = @_;
  568:             my $currentstring = '';
  569:             if ($target eq 'web') {
  570: 	       $currentstring .= $token->[2];
  571: 	    } elsif ($target eq 'tex') {
  572: 		$currentstring .= "}";
  573: 	    }  elsif ($target eq 'latexsource') {
  574: 		$currentstring .= "}";
  575: 	    } 
  576:            return $currentstring;
  577: 	}
  578: #----------------------------------------------------------------------------- <i> tag
  579:         sub start_i {
  580: 	    my ($target,$token) = @_;
  581:             my $currentstring = '';
  582:             if ($target eq 'web') {
  583: 	       $currentstring .= $token->[4];
  584: 	    } elsif ($target eq 'tex') {
  585: 		$currentstring .= "\\textit{";
  586: 	    }  elsif ($target eq 'latexsource') {
  587: 		$currentstring .= "\\textit{";
  588: 	    } 
  589:            return $currentstring;
  590: 	}
  591:         sub end_i {
  592: 	    my ($target,$token) = @_;
  593:             my $currentstring = '';
  594:             if ($target eq 'web') {
  595: 	       $currentstring .= $token->[2];
  596: 	    } elsif ($target eq 'tex') {
  597: 		$currentstring .= "}";
  598: 	    } elsif ($target eq 'latexsource') {
  599: 		$currentstring .= "}";
  600: 	    } 
  601:            return $currentstring;
  602: 	}
  603: #----------------------------------------------------------------------- <address> tag
  604:         sub start_address {
  605: 	    my ($target,$token) = @_;
  606:             my $currentstring = '';
  607:             if ($target eq 'web') {
  608: 	       $currentstring .= $token->[4];
  609: 	    } elsif ($target eq 'tex') {
  610: 		$currentstring .= "\\textit{";
  611: 	    } elsif ($target eq 'latexsource') {
  612: 		$currentstring .= "\\textit{";
  613: 	    } 
  614:            return $currentstring;
  615: 	}
  616:         sub end_address {
  617: 	    my ($target,$token) = @_;
  618:             my $currentstring = '';
  619:             if ($target eq 'web') {
  620: 	       $currentstring .= $token->[2];
  621: 	    } elsif ($target eq 'tex') {
  622: 		$currentstring .= "}";
  623: 	    } elsif ($target eq 'latexsource') {
  624: 		$currentstring .= "}";
  625: 	    }
  626:            return $currentstring;
  627: 	}
  628: #--------------------------------------------------------------------------- <dfn> tag
  629:         sub start_dfn {
  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_dfn {
  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: #---------------------------------------------------------------------------- <tt> tag
  654:         sub start_tt {
  655: 	    my ($target,$token) = @_;
  656:             my $currentstring = '';
  657:             if ($target eq 'web') {
  658: 	       $currentstring .= $token->[4];
  659: 	    } elsif ($target eq 'tex') {
  660: 		$currentstring .= "\\texttt{";
  661: 	    } elsif ($target eq 'latexsource') {
  662: 		$currentstring .= "\\texttt{";
  663: 	    } 
  664:            return $currentstring;
  665: 	}
  666:         sub end_tt {
  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: #---------------------------------------------------------------------------- <kbd> tag
  679:         sub start_kbd {
  680: 	    my ($target,$token) = @_;
  681:             my $currentstring = '';
  682:             if ($target eq 'web') {
  683: 	       $currentstring .= $token->[4];
  684: 	    } elsif ($target eq 'tex') {
  685: 		$currentstring .= "\\texttt";
  686: 	    } elsif ($target eq 'latexsource') {
  687: 		$currentstring .= "\\texttt{";
  688: 	    } 
  689:            return $currentstring;
  690: 	}
  691:         sub end_kbd {
  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: #-------------------------------------------------------------------------- <code> tag
  704:         sub start_code {
  705: 	    my ($target,$token) = @_;
  706:             my $currentstring = '';
  707:             if ($target eq 'web') {
  708: 	       $currentstring .= $token->[4];
  709: 	    } elsif ($target eq 'tex') {
  710: 		$currentstring .= "{ \\tt ";
  711: 	    } 
  712:            return $currentstring;
  713: 	}
  714:         sub end_code {
  715: 	    my ($target,$token) = @_;
  716:             my $currentstring = '';
  717:             if ($target eq 'web') {
  718: 	       $currentstring .= $token->[2];
  719: 	    } elsif ($target eq 'tex') {
  720: 		$currentstring .= "}";
  721: 	    } 
  722:            return $currentstring;
  723: 	}
  724: #---------------------------------------------------------------------------- <em> tag
  725:         sub start_em {
  726: 	    my ($target,$token) = @_;
  727:             my $currentstring = '';
  728:             if ($target eq 'web') {
  729: 	       $currentstring .= $token->[4];
  730: 	    } elsif ($target eq 'tex') {
  731: 		$currentstring .= "\\emph{";
  732: 	    } elsif ($target eq 'latexsource') {
  733: 		$currentstring .= "\\emph{";
  734: 	    } 
  735:            return $currentstring;
  736: 	}
  737:         sub end_em {
  738: 	    my ($target,$token) = @_;
  739:             my $currentstring = '';
  740:             if ($target eq 'web') {
  741: 	       $currentstring .= $token->[2];
  742: 	    } elsif ($target eq 'tex') {
  743: 		$currentstring .= "}";
  744: 	    } elsif ($target eq 'latexsource') {
  745: 		$currentstring .= "}";
  746: 	    }  
  747:            return $currentstring;
  748: 	}
  749: #----------------------------------------------------------------------------- <q> tag
  750:         sub start_q {
  751: 	    my ($target,$token) = @_;
  752:             my $currentstring = '';
  753:             if ($target eq 'web') {
  754: 	       $currentstring .= $token->[4];
  755: 	    } elsif ($target eq 'tex') {
  756: 		$currentstring .= "\\emph{";
  757: 	    }  elsif ($target eq 'latexsource') {
  758: 		$currentstring .= "\\emph{";
  759: 	    }
  760:            return $currentstring;
  761: 	}
  762:         sub end_q {
  763: 	    my ($target,$token) = @_;
  764:             my $currentstring = '';
  765:             if ($target eq 'web') {
  766: 	       $currentstring .= $token->[2];
  767: 	    } elsif ($target eq 'tex') {
  768: 		$currentstring .= "}";
  769: 	    } elsif ($target eq 'latexsource') {
  770: 		$currentstring .= "}";
  771: 	    }  
  772:            return $currentstring;
  773: 	}
  774: #----------------------------------------------------------------------------- <p> tag
  775:         sub start_p {
  776: 	    my ($target,$token) = @_;
  777:             my $currentstring = '';
  778:             if ($target eq 'web') {
  779: 	       $currentstring .= $token->[4];
  780: 	    } elsif ($target eq 'tex') {
  781: 		$currentstring .= "{\\par ";
  782: 	    } elsif ($target eq 'latexsource') {
  783: 		$currentstring .= "{\\par ";
  784: 	    } 
  785:            return $currentstring;
  786: 	}
  787:         sub end_p {
  788: 	    my ($target,$token) = @_;
  789:             my $currentstring = '';
  790:             if ($target eq 'web') {
  791: 	       $currentstring .= $token->[2];
  792: 	    } elsif ($target eq 'tex') {
  793: 	        $currentstring .= "}";
  794:             } elsif ($target eq 'latexsource') {
  795: 	        $currentstring .= "}";
  796:             }
  797:            return $currentstring;
  798: 	}
  799: #---------------------------------------------------------------------------- <br> tag
  800:         sub start_br {
  801: 	    my ($target,$token) = @_;
  802:             my $currentstring = '';
  803:             if ($target eq 'web') {
  804: 	       $currentstring .= $token->[4];
  805: 	    } elsif ($target eq 'tex') {
  806: 		$currentstring .= "\\\\";
  807: 	    } elsif ($target eq 'latexsource') {
  808: 		$currentstring .= "\\\\";
  809: 	    } 
  810:            return $currentstring;
  811: 	}
  812:         sub end_br {
  813: 	    my ($target,$token) = @_;
  814:             my $currentstring = '';
  815:             if ($target eq 'web') {
  816: 	       $currentstring .= $token->[2];
  817: 	    }
  818:            return $currentstring;
  819: 	}
  820: #--------------------------------------------------------------------------- <big> tag
  821:         sub start_big {
  822: 	    my ($target,$token) = @_;
  823:             my $currentstring = '';
  824:             if ($target eq 'web') {
  825: 	       $currentstring .= $token->[4];
  826: 	    } elsif ($target eq 'tex') {
  827: 		$currentstring .= "{\\large ";
  828: 	    } elsif ($target eq 'latexsource') {
  829: 		$currentstring .= "{\\large ";
  830: 	    }  
  831:            return $currentstring;
  832: 	}
  833:         sub end_big {
  834: 	    my ($target,$token) = @_;
  835:             my $currentstring = '';
  836:             if ($target eq 'web') {
  837: 	       $currentstring .= $token->[2];
  838: 	    } elsif ($target eq 'tex') {
  839: 	        $currentstring .= " }";
  840:             } elsif ($target eq 'latexsource') {
  841: 	        $currentstring .= " }";
  842:             }
  843:            return $currentstring;
  844: 	}
  845: #------------------------------------------------------------------------- <small> tag
  846:         sub start_small {
  847: 	    my ($target,$token) = @_;
  848:             my $currentstring = '';
  849:             if ($target eq 'web') {
  850: 	       $currentstring .= $token->[4];
  851: 	    } elsif ($target eq 'tex') {
  852: 		$currentstring .= "{\\footnotesize ";
  853: 	    } elsif ($target eq 'latexsource') {
  854: 		$currentstring .= "{\\footnotesize ";
  855: 	    } 
  856:            return $currentstring;
  857: 	}
  858:         sub end_small {
  859: 	    my ($target,$token) = @_;
  860:             my $currentstring = '';
  861:             if ($target eq 'web') {
  862: 	       $currentstring .= $token->[2];
  863: 	    } elsif ($target eq 'tex') {
  864: 	        $currentstring .= " }";
  865:             } elsif ($target eq 'latexsource') {
  866: 	        $currentstring .= " }";
  867:             }
  868:            return $currentstring;
  869: 	}
  870: #---------------------------------------------------------------------- <basefont> tag
  871:       sub start_basefont {
  872: 	my ($target,$token) = @_;
  873: 	my $currentstring = '';
  874: 	if ($target eq 'web') {
  875: 	  $currentstring = $token->[4];     
  876: 	} 
  877: 	return $currentstring;
  878:       }
  879:       sub end_basefont {
  880: 	my ($target,$token) = @_;
  881: 	my $currentstring = '';
  882: 	if ($target eq 'web') {
  883: 	  $currentstring = $token->[4];     
  884: 	} 
  885: 	return $currentstring;
  886:       }
  887: #-------------------------------------------------------------------------- <font> tag
  888:          sub start_font {
  889: 	    my ($target,$token) = @_;
  890:             my $currentstring = '';
  891:             if ($target eq 'web') {
  892:               $currentstring = $token->[4];     
  893: 	    } 
  894: 	   return $currentstring;
  895: 	}
  896:         sub end_font {
  897: 	    my ($target,$token) = @_;
  898:             my $currentstring = '';
  899:             if ($target eq 'web') {
  900:               $currentstring = $token->[2];    
  901:             } 
  902: 	   return $currentstring;
  903: 	} 
  904: #------------------------------------------------------------------------ <strike> tag
  905:         sub start_strike {
  906: 	    my ($target,$token) = @_;
  907:             my $currentstring = '';
  908:             if ($target eq 'web') {
  909: 	       $currentstring .= $token->[4];
  910: 	    } elsif ($target eq 'tex') {
  911: 		$currentstring .= "{\\underline ";
  912: 	    } 
  913:            return $currentstring;
  914: 	}
  915:         sub end_strike {
  916: 	    my ($target,$token) = @_;
  917:             my $currentstring = '';
  918:             if ($target eq 'web') {
  919: 	       $currentstring .= $token->[2];
  920: 	    } elsif ($target eq 'tex') {
  921: 	        $currentstring .= " }";
  922:             }
  923:            return $currentstring;
  924: 	}
  925: #----------------------------------------------------------------------------- <s> tag
  926:         sub start_s {
  927: 	    my ($target,$token) = @_;
  928:             my $currentstring = '';
  929:             if ($target eq 'web') {
  930: 	       $currentstring .= $token->[4];
  931: 	    } elsif ($target eq 'tex') {
  932: 		$currentstring .= "{\\underline ";
  933: 	    } 
  934:            return $currentstring;
  935: 	}
  936:         sub end_s {
  937: 	    my ($target,$token) = @_;
  938:             my $currentstring = '';
  939:             if ($target eq 'web') {
  940: 	       $currentstring .= $token->[2];
  941: 	    } elsif ($target eq 'tex') {
  942: 	        $currentstring .= " }";
  943:             }
  944:            return $currentstring;
  945: 	}
  946: #--------------------------------------------------------------------------- <sub> tag
  947:         sub start_sub {
  948: 	    my ($target,$token) = @_;
  949:             my $currentstring = '';
  950:             if ($target eq 'web') {
  951: 	       $currentstring .= $token->[4];
  952: 	    } elsif ($target eq 'tex') {
  953: 		$currentstring .= "\$_{ ";
  954: 	    } 
  955:            return $currentstring;
  956: 	}
  957:         sub end_sub {
  958: 	    my ($target,$token) = @_;
  959:             my $currentstring = '';
  960:             if ($target eq 'web') {
  961: 	       $currentstring .= $token->[2];
  962: 	    } elsif ($target eq 'tex') {
  963: 	        $currentstring .= " }\$";
  964:             }
  965:            return $currentstring;
  966: 	}
  967: #--------------------------------------------------------------------------- <sup> tag
  968:         sub start_sup {
  969: 	    my ($target,$token) = @_;
  970:             my $currentstring = '';
  971:             if ($target eq 'web') {
  972: 	       $currentstring .= $token->[4];
  973: 	    } elsif ($target eq 'tex') {
  974: 		$currentstring .= "\$^{ ";
  975: 	    } 
  976:            return $currentstring;
  977: 	}
  978:         sub end_sup {
  979: 	    my ($target,$token) = @_;
  980:             my $currentstring = '';
  981:             if ($target eq 'web') {
  982: 	       $currentstring .= $token->[2];
  983: 	    } elsif ($target eq 'tex') {
  984: 	        $currentstring .= " }\$";
  985:             }
  986:            return $currentstring;
  987: 	}
  988: #---------------------------------------------------------------------------- <hr> tag
  989:         sub start_hr {
  990: 	    my ($target,$token) = @_;
  991:             my $currentstring = '';
  992:             if ($target eq 'web') {
  993: 	       $currentstring .= $token->[4];
  994: 	    } elsif ($target eq 'tex') {
  995: 		$currentstring .= "\\hline ";
  996: 	    } 
  997:            return $currentstring;
  998: 	}
  999:         sub end_hr {
 1000: 	    my ($target,$token) = @_;
 1001:             my $currentstring = '';
 1002:             if ($target eq 'web') {
 1003: 	       $currentstring .= $token->[2];
 1004: 	    } elsif ($target eq 'tex') {
 1005: 	    } 
 1006:            return $currentstring;
 1007: 	}
 1008: #----------------------------------------------------------------------------- <a> tag
 1009:         sub start_a {
 1010: 	    my ($target,$token) = @_;
 1011:             my $currentstring = '';
 1012:             if ($target eq 'web') {
 1013: 	       $currentstring .= $token->[4];
 1014: 	    } elsif ($target eq 'tex') {
 1015: 	    }
 1016:            return $currentstring;
 1017: 	}
 1018:         sub end_a {
 1019: 	    my ($target,$token,$tagstack,$stackref) = @_;
 1020:             my $currentstring = '';
 1021:             if ($target eq 'web') {
 1022: 	       $currentstring .= $token->[2];
 1023: 	    } elsif ($target eq 'tex') {
 1024:                 my  $tempor_var = $stackref->[$#$stackref];
 1025: 		if (index($tempor_var,'name') != -1 ) {
 1026: 		    $tempor_var =~ s/name=([^,]*),/$1/g;
 1027: #	        $currentstring .= " \\label{$tempor_var}";
 1028: 	        } elsif (index($tempor_var,'href') != -1 ) {
 1029: 		    $tempor_var =~ s/href=([^,]*),/$1/g;
 1030: 	        $currentstring .= " \\ref{$tempor_var}";
 1031: 	        }
 1032:             }
 1033:            return $currentstring;
 1034: 	}
 1035: #---------------------------------------------------------------------------- <li> tag
 1036:         sub start_li {
 1037: 	    my ($target,$token,$tagstack,$stackref) = @_;
 1038:             my $currentstring = '';
 1039:             if ($target eq 'web') {
 1040:               $currentstring = $token->[4];     
 1041: 	    } elsif ($target eq 'tex') {
 1042:                 my  $tempor_var = $stackref->[$#$stackref];
 1043:                 if (index($tempor_var,'circle') != -1 ) {
 1044: 	          $currentstring .= " \\item[o] ";
 1045: 	        } elsif (index($tempor_var,'square') != -1 ) {
 1046: 	               $currentstring .= " \\item[$\Box$] ";
 1047: 	        } elsif ($tempor_var ne '') { 
 1048: 		       $_ = $tempor_var;
 1049:                        m/my\s*([^=]*)=/;
 1050: 		       $currentstring .= " \\item[$1] ";
 1051: 		} else {
 1052: 		    $currentstring .= " \\item ";
 1053: 	        }  
 1054: 	    } 
 1055: 	   return $currentstring;
 1056: 	}
 1057:         sub end_li {
 1058: 	    my ($target,$token) = @_;
 1059:             my $currentstring = '';
 1060:             if ($target eq 'web') {
 1061:               $currentstring = $token->[2];     
 1062: 	    } 
 1063: 	   return $currentstring;
 1064: 	}
 1065: #----------------------------------------------------------------------------- <u> tag
 1066:         sub start_u {
 1067: 	    my ($target,$token) = @_;
 1068:             my $currentstring = '';
 1069:             if ($target eq 'web') {
 1070: 	       $currentstring .= $token->[4];
 1071: 	    } elsif ($target eq 'tex') {
 1072: 		$currentstring .= "{\\underline ";
 1073: 	    } 
 1074:            return $currentstring;
 1075: 	}
 1076:         sub end_u {
 1077: 	    my ($target,$token) = @_;
 1078:             my $currentstring = '';
 1079:             if ($target eq 'web') {
 1080: 	       $currentstring .= $token->[2];
 1081: 	    } elsif ($target eq 'tex') {
 1082: 	        $currentstring .= " }";
 1083:             }
 1084:            return $currentstring;
 1085: 	}
 1086: #---------------------------------------------------------------------------- <ul> tag
 1087:         sub start_ul {
 1088: 	    my ($target,$token) = @_;
 1089:             my $currentstring = '';
 1090:             if ($target eq 'web') {
 1091:               $currentstring = $token->[4];     
 1092: 	    } elsif ($target eq 'tex') {
 1093:               $currentstring = " \\begin{itemize} ";  
 1094: 	    } 
 1095: 	   return $currentstring;
 1096: 	}
 1097:         sub end_ul {
 1098: 	    my ($target,$token) = @_;
 1099:             my $currentstring = '';
 1100:             if ($target eq 'web') {
 1101:               $currentstring = $token->[2];     
 1102: 	    } elsif ($target eq 'tex') {
 1103:               $currentstring = " \\end{itemize}";  
 1104: 	    } 
 1105: 	   return $currentstring;
 1106: 	}
 1107: #-------------------------------------------------------------------------- <menu> tag
 1108:         sub start_menu {
 1109: 	    my ($target,$token) = @_;
 1110:             my $currentstring = '';
 1111:             if ($target eq 'web') {
 1112:               $currentstring = $token->[4];     
 1113: 	    } elsif ($target eq 'tex') {
 1114:               $currentstring = " \\begin{itemize} ";  
 1115: 	    } 
 1116: 	   return $currentstring;
 1117: 	}
 1118:         sub end_menu {
 1119: 	    my ($target,$token) = @_;
 1120:             my $currentstring = '';
 1121:             if ($target eq 'web') {
 1122:               $currentstring = $token->[2];     
 1123: 	    } elsif ($target eq 'tex') {
 1124:               $currentstring = " \\end{itemize}";  
 1125: 	    } 
 1126: 	   return $currentstring;
 1127: 	}
 1128: #--------------------------------------------------------------------------- <dir> tag
 1129:         sub start_dir {
 1130: 	    my ($target,$token) = @_;
 1131:             my $currentstring = '';
 1132:             if ($target eq 'web') {
 1133:               $currentstring = $token->[4];     
 1134: 	    } elsif ($target eq 'tex') {
 1135:               $currentstring = " \\begin{itemize} ";  
 1136: 	    } 
 1137: 	   return $currentstring;
 1138: 	}
 1139:         sub end_dir {
 1140: 	    my ($target,$token) = @_;
 1141:             my $currentstring = '';
 1142:             if ($target eq 'web') {
 1143:               $currentstring = $token->[2];     
 1144: 	    } elsif ($target eq 'tex') {
 1145:               $currentstring = " \\end{itemize}";  
 1146: 	    } 
 1147: 	   return $currentstring;
 1148: 	}
 1149: #---------------------------------------------------------------------------- <ol> tag
 1150:         sub start_ol {
 1151: 	    my ($target,$token) = @_;
 1152:             my $currentstring = '';
 1153:             if ($target eq 'web') {
 1154:               $currentstring = $token->[4];     
 1155: 	    } elsif ($target eq 'tex') {
 1156:               $currentstring = " \\begin{enumerate} ";  
 1157: 	    } 
 1158: 	   return $currentstring;
 1159: 	}
 1160:         sub end_ol {
 1161: 	    my ($target,$token) = @_;
 1162:             my $currentstring = '';
 1163:             if ($target eq 'web') {
 1164:               $currentstring = $token->[2];     
 1165: 	    } elsif ($target eq 'tex') {
 1166:               $currentstring = " \\end{enumerate}";  
 1167: 	    } 
 1168: 	   return $currentstring;
 1169: 	}
 1170: #---------------------------------------------------------------------------- <dl> tag
 1171:         sub start_dl {
 1172: 	    my ($target,$token) = @_;
 1173:             my $currentstring = '';
 1174:             if ($target eq 'web') {
 1175:               $currentstring = $token->[4];     
 1176: 	    } elsif ($target eq 'tex') {
 1177:               $currentstring = " \\begin{description} ";  
 1178: 	    } 
 1179: 	   return $currentstring;
 1180: 	}
 1181:         sub end_dl {
 1182: 	    my ($target,$token) = @_;
 1183:             my $currentstring = '';
 1184:             if ($target eq 'web') {
 1185:               $currentstring = $token->[2];     
 1186: 	    } elsif ($target eq 'tex') {
 1187:               $currentstring = " \\end{description}";  
 1188: 	    } 
 1189: 	   return $currentstring;
 1190: 	}
 1191: #---------------------------------------------------------------------------- <dt> tag
 1192:         sub start_dt {
 1193: 	    my ($target,$token) = @_;
 1194:             my $currentstring = '';
 1195:             if ($target eq 'web') {
 1196:               $currentstring = $token->[4];     
 1197: 	    } elsif ($target eq 'tex') {
 1198:               $currentstring = "\\item[ ";  
 1199: 	    } 
 1200: 	   return $currentstring;
 1201: 	}
 1202:         sub end_dt {
 1203: 	    my ($target,$token) = @_;
 1204:             my $currentstring = '';
 1205:             if ($target eq 'web') {
 1206:               $currentstring = $token->[2];    
 1207:             } elsif ($target eq 'tex') {
 1208:               $currentstring = "]";  
 1209: 	    } 
 1210: 	   return $currentstring;
 1211: 	}
 1212: #---------------------------------------------------------------------------- <dd> tag
 1213:         sub start_dd {
 1214: 	    my ($target,$token) = @_;
 1215:             my $currentstring = '';
 1216:             if ($target eq 'web') {
 1217:               $currentstring = $token->[4];     
 1218: 	    } 
 1219: 	   return $currentstring;
 1220: 	}
 1221:         sub end_dd {
 1222: 	    my ($target,$token) = @_;
 1223:             my $currentstring = '';
 1224:             if ($target eq 'web') {
 1225:               $currentstring = $token->[2];    
 1226:             } 
 1227: 	   return $currentstring;
 1228: 	}
 1229: #------------------------------------------------------------------------- <table> tag
 1230:         sub start_table {
 1231: 	    my ($target,$token) = @_;
 1232:             my $currentstring = '';
 1233:             if ($target eq 'web') {
 1234:               $currentstring = $token->[4];     
 1235: 	    } elsif ($target eq 'tex') {
 1236:               $currentstring = "";  
 1237: 	    } 
 1238: 	   return $currentstring;
 1239: 	}
 1240:         sub end_table {
 1241: 	    my ($target,$token) = @_;
 1242:             my $currentstring = '';
 1243:             if ($target eq 'web') {
 1244:               $currentstring = $token->[2];     
 1245: 	    } elsif ($target eq 'tex') {
 1246:               $currentstring = "";  
 1247: 	    } 
 1248: 	   return $currentstring;
 1249: 	}
 1250: #------------------------------------------------------------------------- <tr> tag
 1251:         sub start_tr {
 1252: 	    my ($target,$token) = @_;
 1253:             my $currentstring = '';
 1254:             if ($target eq 'web') {
 1255:               $currentstring = $token->[4];     
 1256: 	    } elsif ($target eq 'tex') {
 1257: 	      $currentstring = '';
 1258: 	    } 
 1259: 	   return $currentstring;
 1260: 	}
 1261:         sub end_tr {
 1262: 	    my ($target,$token) = @_;
 1263:             my $currentstring = '';
 1264:             if ($target eq 'web') {
 1265:               $currentstring = $token->[2];     
 1266: 	    } elsif ($target eq 'tex') {
 1267:               $currentstring = "";  
 1268: 	    } 
 1269: 	   return $currentstring;
 1270: 	}
 1271: #------------------------------------------------------------------------- <td> tag
 1272:         sub start_td {
 1273: 	    my ($target,$token) = @_;
 1274:             my $currentstring = '';
 1275:             if ($target eq 'web') {
 1276:               $currentstring = $token->[4];     
 1277: 	    } elsif ($target eq 'tex') {
 1278: 	      $currentstring = '';
 1279: 	    } 
 1280: 	   return $currentstring;
 1281: 	}
 1282:         sub end_td {
 1283: 	    my ($target,$token) = @_;
 1284:             my $currentstring = '';
 1285:             if ($target eq 'web') {
 1286:               $currentstring = $token->[2];     
 1287: 	    } elsif ($target eq 'tex') {
 1288:               $currentstring = "";  
 1289: 	    } 
 1290: 	   return $currentstring;
 1291: 	}
 1292: # -------------------------------------------------------------------------- <img> tag
 1293: 
 1294:         sub start_img {
 1295: 	    my ($target,$token) = @_;
 1296:             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1297:                                         $token->[2]->{'src'};
 1298:             my $currentstring = '';
 1299:             if ($target eq 'web') {
 1300:               $currentstring = $token->[4];     
 1301: 	    } elsif ($target eq 'tex') {
 1302:               $currentstring = " \\begin{figure} ";  
 1303: 	    } 
 1304: 	   return $currentstring;
 1305: 	}
 1306:         sub end_img {
 1307: 	    my ($target,$token) = @_;
 1308:             my $currentstring = '';
 1309:             if ($target eq 'web') {
 1310:               $currentstring = $token->[2];     
 1311: 	    } elsif ($target eq 'tex') {
 1312:               $currentstring = " \\end{figure}";  
 1313: 	    } 
 1314: 	   return $currentstring;
 1315: 	}
 1316: # ----------------------------------------------------------------------- <applet> tag
 1317: 
 1318:         sub start_applet {
 1319: 	    my ($target,$token) = @_;
 1320:               $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1321:                                         $token->[2]->{'code'};
 1322:               $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1323:                                         $token->[2]->{'archive'};
 1324:             my $currentstring = '';
 1325:             if ($target eq 'web') {
 1326:               $currentstring = $token->[4];     
 1327: 	    } elsif ($target eq 'tex') {
 1328:               $currentstring = " \\begin{figure} ";  
 1329: 	    } 
 1330: 	   return $currentstring;
 1331: 	}
 1332:         sub end_applet {
 1333: 	    my ($target,$token) = @_;
 1334:             my $currentstring = '';
 1335:             if ($target eq 'web') {
 1336:               $currentstring = $token->[2];     
 1337: 	    } elsif ($target eq 'tex') {
 1338:               $currentstring = " \\end{figure}";  
 1339: 	    } 
 1340: 	   return $currentstring;
 1341: 	}
 1342: 
 1343: # ------------------------------------------------------------------------ <embed> tag
 1344: 
 1345:         sub start_embed {
 1346: 	    my ($target,$token) = @_;
 1347:             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1348:                                         $token->[2]->{'src'};
 1349:            my $currentstring = '';
 1350:             if ($target eq 'web') {
 1351:               $currentstring = $token->[4];     
 1352: 	    } elsif ($target eq 'tex') {
 1353:               $currentstring = " \\begin{figure} ";  
 1354: 	    } 
 1355: 	   return $currentstring;
 1356: 	}
 1357:         sub end_embed {
 1358: 	    my ($target,$token) = @_;
 1359:             my $currentstring = '';
 1360:             if ($target eq 'web') {
 1361:               $currentstring = $token->[2];     
 1362: 	    } elsif ($target eq 'tex') {
 1363:               $currentstring = " \\end{figure}";  
 1364: 	    } 
 1365: 	   return $currentstring;
 1366: 	}
 1367: 
 1368: # ------------------------------------------------------------------------ <param> tag
 1369: 
 1370:         sub start_param {
 1371: 	    my ($target,$token) = @_;
 1372: 	    if ($token->[2]->{'name'} eq 'cabbase') {
 1373:                       $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
 1374: 					     $token->[2]->{'value'};
 1375:             }   
 1376:             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1377:                                         $token->[2]->{'src'};
 1378:             my $currentstring = '';
 1379:             if ($target eq 'web') {
 1380:               $currentstring = $token->[4];     
 1381: 	    } elsif ($target eq 'tex') {
 1382:               $currentstring = " \\begin{figure} ";  
 1383: 	    } 
 1384: 	   return $currentstring;
 1385: 	}
 1386:         sub end_param {
 1387: 	    my ($target,$token) = @_;
 1388:             my $currentstring = '';
 1389:             if ($target eq 'web') {
 1390:               $currentstring = $token->[2];     
 1391: 	    } elsif ($target eq 'tex') {
 1392:               $currentstring = " \\end{figure}";  
 1393: 	    } 
 1394: 	   return $currentstring;
 1395: 	}
 1396: 
 1397: # ------------------------------------------------------------------------ <allow> tag
 1398: 
 1399:         sub start_allow {
 1400: 	    my ($target,$token) = @_;
 1401: 
 1402:             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
 1403:                                         $token->[2]->{'src'};
 1404: 
 1405: 	   return '';
 1406: 	}
 1407:         sub end_allow {
 1408: 	   return '';
 1409: 	}
 1410: 
 1411: # ------------------------------------------------------------------------- Frames
 1412: 	sub start_frameset {
 1413: 	  my ($target,$token) = @_;
 1414: 	  my $currentstring = '';
 1415: 	  if ($target eq 'web') { 
 1416: 	    if (!$Apache::lonxml::registered) {
 1417: 	      $currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
 1418: 	    }
 1419: 	    $currentstring .= $token->[4];
 1420: 	  }
 1421: 	  return $currentstring;
 1422: 	}
 1423:         sub end_frameset {
 1424: 	  my ($target,$token) = @_;
 1425: 	  my $currentstring = '';
 1426: 	  if ($target eq 'web') {
 1427: 	    $currentstring = $token->[2];
 1428: 	  }
 1429: 	  return $currentstring;
 1430: 	}
 1431: 1;
 1432: __END__

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