version 1.232, 2004/08/16 17:11:10
|
version 1.242, 2004/10/12 22:55:22
|
Line 66 sub initialize_londefdef {
|
Line 66 sub initialize_londefdef {
|
@Apache::londefdef::description=(); |
@Apache::londefdef::description=(); |
$Apache::londefdef::DD_redirection=0; |
$Apache::londefdef::DD_redirection=0; |
$Apache::londefdef::DT_redirection=0; |
$Apache::londefdef::DT_redirection=0; |
|
$Apache::londefdef::list_index=0; |
} |
} |
|
|
#======================= TAG SUBROUTINES ===================== |
#======================= TAG SUBROUTINES ===================== |
Line 150 sub start_html {
|
Line 151 sub start_html {
|
my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; |
my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; |
&Apache::lontexconvert::init_tth(); |
&Apache::lontexconvert::init_tth(); |
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(); |
|
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
@Apache::londefdef::table = (); |
@Apache::londefdef::table = (); |
$currentstring .= '\documentclass[letterpaper]{book}'; |
$currentstring .= '\documentclass[letterpaper]{book}'; |
Line 189 sub start_head {
|
Line 189 sub start_head {
|
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4].&Apache::lonxml::fontsettings(); |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1134 sub end_p {
|
Line 1134 sub end_p {
|
$currentstring .= $token->[2]; |
$currentstring .= $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
if ($align eq 'center') { |
if (not defined $align) { |
|
$currentstring.='\strut\\\\\strut '; |
|
} elsif ($align eq 'center') { |
$currentstring .= '\end{center}'; |
$currentstring .= '\end{center}'; |
} elsif ($align eq 'right') { |
} elsif ($align eq 'right') { |
$currentstring .= '}}'; |
$currentstring .= '}}'; |
} elsif ($align eq 'left') { |
} elsif ($align eq 'left') { |
$currentstring .= '}\hfill}'; |
$currentstring .= '}\hfill}'; |
} |
} |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1483 sub start_li {
|
Line 1485 sub start_li {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1); |
my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); |
if ($type=~/circle/) { |
my $value=&Apache::lonxml::get_param('value',$parstack,$safeeval,undef,0); |
$currentstring .= ' \item[o] '; |
#FIXME need to support types i and I |
|
if ($type=~/disc/) { |
|
$currentstring .= ' \item[$\bullet$] '; |
|
} elsif ($type=~/circle/) { |
|
$currentstring .= ' \item[$\circ$] '; |
} elsif ($type=~/square/) { |
} elsif ($type=~/square/) { |
$currentstring .= ' \item[$\Box$] '; |
$currentstring .= ' \item[$\diamond$] '; |
} elsif ($type ne '') { |
} elsif ($type eq '1') { |
$currentstring .= ' \item['.$type.'] '; |
$currentstring .= ' \item['.($Apache::londefdef::list_index+1).'.]'; |
|
} elsif ($type eq 'A') { |
|
$currentstring .= ' \item['.('A'..'Z')[$Apache::londefdef::list_index].'.]'; |
|
} elsif ($type eq 'a') { |
|
$currentstring .= ' \item['.('a'..'z')[$Apache::londefdef::list_index].'.]'; |
|
} elsif ($value ne '') { |
|
$currentstring .= ' \item['.$value.'] '; |
} else { |
} else { |
$currentstring .= ' \item '; |
$currentstring .= ' \item '; |
} |
} |
} |
$Apache::londefdef::list_index++; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 1540 sub start_ul {
|
Line 1553 sub start_ul {
|
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); |
my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); |
|
$Apache::londefdef::list_index=0; |
if ($TeXtype eq 'disc') { |
if ($TeXtype eq 'disc') { |
$currentstring .= '\renewcommand{\labelitemi}{$\bullet$}'. |
$currentstring .= '\renewcommand{\labelitemi}{$\bullet$}'. |
'\renewcommand{\labelitemii}{$\bullet$}'. |
'\renewcommand{\labelitemii}{$\bullet$}'. |
Line 1628 sub start_ol {
|
Line 1642 sub start_ol {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
$Apache::londefdef::list_index=0; |
my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); |
my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); |
if ($type eq '1') { |
if ($type eq '1') { |
$currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'. |
$currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'. |
Line 2418 sub start_img {
|
Line 2433 sub start_img {
|
$currentstring.='[IMAGE: '.$alttag.']'; |
$currentstring.='[IMAGE: '.$alttag.']'; |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
my $oldSRC=$src; |
|
$oldSRC=~s/\.(gif|jpg|png)$/\.eps/; |
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
#if uploaded restore the path |
|
if ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/simplepage\/([^\/]+)$/) { |
|
$src=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$3; |
|
} elsif ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) { |
|
$src=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3; |
|
} |
|
#if original gif/jpg/png file exist do following: |
#if original gif/jpg/png file exist do following: |
if (-e $src) { |
if (-e $src) { |
#what is the image size? |
#what is the image size? |
Line 2432 sub start_img {
|
Line 2443 sub start_img {
|
my ($file,$path)=&file_path($src); |
my ($file,$path)=&file_path($src); |
my $newsrc = $src; |
my $newsrc = $src; |
$newsrc =~ s/\.(gif|jpg|png)$/.eps/i; |
$newsrc =~ s/\.(gif|jpg|png)$/.eps/i; |
|
&Apache::lonnet::repcopy($oldSRC); |
$file=~s/\.(gif|jpg|png)$/.eps/i; |
$file=~s/\.(gif|jpg|png)$/.eps/i; |
#where can we find the picture? |
#where can we find the picture? |
if (-e $newsrc) { |
if (-e $newsrc) { |
Line 2477 sub start_img {
|
Line 2489 sub start_img {
|
$currentstring .=&Apache::edit::text_arg('height (pixel):','height',$token,5).'<br />'; |
$currentstring .=&Apache::edit::text_arg('height (pixel):','height',$token,5).'<br />'; |
$currentstring .=&Apache::edit::text_arg('TeXwidth (mm):','TeXwidth',$token,5); |
$currentstring .=&Apache::edit::text_arg('TeXwidth (mm):','TeXwidth',$token,5); |
$currentstring .=&Apache::edit::text_arg('TeXheight (mm):','TeXheight',$token,5); |
$currentstring .=&Apache::edit::text_arg('TeXheight (mm):','TeXheight',$token,5); |
|
$currentstring .=&Apache::edit::select_arg('Alignment:','align', |
|
['','bottom','middle','top','left','right'],$token,5); |
$currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
$currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval); |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval); |
my $alt=&Apache::lonxml::get_param('alt',$parstack,$safeeval); |
my $alt=&Apache::lonxml::get_param('alt',$parstack,$safeeval); |
Line 2490 sub start_img {
|
Line 2504 sub start_img {
|
my ($osrc,$owidth,$oheight)= |
my ($osrc,$owidth,$oheight)= |
($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'}); |
($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'}); |
my $ctag=&Apache::edit::get_new_args($token,$parstack, |
my $ctag=&Apache::edit::get_new_args($token,$parstack, |
$safeeval,'src','alt', |
$safeeval,'src','alt','align', |
'TeXwidth','TeXheight', |
'TeXwidth','TeXheight', |
'width','height'); |
'width','height'); |
my ($nsrc,$nwidth,$nheight)= |
my ($nsrc,$nwidth,$nheight)= |
Line 2657 sub start_allow {
|
Line 2671 sub start_allow {
|
$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]= |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
&Apache::lonnet::clutter($src); |
&Apache::lonnet::clutter($src); |
&image_replication($src); |
if ($target eq 'tex') { &image_replication($src); } |
my $result; |
my $result; |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$result .=&Apache::edit::tag_start($target,$token); |
$result .=&Apache::edit::tag_start($target,$token); |
Line 3698 sub eps_generation {
|
Line 3712 sub eps_generation {
|
$newsrc=~s/\/home\/httpd\/lonUsers//; |
$newsrc=~s/\/home\/httpd\/lonUsers//; |
$newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//; |
$newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//; |
} |
} |
return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
if ($newsrc=~/\/userfiles\//) { |
|
return ' \graphicspath{{'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
|
} else { |
|
return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
|
} |
} |
} |
|
|
sub file_path { |
sub file_path { |