version 1.415.4.2, 2010/11/09 21:28:20
|
version 1.421, 2010/08/16 15:56:08
|
Line 2048 sub start_table {
|
Line 2048 sub start_table {
|
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0); |
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0); |
my $theme = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0); |
my $theme = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0); |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0); |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0); |
my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0); |
my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0); |
|
|
# The only thing that needs any figuring out is the width.. and then only if it is |
# The only thing that needs any figuring out is the width.. and then only if it is |
# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm |
# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm |
# |
# |
|
|
my $table = new Apache::lontable(); |
my $table = new Apache::lontable(); |
if ((defined $border) && ($border > 0)) { |
if ((defined $border) && ($border > 0)) { |
# &Apache::lonnet::logthis("Turning on table borders: $border"); |
# &Apache::lonnet::logthis("Turning on table borders: $border"); |
$table->table_border(1); |
$table->table_border(1); |
if ($cell_border ne 'none') { |
if ($cell_border ne 'none') { |
$table->cell_border(1); # html specs that border turns on both...unless rules='none'. |
$table->cell_border(1); # html specs that border turns on both...unless rules='none'. |
} |
} |
} |
} |
# Only all or nothing for cell borders for now: |
# Only all or nothing for cell borders for now: |
|
|
if ((defined $cell_border) && ($cell_border ne 'none')) { |
if ((defined $cell_border) && ($cell_border ne 'none')) { |
# &Apache::lonnet::logthis("Turning on cell borders: $cell_border"); |
# &Apache::lonnet::logthis("Turning on cell borders: $cell_border"); |
$table->cell_border(1); |
$table->cell_border(1); |
} |
} |
if (defined $theme) { |
if (defined $theme) { |
$table->theme($theme); |
$table->theme($theme); |
} |
} |
if (defined $align) { |
if (defined $align) { |
Line 2080 sub start_table {
|
Line 2080 sub start_table {
|
if (!(defined $width)) { |
if (!(defined $width)) { |
$width = '70%'; |
$width = '70%'; |
} |
} |
|
|
# If a percentage, need to calculate what this means in terms of |
# If a percentage, need to calculate what this means in terms of |
# page width: |
# page width: |
|
|
Line 2732 sub tag_check {
|
Line 2732 sub tag_check {
|
# |
# |
|
|
sub cell_config_hash { |
sub cell_config_hash { |
my ($align, $rowspan, $colspan, $width) = @_; |
my ($align, $rowspan, $colspan) = @_; |
my %config; |
my %config; |
if ($align ne '') { |
if ($align ne '') { |
$config{'halign'} = $align; |
$config{'halign'} = $align; |
Line 2743 sub cell_config_hash {
|
Line 2743 sub cell_config_hash {
|
if ($rowspan ne '') { |
if ($rowspan ne '') { |
$config{'rowspan'} = $rowspan; |
$config{'rowspan'} = $rowspan; |
} |
} |
if ($width ne '') { |
|
$config{'width'} = $width; |
|
} |
|
return \%config; |
return \%config; |
} |
} |
|
|
Line 2757 sub start_td_tex {
|
Line 2754 sub start_td_tex {
|
# attributes, but empty of text. end_td_tex will |
# attributes, but empty of text. end_td_tex will |
# fetch the contents from the recursive parse and |
# fetch the contents from the recursive parse and |
# fill the cell with them: |
# fill the cell with them: |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval); |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 1); |
my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval); |
my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 1); |
my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval); |
my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 1); |
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval); |
|
my $config = &cell_config_hash($align, $rowspan, $colspan, $width); |
my $config = &cell_config_hash($align, $rowspan, $colspan); |
|
|
my $table = $Apache::londefdef::table[-1]; |
my $table = $Apache::londefdef::table[-1]; |
$table->add_cell('', $config); |
$table->add_cell('', $config); |
Line 3172 sub start_img {
|
Line 3169 sub start_img {
|
# Render unto browsers that which are the browser's... |
# Render unto browsers that which are the browser's... |
|
|
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($env{'browser.imagesuppress'} ne 'on') { |
my $enc = ('yes' eq |
my $enc = ('yes' eq |
lc(&Apache::lonxml::get_param('encrypturl',$parstack, |
lc(&Apache::lonxml::get_param('encrypturl',$parstack, |
$safeeval))); |
$safeeval))); |
$currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}, |
$currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}, |
$enc); |
$enc); |
|
} else { |
|
my $alttag = &Apache::lonxml::get_param('alt',$parstack,$safeeval, |
|
undef,1); |
|
if (!$alttag) { |
|
$alttag = &Apache::lonmeta::alttag($Apache::lonxml::pwd[-1], |
|
$src); |
|
} |
|
$currentstring.='[IMAGE: '.$alttag.']'; |
|
} |
|
|
|
# and render unto TeX that which is LaTeX |
|
|
|
|
# and render unto TeX that which is LaTeX |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
# |
# |
# The alignment will require some superstructure to be put around |
# The alignment will require some superstructure to be put around |
Line 3290 sub start_img {
|
Line 3276 sub start_img {
|
['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2); |
['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2); |
my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval); |
my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval); |
my $enc= &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval); |
my $enc= &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval); |
|
|
$currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl', |
$currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl', |
['no','yes'], $token, 2); |
['no','yes'], $token, 2); |
if (($alt=~/\S/) && (lc($enc) eq 'yes')) { |
if (($alt=~/\S/) && (lc($enc) eq 'yes')) { |
Line 3304 sub start_img {
|
Line 3290 sub start_img {
|
if ($token->[2]{'src'}=~/\$/) { |
if ($token->[2]{'src'}=~/\$/) { |
$currentstring.=&mt('Variable image source'); |
$currentstring.=&mt('Variable image source'); |
} elsif ($token->[2]{'src'}=~/\S/) { |
} elsif ($token->[2]{'src'}=~/\S/) { |
$currentstring .= '<img src="'.$src.'" alt="'.$alt.'" '; |
$currentstring .= '<img src="'.$src.'" alt="'.$alt.'" '; |
if ($width) { $currentstring.=' width="'.$width.'" '; } |
if ($width) { $currentstring.=' width="'.$width.'" '; } |
if ($height) { $currentstring.=' height="'.$height.'" '; } |
if ($height) { $currentstring.=' height="'.$height.'" '; } |
$currentstring .= ' />'; |
$currentstring .= ' />'; |
} else { |
} else { |
$currentstring.=&mt("No image source specified"); |
$currentstring.=&mt("No image source specified"); |
} |
} |
Line 3378 sub start_applet {
|
Line 3364 sub start_applet {
|
&Apache::lonxml::extlink($archive); |
&Apache::lonxml::extlink($archive); |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($env{'browser.appletsuppress'} ne 'on') { |
$currentstring = &Apache::lonenc::encrypt_ref($token, |
$currentstring = &Apache::lonenc::encrypt_ref($token, |
{'code'=>$code, |
{'code'=>$code, |
'archive'=>$archive} |
'archive'=>$archive} |
); |
); |
|
} else { |
|
my $alttag= &Apache::lonxml::get_param('alt',$parstack, |
|
$safeeval,undef,1); |
|
unless ($alttag) { |
|
$alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1], |
|
$code); |
|
} |
|
$currentstring='[APPLET: '.$alttag.']'; |
|
} |
|
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
# Turn off some stuff we can't be inside thank you LaTeX |
# Turn off some stuff we can't be inside thank you LaTeX |
|
|
|
|
my $restart_sub = 0; |
my $restart_sub = 0; |
my $restart_sup = 0; |
my $restart_sup = 0; |
Line 3458 sub start_embed {
|
Line 3433 sub start_embed {
|
&Apache::lonxml::extlink($src); |
&Apache::lonxml::extlink($src); |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($env{'browser.embedsuppress'} ne 'on') { |
$currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}); |
$currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}); |
|
} else { |
|
my $alttag=&Apache::lonxml::get_param |
|
('alt',$parstack,$safeeval,undef,1); |
|
unless ($alttag) { |
|
$alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],$src); |
|
} |
|
$currentstring='[EMBED: '.$alttag.']'; |
|
} |
|
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
} |
} |
return $currentstring; |
return $currentstring; |
Line 3477 sub end_embed {
|
Line 3443 sub end_embed {
|
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
} |
# ./. |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 3917 sub end_colgroup {
|
Line 3884 sub end_colgroup {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
|
#-- <del> tag (end tag required) |
#-- <del> tag (end tag required) |
sub start_del { |
sub start_del { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
|
} elsif ($target eq 'tex') { |
|
&disable_para(); |
|
$currentstring .= '\st{'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 3931 sub end_del {
|
Line 3902 sub end_del {
|
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
|
} elsif ($target eq 'tex') { |
|
&enable_para(); |
|
$currentstring = '}'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 4867 sub latex_header {
|
Line 4841 sub latex_header {
|
"\\usepackage{xcolor}\n". |
"\\usepackage{xcolor}\n". |
'\usepackage{calc}'. |
'\usepackage{calc}'. |
'\usepackage{amsmath}'. |
'\usepackage{amsmath}'. |
|
'\usepackage{soul}', |
'\usepackage{amssymb}'. |
'\usepackage{amssymb}'. |
'\usepackage{amsfonts}'. |
'\usepackage{amsfonts}'. |
'\usepackage{amsthm}'. |
'\usepackage{amsthm}'. |