File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.32: download - view: text, annotated - select for diffs
Mon Aug 6 20:41:22 2001 UTC (22 years, 11 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- collect all posible capitalizations on onunload and onload into a single onLoad and onUnload arg

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

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