Annotation of loncom/xml/londefdef.pm, revision 1.39

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

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