Return to londefdef.pm CVS log | Up to [LON-CAPA] / loncom / xml |
version 1.159, 2003/08/07 20:12:40 | version 1.160, 2003/08/08 17:48:40 |
---|---|
Line 51 use Image::Magick; | Line 51 use Image::Magick; |
use Apache::lonmenu(); | use Apache::lonmenu(); |
use Apache::lonmeta(); | use Apache::lonmeta(); |
$Apache::londefdef::TD_redirection=0; | |
BEGIN { | BEGIN { |
&Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput')); | &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput')); |
Line 1840 sub start_tr { | Line 1842 sub start_tr { |
} | } |
sub end_tr { | sub end_tr { |
my ($target,$token) = @_; | my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; | my $currentstring = ''; |
if ($target eq 'web') { | if ($target eq 'web') { |
$currentstring = $token->[2]; | $currentstring = $token->[2]; |
} elsif ($target eq 'tex') { | } elsif ($target eq 'tex') { |
if ($Apache::londefdef::TD_redirection) { | |
&end_td_tex($parstack,$parser,$safeeval); | |
} | |
push @{ $Apache::londefdef::table[-1]{'TeXlengthrow'} },$Apache::londefdef::table[-1]{'TeXlength'}; | push @{ $Apache::londefdef::table[-1]{'TeXlengthrow'} },$Apache::londefdef::table[-1]{'TeXlength'}; |
push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'}; | push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'}; |
} | } |
Line 1858 sub start_td { | Line 1863 sub start_td { |
if ($target eq 'web') { | if ($target eq 'web') { |
$currentstring = $token->[4]; | $currentstring = $token->[4]; |
} elsif ($target eq 'tex') { | } elsif ($target eq 'tex') { |
$Apache::londefdef::TD_redirection = 1; | |
&tag_check('tr','td',$tagstack,$parstack,$parser,$safeeval); | &tag_check('tr','td',$tagstack,$parstack,$parser,$safeeval); |
# my @ar=@$parstack; | |
# for (my $i=$#ar-1;$i>=0;$i--) { | |
# if (lc($$tagstack[$i]) eq 'tr') { | |
# &start_td_tex($parstack,$parser,$safeeval); | |
# last; | |
# } elsif (lc($$tagstack[$i]) eq 'td') { | |
# splice @ar, $i+1; | |
# &end_td_tex(\@ar,$parser,$safeeval); | |
# &start_td_tex($parstack,$parser,$safeeval); | |
# last; | |
# } | |
# } | |
} | } |
return $currentstring; | return $currentstring; |
} | } |
sub tag_check { | sub tag_check { |
my ($good_tag,$bad_tag,$tagstack,$parstack,$parser,$safeeval) = @_; | my ($good_tag,$bad_tag,$tagstack,$parstack,$parser,$safeeval) = @_; |
my @ar=@$parstack; | my @ar=@$parstack; |
for (my $i=$#ar-1;$i>=0;$i--) { | for (my $i=$#ar-1;$i>=0;$i--) { |
if (lc($$tagstack[$i]) eq $good_tag) { | if (lc($$tagstack[$i]) eq $good_tag) { |
&start_td_tex($parstack,$parser,$safeeval); | &start_td_tex($parstack,$parser,$safeeval); |
last; | last; |
} elsif (lc($$tagstack[$i]) eq $bad_tag) { | } elsif (lc($$tagstack[$i]) eq $bad_tag) { |
splice @ar, $i+1; | splice @ar, $i+1; |
&end_td_tex(\@ar,$parser,$safeeval); | &end_td_tex(\@ar,$parser,$safeeval); |
&start_td_tex($parstack,$parser,$safeeval); | &start_td_tex($parstack,$parser,$safeeval); |
last; | last; |
} | |
} | } |
} | |
return ''; | return ''; |
} | } |
Line 1941 sub end_td { | Line 1935 sub end_td { |
if ($target eq 'web') { | if ($target eq 'web') { |
$currentstring = $token->[2]; | $currentstring = $token->[2]; |
} elsif ($target eq 'tex') { | } elsif ($target eq 'tex') { |
$Apache::londefdef::TD_redirection =0; | |
&end_td_tex($parstack,$parser,$safeeval); | &end_td_tex($parstack,$parser,$safeeval); |
} | } |
return $currentstring; | return $currentstring; |