--- loncom/xml/londefdef.pm 2007/03/13 15:05:19 1.360 +++ loncom/xml/londefdef.pm 2007/03/22 22:34:23 1.361 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.360 2007/03/13 15:05:19 foxr Exp $ +# $Id: londefdef.pm,v 1.361 2007/03/22 22:34:23 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -1461,6 +1461,27 @@ sub start_hr { if ($target eq 'web' || $target eq 'webgrade') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { + + #
can't be inside of thank you LaTeX. + # + my $restart_sub = 0; + my $restart_sup = 0; + + # Since and are simple tags it's ok to turn off/on + # using the start_ stop_ functions.. those tags only care about + # $target. + + if (&is_inside_of($tagstack, "sub")) { + $restart_sub = 1; + $currentstring .= &end_sub($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + if (&is_inside_of($tagstack, "sup")) { + $restart_sup = 1; + $currentstring .= &end_sup($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); if (defined $LaTeXwidth) { if ($LaTeXwidth=~/^%/) { @@ -1481,6 +1502,16 @@ sub start_hr { } $currentstring .= ' \vskip 0 mm \noindent\makebox['.$LaTeXwidth.']{'.$pre.'\makebox['. $LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm '; + # Turn stuff back on that we can't be inside of. + + if ($restart_sub) { + $currentstring .= &start_sub($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + if ($restart_sup) { + $currentstring .= &start_sup($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } } return $currentstring; } @@ -3059,6 +3090,29 @@ sub start_applet { $currentstring='[APPLET: '.$alttag.']'; } } elsif ($target eq 'tex') { + # Turn off some stuff we can't be inside thank you LaTeX + + + my $restart_sub = 0; + my $restart_sup = 0; + + # Since and are simple tags it's ok to turn off/on + # using the start_ stop_ functions.. those tags only care about + # $target. + + if (&is_inside_of($tagstack, "sub")) { + $restart_sub = 1; + $currentstring .= &end_sub($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + if (&is_inside_of($tagstack, "sup")) { + $restart_sup = 1; + $currentstring .= &end_sup($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + + # Now process the applet; just replace it with its alt attribute. + my $alttag= &Apache::lonxml::get_param('alt',$parstack, $safeeval,undef,1); unless ($alttag) { @@ -3069,6 +3123,17 @@ sub start_applet { } $currentstring.='\begin{center} \fbox{Java Applet: '.$alttag. '.}\end{center}'; + + # Turn stuff back on that we can't be inside of. + + if ($restart_sub) { + $currentstring .= &start_sub($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } + if ($restart_sup) { + $currentstring .= &start_sup($target, $token, $tagstack, + $parstack, $parser, $safeeval); + } } return $currentstring; }