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

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

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