File:  [LON-CAPA] / loncom / xml / londefdef.pm
Revision 1.7: download - view: text, annotated - select for diffs
Mon Oct 30 20:34:25 2000 UTC (23 years, 6 months ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
In londefdef.pm a few tags for tex target were changed: <m>,<p>,...
In lonxml.pm a new global variable textredirection was introduced. It is used for dwitch on and off the metadata output. A few lines of code were added.

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

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