version 1.128, 2003/04/18 14:55:40
|
version 1.135, 2003/05/22 16:00:53
|
Line 54 use Apache::lonmeta();
|
Line 54 use Apache::lonmeta();
|
|
|
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')); |
&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 354 sub start_meta {
|
Line 354 sub start_meta {
|
} else { |
} else { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
} |
} elsif ($target eq 'meta') { |
if ($target eq 'meta') { |
|
unless (&Apache::lonxml::get_param |
unless (&Apache::lonxml::get_param |
('http-equiv',$parstack,$safeeval,undef,1)) { |
('http-equiv',$parstack,$safeeval,undef,1)) { |
my $name=$token->[2]->{'name'}; |
my $name=$token->[2]->{'name'}; |
Line 366 sub start_meta {
|
Line 365 sub start_meta {
|
$currentstring='<'.$name.'>'. |
$currentstring='<'.$name.'>'. |
&Apache::lonxml::get_param |
&Apache::lonxml::get_param |
('content',$parstack,$safeeval,undef,1). |
('content',$parstack,$safeeval,undef,1). |
'</'.$name.'>'; |
'</'.$name.'>'; |
} |
} |
} |
} |
|
} elsif ($target eq 'tex') { |
|
&Apache::lonxml::startredirection(); |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 382 sub end_meta {
|
Line 383 sub end_meta {
|
if ($args ne '') { |
if ($args ne '') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
} |
} elsif ($target eq 'tex') { |
|
$currentstring=&Apache::lonxml::endredirection(); |
|
$currentstring=''; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 1697 sub end_dd {
|
Line 1701 sub end_dd {
|
sub start_table { |
sub start_table { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $textwidth; |
my $textwidth; |
if ($#Apache::londefdef::table==0) { |
if (not defined @Apache::londefdef::table) { |
$textwidth=&recalc($ENV{'form.textwidth'}); |
$textwidth=&recalc($ENV{'form.textwidth'}); |
$textwidth=~/(\d+)/; |
$textwidth=~/(\d+)/; |
$textwidth=$1; |
$textwidth=$1; |
Line 1742 sub start_table {
|
Line 1746 sub start_table {
|
$Apache::londefdef::table[-1]{'vvinc'} = ''; |
$Apache::londefdef::table[-1]{'vvinc'} = ''; |
} |
} |
$Apache::londefdef::table[-1]{'output'} = ' \noindent \begin{tabular} '; |
$Apache::londefdef::table[-1]{'output'} = ' \noindent \begin{tabular} '; |
$currentstring = '\keephidden{NEW TABLE ENTRY}'; |
$currentstring = '\keephidden{NEW TABLE ENTRY '.$textwidth.'}'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1761 sub end_table {
|
Line 1765 sub end_table {
|
$header_of_table .= $Apache::londefdef::table[-1]{'columns'}[$in].$Apache::londefdef::table[-1]{'vvinc'}; |
$header_of_table .= $Apache::londefdef::table[-1]{'columns'}[$in].$Apache::londefdef::table[-1]{'vvinc'}; |
} |
} |
$header_of_table .= '}'; |
$header_of_table .= '}'; |
|
|
|
|
#define the length of the table cells |
#define the length of the table cells |
#always starts with TeXwidth (if defined everything else is ignored) |
#always starts with TeXwidth (if defined everything else is ignored) |
my @length_row_final = split(/,/,$Apache::londefdef::table[-1]{'TeXlengthrow'}[0]); |
my @length_row_final = split(/,/,$Apache::londefdef::table[-1]{'TeXlengthrow'}[0]); |
Line 1818 sub end_table {
|
Line 1820 sub end_table {
|
if ($#Apache::londefdef::table > 0) { |
if ($#Apache::londefdef::table > 0) { |
my $inmemory = $Apache::londefdef::table[-1]{'output'}; |
my $inmemory = $Apache::londefdef::table[-1]{'output'}; |
pop @Apache::londefdef::table; |
pop @Apache::londefdef::table; |
$Apache::londefdef::table[-1]{'include'}=$inmemory; |
push @{$Apache::londefdef::table[-1]{'include'}}, $inmemory; |
} else { |
} else { |
$currentstring .= $Apache::londefdef::table[-1]{'output'}; |
$currentstring .= $Apache::londefdef::table[-1]{'output'}; |
pop @Apache::londefdef::table; |
pop @Apache::londefdef::table; |
Line 1896 sub end_td {
|
Line 1898 sub end_td {
|
} else { |
} else { |
if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) { |
if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) { |
my $current_length=&recalc($1); |
my $current_length=&recalc($1); |
$current_length=~/(\d+)/; |
$current_length=~/(\d+\.?\d*)/; |
$Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; |
$Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; |
$Apache::londefdef::table[-1]{'length'} .= '0,'; |
$Apache::londefdef::table[-1]{'length'} .= '0,'; |
} else { |
} else { |
Line 1908 sub end_td {
|
Line 1910 sub end_td {
|
$Apache::londefdef::table[-1]{'length'} .= $current_length.','; |
$Apache::londefdef::table[-1]{'length'} .= $current_length.','; |
$Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; |
$Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; |
} |
} |
} |
} |
$data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}/; |
for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) { |
|
$data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; |
|
} |
@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; |
@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; |
} |
} |
return $currentstring; |
return $currentstring; |
Line 1929 sub start_th {
|
Line 1933 sub start_th {
|
push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push; |
push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push; |
$Apache::londefdef::table[-1]{'counter_columns'}++; |
$Apache::londefdef::table[-1]{'counter_columns'}++; |
&Apache::lonxml::startredirection(); |
&Apache::lonxml::startredirection(); |
; |
|
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
sub end_th { |
sub end_th { |
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') { |
my $current_row = $Apache::londefdef::table[-1]{'row_number'}; |
my $current_row = $Apache::londefdef::table[-1]{'row_number'}; |
my $data=&Apache::lonxml::endredirection(); |
my $data=&Apache::lonxml::endredirection(); |
if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) { |
my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
$Apache::londefdef::table[-1]{'length'} .= $1.','; |
if (defined $TeXwidth) { |
|
my $current_length=&recalc($TeXwidth); |
|
$current_length=~/(\d+)/; |
|
$Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; |
|
$Apache::londefdef::table[-1]{'length'} .= '0,'; |
} else { |
} else { |
$Apache::londefdef::table[-1]{'length'} .= '0 mm,'; |
if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) { |
} |
my $current_length=&recalc($1); |
@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{\textbf{'.$data.'}} '.$Apache::londefdef::table[-1]{'vinc'}; |
$current_length=~/(\d+)/; |
|
$Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; |
|
$Apache::londefdef::table[-1]{'length'} .= '0,'; |
|
} else { |
|
$data=~/^\s*(\S.*)/; |
|
$data=$1; |
|
$data=~/(.*\S)\s*$/; |
|
$data=$1; |
|
my $current_length=2*length($data); |
|
$Apache::londefdef::table[-1]{'length'} .= $current_length.','; |
|
$Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; |
|
} |
|
} |
|
for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) { |
|
$data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; |
|
} |
|
$data='\textbf{'.$data.'}'; |
|
@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <img> tag |
#-- <img> tag |
sub start_img { |
sub start_img { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
Line 2205 sub start_frameset {
|
Line 2228 sub start_frameset {
|
$currentstring.='<head>'. |
$currentstring.='<head>'. |
&Apache::lonmenu::registerurl(undef,$target).'</head>'; |
&Apache::lonmenu::registerurl(undef,$target).'</head>'; |
} |
} |
$currentstring .= $token->[4]; |
my $onLoad=''; |
|
foreach my $key (keys(%{$token->[2]})) { |
|
if ($key =~ /^onload$/i) { |
|
$onLoad.=$token->[2]->{$key}.';'; |
|
delete($token->[2]->{$key}); |
|
} |
|
} |
|
$token->[2]->{'onload'}=&Apache::lonmenu::loadevents().';'.$onLoad; |
|
my $onUnload=''; |
|
foreach my $key (keys(%{$token->[2]})) { |
|
if ($key =~ /^onunload$/i) { |
|
$onUnload.=$token->[2]->{$key}.';'; |
|
delete($token->[2]->{$key}); |
|
} |
|
} |
|
$token->[2]->{'onunload'}=&Apache::lonmenu::unloadevents(). |
|
';'.$onUnload; |
|
|
|
$currentstring .= '<'.$token->[1]; |
|
foreach (keys %{$token->[2]}) { |
|
$currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; |
|
} |
|
$currentstring.='>'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 3083 sub end_wbr {
|
Line 3128 sub end_wbr {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
|
|
#-- <hideweboutput> tag |
|
sub start_hideweboutput { |
|
my ($target,$token) = @_; |
|
if ($target eq 'web') { |
|
&Apache::lonxml::startredirection(); |
|
} |
|
return ''; |
|
} |
|
|
|
sub end_hideweboutput { |
|
my ($target,$token) = @_; |
|
my $currentstring = ''; |
|
if ($target eq 'web') { |
|
$currentstring = &Apache::lonxml::endredirection(); |
|
} |
|
return ''; |
|
} |
|
|
|
|
sub image_replication { |
sub image_replication { |
my $src = shift; |
my $src = shift; |
if (not -e $src) { |
if (not -e $src) { |
Line 3104 sub image_replication {
|
Line 3169 sub image_replication {
|
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';} |
$argument=~/\s*(\d+)\s*(mm|cm|in|pc|pt)/; |
$argument=~/\s*(\d+\.?\d*)\s*(mm|cm|in|pc|pt)/; |
my $value=$1; |
my $value=$1; |
my $units=$2; |
my $units=$2; |
if ($units eq 'cm') { |
if ($units eq 'cm') { |