File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.17: download - view: text, annotated - select for diffs
Fri Jan 12 20:39:49 2001 UTC (23 years, 4 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- generally useless messages

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

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