--- loncom/xml/londefdef.pm 2003/10/24 21:31:05 1.188 +++ loncom/xml/londefdef.pm 2003/11/15 12:46:41 1.191 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.188 2003/10/24 21:31:05 albertel Exp $ +# $Id: londefdef.pm,v 1.191 2003/11/15 12:46:41 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -82,11 +82,12 @@ sub end_output { } #-- tag sub start_m { - my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $currentstring = ''; - if ($target eq 'web') { + my $inside = &Apache::lonxml::get_all_text("/m",$parser,$style); + $inside=~s---g; + if ($target eq 'web' || $target eq 'analyze') { $Apache::lonxml::prevent_entity_encode++; - my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); $inside ='\\documentstyle{article}'.$inside; &Apache::lonxml::debug("M is starting with:$inside:"); my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); @@ -103,15 +104,13 @@ sub start_m { #&Apache::lonxml::debug("M is ends with:$currentstring:"); $Apache::lonxml::post_evaluate=0; } elsif ($target eq 'tex') { - $currentstring = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); + $currentstring = $inside; my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); if ($eval eq 'on') { $currentstring=&Apache::run::evaluate($currentstring,$safeeval,$$parstack[-1]); } if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';} $Apache::lonxml::post_evaluate=0; - } else { - my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); } return $currentstring; } @@ -2093,6 +2092,11 @@ sub start_img { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval, undef,1); + if (not $src and ($target eq 'web' or $target eq 'tex')) { + my $inside = &Apache::lonxml::get_all_text("/img",$parser); + &Apache::lonnet::logthis("inside was $inside"); + return ''; + } $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; my $currentstring = ''; my $width_param = ''; @@ -2211,6 +2215,7 @@ sub start_img { $safeeval,'src','alt', 'TeXwidth','TeXheight', 'width','height'); + $src=$token->[2]{'src'}; if (!$token->[2]{'width'} && !$token->[2]{'height'}) { $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); &image_replication($src);