version 1.191, 2003/11/15 12:46:41
|
version 1.195, 2004/01/28 19:59:13
|
Line 84 sub end_output {
|
Line 84 sub end_output {
|
sub start_m { |
sub start_m { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
my $inside = &Apache::lonxml::get_all_text("/m",$parser,$style); |
my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); |
$inside=~s-<LONCAPA_INTERNAL_TURN_STYLE_ON />--g; |
|
if ($target eq 'web' || $target eq 'analyze') { |
if ($target eq 'web' || $target eq 'analyze') { |
$Apache::lonxml::prevent_entity_encode++; |
$Apache::lonxml::prevent_entity_encode++; |
$inside ='\\documentstyle{article}'.$inside; |
$inside ='\\documentstyle{article}'.$inside; |
Line 152 sub end_tthoption {
|
Line 151 sub end_tthoption {
|
sub start_html { |
sub start_html { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($ENV{'browser.mathml'}) { |
my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; |
&tth::ttminit(); |
&init_tth(); |
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'); |
|
} |
|
} |
|
if ($target eq 'web' || $target eq 'edit') { |
if ($target eq 'web' || $target eq 'edit') { |
$currentstring = &Apache::lonxml::xmlbegin(). |
$currentstring = &Apache::lonxml::xmlbegin(). |
&Apache::lonxml::fontsettings(); |
&Apache::lonxml::fontsettings(); |
Line 2114 sub start_img {
|
Line 2100 sub start_img {
|
} |
} |
$currentstring.='[IMAGE: '.$alttag.']'; |
$currentstring.='[IMAGE: '.$alttag.']'; |
} |
} |
|
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
|
&image_replication($src); |
} 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 |
my $image = Image::Magick->new; |
my $image = Image::Magick->new; |
my $current_figure = $image->Read($src); |
my $current_figure = $image->Read($src); |
Line 2167 sub start_img {
|
Line 2155 sub start_img {
|
$currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
$currentstring .= '\vskip 1 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
} |
} |
} else { |
} else { |
#there aren't eps or ps - so create eps |
#care about eps dynamical generation |
my $temp_file; |
$currentstring.='\vskip 1 mm '.&eps_generation($src,$file,$width_param); |
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/\/([^\/]+)\.(ps|eps)/\//; |
|
$currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
|
} |
} |
} |
} |
} else { |
} else { |
Line 3358 sub image_replication {
|
Line 3340 sub image_replication {
|
return ''; |
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 { |
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';} |