--- loncom/xml/londefdef.pm 2004/01/08 19:49:59 1.192 +++ loncom/xml/londefdef.pm 2004/01/28 20:41:15 1.196 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.192 2004/01/08 19:49:59 sakharuk Exp $ +# $Id: londefdef.pm,v 1.196 2004/01/28 20:41:15 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -84,8 +84,7 @@ sub end_output { sub start_m { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $currentstring = ''; - my $inside = &Apache::lonxml::get_all_text("/m",$parser,$style); - $inside=~s---g; + my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); if ($target eq 'web' || $target eq 'analyze') { $Apache::lonxml::prevent_entity_encode++; $inside ='\\documentstyle{article}'.$inside; @@ -152,21 +151,8 @@ sub end_tthoption { sub start_html { my ($target,$token) = @_; my $currentstring = ''; - if ($ENV{'browser.mathml'}) { - &tth::ttminit(); - if ($ENV{'browser.unicode'}) { - &tth::ttmoptions('-L -u1'); - } else { - &tth::ttmoptions('-L -u0'); - } - } else { - &tth::tthinit(); - if ($ENV{'browser.unicode'}) { - &tth::tthoptions('-L -u1'); - } else { - &tth::tthoptions('-L -u0'); - } - } + my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; + &Apache::lontexconvert::init_tth(); if ($target eq 'web' || $target eq 'edit') { $currentstring = &Apache::lonxml::xmlbegin(). &Apache::lonxml::fontsettings(); @@ -2114,6 +2100,8 @@ sub start_img { } $currentstring.='[IMAGE: '.$alttag.']'; } + $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); + &image_replication($src); } elsif ($target eq 'tex') { $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); &image_replication($src); @@ -2167,16 +2155,8 @@ sub start_img { $currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; } } else { - #there aren't eps or ps - so create eps - my $temp_file; - my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; - $temp_file = Apache::File->new('>>'.$filename); - print $temp_file "$src\n"; - $newsrc=~s/\/home\/httpd\/html\/res//; - $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//; - $newsrc=~s/\/\.\//\//; - $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//; - $currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; + #care about eps dynamical generation + $currentstring.='\vskip 1 mm '.&eps_generation($src,$file,$width_param); } } } else { @@ -3360,6 +3340,20 @@ sub image_replication { return ''; } +sub eps_generation { + my ($src,$file,$width_param) = @_; + my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; + my $temp_file = Apache::File->new('>>'.$filename); + print $temp_file "$src\n"; + my $newsrc = $src; + $newsrc =~ s/(\.gif|\.jpg|\.jpeg)$/\.eps/i; + $newsrc=~s/\/home\/httpd\/html\/res//; + $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//; + $newsrc=~s/\/\.\//\//; + $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//; + return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; +} + sub recalc { my $argument = shift; if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';}