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

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

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