File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.13: download - view: text, annotated - select for diffs
Thu Nov 30 11:44:50 2000 UTC (23 years, 5 months ago) by www
Branches: MAIN
CVS tags: HEAD
Collects title and subject in metadata target

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

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