Diff for /loncom/xml/londefdef.pm between versions 1.131 and 1.173

version 1.131, 2003/05/07 16:59:01 version 1.173, 2003/09/25 16:09:14
Line 25 Line 25
 # /home/httpd/html/adm/gpl.txt  # /home/httpd/html/adm/gpl.txt
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  ## Copyright for TtHfunc and TtMfunc by Ian Hutchinson. 
 # Copyright for TtHfunc and TtMfunc by Ian Hutchinson.   
 # TtHfunc and TtMfunc (the "Code") may be compiled and linked into   # TtHfunc and TtMfunc (the "Code") may be compiled and linked into 
 # binary executable programs or libraries distributed by the   # binary executable programs or libraries distributed by the 
 # Michigan State University (the "Licensee"), but any binaries so   # Michigan State University (the "Licensee"), but any binaries so 
Line 52  use Image::Magick; Line 51  use Image::Magick;
 use Apache::lonmenu();  use Apache::lonmenu();
 use Apache::lonmeta();  use Apache::lonmeta();
   
   $Apache::londefdef::TD_redirection=0;
   
 BEGIN {  BEGIN {
   
     &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr'));      &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput'));
   
 }  }
   
Line 157  sub start_html { Line 158  sub start_html {
     &Apache::lonxml::fontsettings();           &Apache::lonxml::fontsettings();     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  @Apache::londefdef::table = ();   @Apache::londefdef::table = ();
  $currentstring .= '\documentclass[letterpaper]{article}   $currentstring .= '\documentclass[letterpaper]{article}';
                            \newcommand{\keephidden}[1]{}   if ($ENV{'form.latex_type'}=~'batchmode') {$currentstring .='\batchmode';} 
    $currentstring .= '\newcommand{\keephidden}[1]{}
                            \renewcommand{\deg}{$^{\circ}$}                             \renewcommand{\deg}{$^{\circ}$}
                              \usepackage{longtable}
                            \usepackage{textcomp}                             \usepackage{textcomp}
                              \usepackage{makeidx}
                            \usepackage[dvips]{graphicx}                             \usepackage[dvips]{graphicx}
                            \usepackage{epsfig}\usepackage{calc}                             \usepackage{epsfig}\usepackage{calc}
 \newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in}\setlength{\abovedisplayskip}{0.05in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.04in}}}{\end{list}}';  \newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in}\setlength{\abovedisplayskip}{0.05in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.04in}}}{\end{list}}
   \renewenvironment{theindex}{\begin{list}{}{{\vskip 1mm \noindent \large\textbf{Index}} \newline \setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.01in}\setlength{\itemsep}{0.1in}\setlength{\parsep}{-0.02in}\setlength{\belowdisplayskip}{0.01in}\setlength{\abovedisplayskip}{0.01in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.01in}}}{\end{list}}';
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 318  sub start_title { Line 323  sub start_title {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\keephidden{'    $currentstring .= '\keephidden{Title of the document:  ' 
     }      }
     if ($target eq 'meta') {      if ($target eq 'meta') {
  $currentstring='<title>';   $currentstring='<title>';
Line 354  sub start_meta { Line 359  sub start_meta {
  } else {   } else {
     $currentstring = $token->[4];      $currentstring = $token->[4];
  }   }
     }      } elsif ($target eq 'meta') {
     if ($target eq 'meta') {  
  unless (&Apache::lonxml::get_param   unless (&Apache::lonxml::get_param
  ('http-equiv',$parstack,$safeeval,undef,1)) {   ('http-equiv',$parstack,$safeeval,undef,1)) {
     my $name=$token->[2]->{'name'};      my $name=$token->[2]->{'name'};
Line 363  sub start_meta { Line 367  sub start_meta {
     $name=~s/\s/\_/gs;      $name=~s/\s/\_/gs;
     $name=~s/\W//gs;      $name=~s/\W//gs;
     if ($name) {      if ($name) {
  $currentstring='<'.$name.'>'.   $currentstring='<'.$name;
                    my $display=&Apache::lonxml::get_param
    ('display',$parstack,$safeeval,undef,1);
                   if ($display) {
                       $display=~s/\"/\'/g;
       $currentstring.=' display="'.$display.'"';
                   }
    $currentstring.='>'.
     &Apache::lonxml::get_param      &Apache::lonxml::get_param
  ('content',$parstack,$safeeval,undef,1).   ('content',$parstack,$safeeval,undef,1).
     '</'.$name.'>';   '</'.$name.'>';
     }      }
               my $display=&Apache::lonxml::get_param
    ('display',$parstack,$safeeval,undef,1);
               if ($display) {
    $display=&HTML::Entities::encode($display);
    $currentstring.='<'.$name.'.display>'.$display.
                                  '</'.$name.'.display>';
               }
    }
       } elsif ($target eq 'tex') {
    my $content=&Apache::lonxml::get_param('content',$parstack,$safeeval);
    my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval);
    if ((not defined $content) && (not defined $name)) {
       &Apache::lonxml::startredirection();
  }   }
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 sub end_meta {  sub end_meta {
     my ($target,$token,$tagstack,$parstack,$parser) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  my $args='';   my $args='';
Line 382  sub end_meta { Line 406  sub end_meta {
  if ($args ne '') {   if ($args ne '') {
     $currentstring = $token->[4];      $currentstring = $token->[4];
  }   }
     }       } elsif ($target eq 'tex') {
    my $content=&Apache::lonxml::get_param('content',$parstack,$safeeval);
    my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval);
    if ((not defined $content) && (not defined $name)) {
       &Apache::lonxml::endredirection();
    }
       }
     return $currentstring;      return $currentstring;
 }  }
   
Line 436  sub start_body { Line 466  sub start_body {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
    if ($Apache::lonhomework::parsing_a_problem) {
       &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");
       return '';
    }
  if (!$Apache::lonxml::registered) {   if (!$Apache::lonxml::registered) {
     $currentstring.='<head>'.      $currentstring.='<head>'.
  &Apache::lonmenu::registerurl(undef,$target).'</head>';   &Apache::lonmenu::registerurl(undef,$target).'</head>';
  }   }
   # Accessibility
    if ($ENV{'browser.imagesuppress'} eq 'on') {
       delete($token->[2]->{'background'});
    }
    if ($ENV{'browser.fontenhance'} eq 'on') {
       my $style='';
       foreach my $key (keys(%{$token->[2]})) {
    if ($key =~ /^style$/i) {
       $style.=$token->[2]->{$key}.';';
       delete($token->[2]->{$key});
    }
       }
       $token->[2]->{'style'}=$style.'; font-size: x-large;';
    }
    if ($ENV{'browser.blackwhite'} eq 'on') {
       delete($token->[2]->{'font'});
       delete($token->[2]->{'link'});
       delete($token->[2]->{'alink'});
       delete($token->[2]->{'vlink'});
       delete($token->[2]->{'bgcolor'});
       delete($token->[2]->{'background'});
    }
   # Overload loads
  my $onLoad='';   my $onLoad='';
  foreach my $key (keys(%{$token->[2]})) {   foreach my $key (keys(%{$token->[2]})) {
     if ($key =~ /^onload$/i) {      if ($key =~ /^onload$/i) {
Line 484  sub end_body { Line 541  sub end_body {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{document}';     $currentstring = '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 497  sub start_center { Line 554  sub start_center {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\begin{center}';     $currentstring = '\begin{center}';  
     }  elsif ($target eq 'latexsource') {      }
  $currentstring = '\begin{center}';    
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 510  sub end_center { Line 565  sub end_center {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{center}';     $currentstring = '\end{center}';  
     }  elsif ($target eq 'latexsource') {      }
  $currentstring = '\end{center}';    
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 524  sub start_b { Line 577  sub start_b {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\textbf{';     $currentstring = '\textbf{';  
     }  elsif ($target eq 'latexsource') {  
  $currentstring = '\textbf{';    
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 537  sub end_b { Line 588  sub end_b {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '}';     $currentstring = '}';  
     } elsif ($target eq 'latexsource') {  
  $currentstring = '}';    
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 551  sub start_strong { Line 600  sub start_strong {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\textbf{';     $currentstring = '\textbf{';  
     } elsif ($target eq 'latexsource') {  
  $currentstring = '\textbf{';    
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 565  sub end_strong { Line 612  sub end_strong {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '}';     $currentstring = '}';  
     }  elsif ($target eq 'latexsource') {      }
  $currentstring = '}';    
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 843  sub start_cite { Line 888  sub start_cite {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\\textit{";   $currentstring .= "\\textit{";
     }  elsif ($target eq 'latexsource') {      }
  $currentstring .= "\\textit{";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 856  sub end_cite { Line 899  sub end_cite {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "}";   $currentstring .= "}";
     }  elsif ($target eq 'latexsource') {      }
  $currentstring .= "}";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 870  sub start_i { Line 911  sub start_i {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\textit{';   $currentstring .= '\textit{';
     }  elsif ($target eq 'latexsource') {      }
  $currentstring .= '\textit{';  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 883  sub end_i { Line 922  sub end_i {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     } elsif ($target eq 'latexsource') {  
  $currentstring .= '}';  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 897  sub start_address { Line 934  sub start_address {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\\textit{";   $currentstring .= "\\textit{";
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= "\\textit{";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 910  sub end_address { Line 945  sub end_address {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "}";   $currentstring .= "}";
     } elsif ($target eq 'latexsource') {  
  $currentstring .= "}";  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 924  sub start_dfn { Line 957  sub start_dfn {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\\textit{";   $currentstring .= "\\textit{";
     } elsif ($target eq 'latexsource') {  
  $currentstring .= "\\textit{";  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 937  sub end_dfn { Line 968  sub end_dfn {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "}";   $currentstring .= "}";
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= "}";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 951  sub start_tt { Line 980  sub start_tt {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\texttt{';   $currentstring .= '\texttt{';
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= '\texttt{';  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 964  sub end_tt { Line 991  sub end_tt {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     } elsif ($target eq 'latexsource') {  
  $currentstring .= '}';  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 978  sub start_kbd { Line 1003  sub start_kbd {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\\texttt";   $currentstring .= "\\texttt";
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= "\\texttt{";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 991  sub end_kbd { Line 1014  sub end_kbd {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "}";   $currentstring .= "}";
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= "}";  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 1028  sub start_em { Line 1049  sub start_em {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\emph{';   $currentstring .= '\emph{';
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= '\emph{';  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 1041  sub end_em { Line 1060  sub end_em {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     } elsif ($target eq 'latexsource') {      } 
  $currentstring .= '}';  
     }    
     return $currentstring;      return $currentstring;
 }  }
   
Line 1055  sub start_q { Line 1072  sub start_q {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "\\emph{";   $currentstring .= "\\emph{";
     }  elsif ($target eq 'latexsource') {  
  $currentstring .= "\\emph{";  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1068  sub end_q { Line 1083  sub end_q {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= "}";   $currentstring .= "}";
     } elsif ($target eq 'latexsource') {      } 
  $currentstring .= "}";  
     }    
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <p> tag  #-- <p> tag
 sub start_p {  sub start_p {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '{\par ';   my $signal=1;
     } elsif ($target eq 'latexsource') {   foreach my $tag (@$tagstack) {if (lc($tag) eq 'b') {$signal=0;}}
  $currentstring .= '{\par ';   if ($signal) {$currentstring .= '\par ';}
     }       }
     return $currentstring;      return $currentstring;
 }  }
   
Line 1093  sub end_p { Line 1106  sub end_p {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {  
  $currentstring .= '}';  
     } elsif ($target eq 'latexsource') {  
  $currentstring .= '}';  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1109  sub start_br { Line 1118  sub start_br {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') {   if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') {
     $currentstring .= '\vskip 0.2 mm';      $currentstring .= '\vskip 0.2 mm ';
  }   }
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= '\\';  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 1133  sub start_big { Line 1140  sub start_big {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\large{';   $currentstring .= '{\large ';
     } elsif ($target eq 'latexsource') {      } 
  $currentstring .= '{\Large ';  
     }    
     return $currentstring;      return $currentstring;
 }  }
   
Line 1147  sub end_big { Line 1152  sub end_big {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     } elsif ($target eq 'latexsource') {  
  $currentstring .= '}';  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1161  sub start_small { Line 1164  sub start_small {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '{\footnotesize ';   $currentstring .= '{\footnotesize ';
     } elsif ($target eq 'latexsource') {      }
  $currentstring .= '{\footnotesize ';  
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 1174  sub end_small { Line 1175  sub end_small {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
     } elsif ($target eq 'latexsource') {  
  $currentstring .= '}';  
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1215  sub start_font { Line 1214  sub start_font {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);   my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
  if ($face=~/symbol/i) {$Apache::lonxml::prevent_entity_encode++;}   if ($face=~/symbol/i) {
       $Apache::lonxml::prevent_entity_encode++;
    } else {
       if (($ENV{'browser.fontenhance'} eq 'on') || 
    ($ENV{'browser.blackwhite'} eq 'on')) { return ''; }
    }
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);   my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
Line 1347  sub start_hr { Line 1351  sub start_hr {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,0);   my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
  if (defined $LaTeXwidth) {   if (defined $LaTeXwidth) {
     if ($LaTeXwidth=~/^%/) {      if ($LaTeXwidth=~/^%/) {
  substr($LaTeXwidth,0,1)='';   substr($LaTeXwidth,0,1)='';
  $LaTeXwidth=($LaTeXwidth/100).'\textwidth';   $LaTeXwidth=($LaTeXwidth/100).'\textwidth';
     }      }
  } else {   } else {
     $LaTeXwidth ='0.95\textwidth';      $LaTeXwidth ='0.9\textwidth';
  }   }
  my ($pre,$post);   my ($pre,$post);
  my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1);   my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1);
Line 1365  sub start_hr { Line 1369  sub start_hr {
  } elsif ($align eq 'right') {   } elsif ($align eq 'right') {
     $pre=' \hfill \llap{'; $post='}';      $pre=' \hfill \llap{'; $post='}';
  }   }
  $currentstring .= ' \vskip 0 mm \noindent\makebox[\textwidth]{'.$pre.'\makebox['.   $currentstring .= ' \vskip 0 mm \noindent\makebox['.$LaTeXwidth.']{'.$pre.'\makebox['.
                                     $LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm ';                                      $LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm ';
     }       } 
     return $currentstring;      return $currentstring;
Line 1376  sub end_hr { Line 1380  sub end_hr {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      }
     }   
     return $currentstring;      return $currentstring;
 }  }
   
Line 1402  sub end_div { Line 1405  sub end_div {
   
 #-- <a> tag  #-- <a> tag
 sub start_a {  sub start_a {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
    my $a=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1);
    my $b=&Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1);
    if ($a=~/\S/) {
       $a=~s/([^\\])%/$1\\\%/g;
       $currentstring .= '\ref{URI: '.$a.'}';
    } elsif ($b=~/\S/) {
       $currentstring .= '\ref{Anchor: '.$b.'}';
    } else {
       $currentstring.='';
    }
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 sub end_a {  sub end_a {
     my ($target,$token,$tagstack,$stackref) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {  
  my  $tempor_var = $stackref->[$#$stackref];  
  if (index($tempor_var,'name') != -1 ) {  
     $tempor_var =~ s/name=([^,]*),/$1/g;  
  } elsif (index($tempor_var,'href') != -1 ) {  
     $tempor_var =~ s/href=([^,]*),/$1/g;  
     $currentstring .= " \\ref{$tempor_var}";  
  }  
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <li> tag  #-- <li> tag
 sub start_li {  sub start_li {
     my ($target,$token,$tagstack,$stackref) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my  $tempor_var = $stackref->[$#$stackref];   my  $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1);
  if (index($tempor_var,'circle') != -1 ) {   if ($type=~/circle/) {
     $currentstring .= " \\item[o] ";      $currentstring .= ' \item[o] ';
  } elsif (index($tempor_var,'square') != -1 ) {   } elsif ($type=~/square/) {
     $currentstring .= " \\item[$\Box$] ";      $currentstring .= ' \item[$\Box$] ';
  } elsif ($tempor_var ne '') {    } elsif ($type ne '') { 
     $_ = $tempor_var;      $currentstring .= ' \item['.$type.'] ';
     m/my\s*([^=]*)=/;  
     $currentstring .= " \\item[$1] ";  
  } else {   } else {
     $currentstring .= " \\item ";      $currentstring .= ' \item ';
  }     }  
     }       } 
     return $currentstring;      return $currentstring;
Line 1651  sub end_dl { Line 1654  sub end_dl {
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <dt> tag  #-- <dt> tag (end tag optional)
 sub start_dt {  sub start_dt {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring='';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\item[';     &Apache::lonxml::startredirection();; 
     }       } 
     return $currentstring;      return $currentstring;
 }  }
   
 sub end_dt {  sub end_dt {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = ']';     my $data=&item_cleanup;
    $currentstring.='\item['.$data.']';
     }       } 
     return $currentstring;      return $currentstring;
 }  }
   
   sub item_cleanup {
       my $item=&Apache::lonxml::endredirection();;
       $item=~s/\\begin{center}//g;
       $item=~s/\\end{center}//g;
       return $item;
   }
   
 #-- <dd> tag  #-- <dd> tag
 sub start_dd {  sub start_dd {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
       } elsif ($target eq 'tex') {
    if ($$tagstack[-2] eq 'dt') {
       my $data=&item_cleanup;
       $currentstring.='\item['.$data.']';
    }
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 1696  sub end_dd { Line 1712  sub end_dd {
 #-- <table> tag  #-- <table> tag
 sub start_table {  sub start_table {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $textwidth;      my $textwidth='';
     if (not defined @Apache::londefdef::table) {      if (not defined @Apache::londefdef::table) {
  $textwidth=&recalc($ENV{'form.textwidth'});   $textwidth=&recalc($ENV{'form.textwidth'});
  $textwidth=~/(\d+)/;   $textwidth=~/(\d+\.?\d*)/;
  $textwidth=$1;   $textwidth=0.95*$1;
     } else {      } else {
  $textwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);   $textwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
     }      }
Line 1742  sub start_table { Line 1758  sub start_table {
     $Apache::londefdef::table[-1]{'vvinc'} = '';      $Apache::londefdef::table[-1]{'vvinc'} = '';
  }   }
  $Apache::londefdef::table[-1]{'output'} = ' \noindent \begin{tabular} ';   $Apache::londefdef::table[-1]{'output'} = ' \noindent \begin{tabular} ';
  $currentstring = '\keephidden{NEW TABLE ENTRY '.$textwidth.'}';   $currentstring = '\keephidden{NEW TABLE ENTRY}';
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 1790  sub end_table { Line 1806  sub end_table {
  $needed=$#length_row_final-$needed+1;   $needed=$#length_row_final-$needed+1;
  for (my $jn=0;$jn<=$#length_row_final;$jn++) {   for (my $jn=0;$jn<=$#length_row_final;$jn++) {
     if ($length_row_final[$jn]==0) {      if ($length_row_final[$jn]==0) {
  if ($length_raw_row[$jn]<$available_length/3) {   if ($length_raw_row[$jn]<$available_length) {
     $length_row_final[$jn]=$length_raw_row[$jn];      $length_row_final[$jn]=$length_raw_row[$jn];
     $available_length=$available_length-$length_raw_row[$jn];      $available_length=$available_length-$length_raw_row[$jn];
     $needed--;      $needed--;
Line 1820  sub end_table { Line 1836  sub end_table {
  } else {   } else {
     $currentstring .= $Apache::londefdef::table[-1]{'output'};      $currentstring .= $Apache::londefdef::table[-1]{'output'};
     pop @Apache::londefdef::table;      pop @Apache::londefdef::table;
       undef @Apache::londefdef::table;
  }   }
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <tr> tag  #-- <tr> tag (end tag optional)
 sub start_tr {  sub start_tr {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
Line 1848  sub start_tr { Line 1865  sub start_tr {
 }  }
                   
 sub end_tr {  sub end_tr {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
    if ($Apache::londefdef::TD_redirection) {
       &end_td_tex($parstack,$parser,$safeeval);    
    }
  push @{ $Apache::londefdef::table[-1]{'TeXlengthrow'} },$Apache::londefdef::table[-1]{'TeXlength'};   push @{ $Apache::londefdef::table[-1]{'TeXlengthrow'} },$Apache::londefdef::table[-1]{'TeXlength'};
  push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'};   push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'};
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <td> tag  #-- <td> tag (end tag optional)
 sub start_td {  sub start_td {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);   $Apache::londefdef::TD_redirection = 1;
  if ($what_to_push eq '') {   &tag_check('tr','td',$tagstack,$parstack,$parser,$safeeval);
     $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);;  
  }  
  push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;  
  $Apache::londefdef::table[-1]{'counter_columns'}++;  
  &Apache::lonxml::startredirection();  
     }       } 
     return $currentstring;      return $currentstring;
 }     }   
            
   sub tag_check {
       my ($good_tag,$bad_tag,$tagstack,$parstack,$parser,$safeeval) = @_;
       my @ar=@$parstack; 
       for (my $i=$#ar-1;$i>=0;$i--) {
    if (lc($$tagstack[$i]) eq $good_tag) {
       &start_td_tex($parstack,$parser,$safeeval);
       last;
    } elsif (lc($$tagstack[$i]) eq $bad_tag) {
       splice @ar, $i+1;
       &end_td_tex(\@ar,$parser,$safeeval);
       &start_td_tex($parstack,$parser,$safeeval);
       last;
    }
       }
       return '';
   }
    
   sub start_td_tex {
       my ($parstack,$parser,$safeeval) = @_;
       my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);
       if ($what_to_push eq '') {
    $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);;
       }
       push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;
       $Apache::londefdef::table[-1]{'counter_columns'}++;
       &Apache::lonxml::startredirection();
       return '';
   }
   
   sub end_td_tex {
       my ($parstack,$parser,$safeeval) = @_;
       my $current_row = $Apache::londefdef::table[-1]{'row_number'};
       my $data=&Apache::lonxml::endredirection();
       my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
       if (defined $TeXwidth) {
    my $current_length=&recalc($TeXwidth);
    $current_length=~/(\d+)/;
    $Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';
    $Apache::londefdef::table[-1]{'length'} .= '0,';
       } else {
    if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) {
       my $current_length=&recalc($1);
       $current_length=~/(\d+\.?\d*)/;
       $Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';
       $Apache::londefdef::table[-1]{'length'} .= '0,';
    } else {  
       $data=~s/^\s+(\S.*)/$1/; 
       $data=~s/(.*\S)\s+$/$1/;
       $data=~s/(\s)+/$1/;
       my $current_length=0;
       if ($data=~/\\vskip/) {
                   my $newdata=$data;
    $newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g;
    my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata);
    foreach my $elementdata (@newdata) {
       $elementdata=~s/^\s+(\S.*)/$1/; 
       $elementdata=~s/(.*\S)\s+$/$1/;
       $elementdata=~s/(\s)+/$1/;
       my $lengthnewdata=1.8*length($elementdata);
       if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;}
    }
       } else {
    $current_length=1.8*length($data);
       }
       $Apache::londefdef::table[-1]{'length'} .= $current_length.',';
       $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';
    }        
       }
    for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) {         
       $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/;
    }
       @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
       return'';
   }
   
 sub end_td {  sub end_td {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $current_row = $Apache::londefdef::table[-1]{'row_number'};          $Apache::londefdef::TD_redirection =0;
  my $data=&Apache::lonxml::endredirection();   &end_td_tex($parstack,$parser,$safeeval);
  my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);  
  if (defined $TeXwidth) {  
     my $current_length=&recalc($TeXwidth);  
     $current_length=~/(\d+)/;  
     $Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';  
     $Apache::londefdef::table[-1]{'length'} .= '0,';  
  } else {  
     if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) {  
  my $current_length=&recalc($1);  
  $current_length=~/(\d+)/;  
  $Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';  
  $Apache::londefdef::table[-1]{'length'} .= '0,';  
     } else {       
  $data=~/^\s*(\S.*)/;  
  $data=$1;  
  $data=~/(.*\S)\s*$/;  
  $data=$1;  
  my $current_length=2*length($data);  
  $Apache::londefdef::table[-1]{'length'} .= $current_length.',';  
  $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';  
     }          
  }  
  for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) {                                  
     $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/;  
  }  
  @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};  
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <th> tag  #-- <th> tag (end tag optional)
 sub start_th {  sub start_th {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
Line 1981  sub start_img { Line 2045  sub start_img {
     my $width_param = '';      my $width_param = '';
     my $height_param = '';      my $height_param = '';
     my $scaling = .3;      my $scaling = .3;
       
     if ($target eq 'web') {      if ($target eq 'web') {
  if ($ENV{'browser.imagesuppress'} ne 'on') {   if ($ENV{'browser.imagesuppress'} ne 'on') {
     $currentstring = $token->[4];      $currentstring.= $token->[4];
  } else {   } else {
     my $alttag= &Apache::lonxml::get_param      my $alttag= &Apache::lonxml::get_param
  ('alt',$parstack,$safeeval,undef,1);   ('alt',$parstack,$safeeval,undef,1);
Line 1992  sub start_img { Line 2055  sub start_img {
  $alttag=&Apache::lonmeta::alttag   $alttag=&Apache::lonmeta::alttag
     ($Apache::lonxml::pwd[-1],$src);      ($Apache::lonxml::pwd[-1],$src);
     }      }
     $currentstring='[IMAGE: '.$alttag.']';      $currentstring.='[IMAGE: '.$alttag.']';
  }   }
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);   $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
  &image_replication($src);   &image_replication($src);
   
  #if original gif/jpg/png file exist do following:   #if original gif/jpg/png file exist do following:
  if (-e $src) {             if (-e $src) {          
     #defines the default size of image      #defines the default size of image
Line 2022  sub start_img { Line 2084  sub start_img {
     } elsif ($width ne '') {      } elsif ($width ne '') {
  $width_param = $width*$scaling;         $width_param = $width*$scaling;      
     }      }
       if ($width_param > $ENV{'form.textwidth'}) {$width_param =0.95*$ENV{'form.textwidth'}}
     my $file;      my $file;
     my $path;      my $path;
     if ($src =~ m!(.*)/([^/]*)$!) {      if ($src =~ m!(.*)/([^/]*)$!) {
Line 2194  sub start_allow { Line 2257  sub start_allow {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);      my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
     $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);      $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
     $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src;      $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
    &Apache::lonnet::clutter($src);
     &image_replication($src);      &image_replication($src);
     my $result;      my $result;
     if ($target eq 'edit') {      if ($target eq 'edit') {
Line 2224  sub start_frameset { Line 2288  sub start_frameset {
     $currentstring.='<head>'.      $currentstring.='<head>'.
  &Apache::lonmenu::registerurl(undef,$target).'</head>';   &Apache::lonmenu::registerurl(undef,$target).'</head>';
  }   }
  $currentstring .= $token->[4];   my $onLoad='';
    foreach my $key (keys(%{$token->[2]})) {
       if ($key =~ /^onload$/i) {
    $onLoad.=$token->[2]->{$key}.';';
    delete($token->[2]->{$key});
       }
    }
    $token->[2]->{'onload'}=&Apache::lonmenu::loadevents().';'.$onLoad;
    my $onUnload='';
    foreach my $key (keys(%{$token->[2]})) {
       if ($key =~ /^onunload$/i) {
    $onUnload.=$token->[2]->{$key}.';';
    delete($token->[2]->{$key});
       }
    }
    $token->[2]->{'onunload'}=&Apache::lonmenu::unloadevents().
       ';'.$onUnload;
   
    $currentstring .= '<'.$token->[1];
    foreach (keys %{$token->[2]}) {
       $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
    }
    $currentstring.='>';
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 2238  sub end_frameset { Line 2324  sub end_frameset {
     return $currentstring;      return $currentstring;
 }  }
   
   #-- <xmp>
   sub start_xmp {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
       my $currentstring = '';
       if ($target eq 'web') {
    $currentstring .= $token->[4];
       } elsif ($target eq 'tex') {
    $currentstring .= '\begin{verbatim}';
       } 
       return $currentstring;
   }
   
   sub end_xmp {
       my ($target,$token) = @_;
       my $currentstring = '';
       if ($target eq 'web') {
    $currentstring .= $token->[2];
       } elsif ($target eq 'tex') {
    $currentstring .= '\end{verbatim}';
       }
       return $currentstring;
   }
   
 #-- <pre>  #-- <pre>
 sub start_pre {  sub start_pre {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
Line 2245  sub start_pre { Line 2354  sub start_pre {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $width = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);   $currentstring .= '\begin{verbatim}';
  if (not defined $width) {$width ='\textwidth';}  
  $currentstring .= '\parbox['.$width.']{\begin{verbatim}';  
     }       } 
     return $currentstring;      return $currentstring;
 }  }
Line 2258  sub end_pre { Line 2365  sub end_pre {
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\end{verbatim}}';   $currentstring .= '\end{verbatim}';
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 2386  sub start_base { Line 2493  sub start_base {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       }
     return $currentstring;      return $currentstring;
 }  }
   
Line 3026  sub end_tbody { Line 3133  sub end_tbody {
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <tfoot> tag  #-- <tfoot> tag (end tag optional)
 sub start_tfoot {  sub start_tfoot {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
Line 3045  sub end_tfoot { Line 3152  sub end_tfoot {
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <thead> tag  #-- <thead> tag (end tag optional)
 sub start_thead {  sub start_thead {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
Line 3070  sub start_var { Line 3177  sub start_var {
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } elsif ($target eq 'tex') {
    $currentstring = '\textit{'; 
       }
     return $currentstring;      return $currentstring;
 }  }
   
Line 3078  sub end_var { Line 3187  sub end_var {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $currentstring = $token->[2];       $currentstring = $token->[2];
       } elsif ($target eq 'tex') {
    $currentstring = '}'; 
     }       } 
     return $currentstring;      return $currentstring;
 }  }
   
 #-- <wbr> tag  #-- <wbr> tag (end tag forbidden)
 sub start_wbr {  sub start_wbr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
Line 3102  sub end_wbr { Line 3213  sub end_wbr {
     return $currentstring;      return $currentstring;
 }  }
   
   #-- <hideweboutput> tag
   sub start_hideweboutput {
       my ($target,$token) = @_;
       if ($target eq 'web') {
    &Apache::lonxml::startredirection();     
       } 
       return '';
   }
   
   sub end_hideweboutput {
       my ($target,$token) = @_;
       my $currentstring = '';
       if ($target eq 'web') {
    $currentstring = &Apache::lonxml::endredirection();    
       } 
       return '';
   }
   
   
 sub image_replication {  sub image_replication {
     my $src = shift;      my $src = shift;
     if (not -e $src) {      if (not -e $src) {
Line 3123  sub image_replication { Line 3253  sub image_replication {
 sub recalc {  sub recalc {
     my $argument = shift;      my $argument = shift;
     if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';}      if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';}
     $argument=~/\s*(\d+)\s*(mm|cm|in|pc|pt)/;      $argument=~/\s*(\d+\.?\d*)\s*(mm|cm|in|pc|pt)/;
     my $value=$1;      my $value=$1;
     my $units=$2;      my $units=$2;
     if ($units eq 'cm') {      if ($units eq 'cm') {

Removed from v.1.131  
changed lines
  Added in v.1.173


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