File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.44: download - view: text, annotated - select for diffs
Tue Feb 26 21:44:45 2002 UTC (22 years, 3 months ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
added <insert> tag

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

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