version 1.163, 2003/08/20 15:27:52
|
version 1.174, 2003/09/26 18:59:59
|
Line 323 sub start_title {
|
Line 323 sub start_title {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring .= '\keephidden{' |
$currentstring .= '\keephidden{Title of the document: ' |
} |
} |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
$currentstring='<title>'; |
$currentstring='<title>'; |
Line 398 sub start_meta {
|
Line 398 sub start_meta {
|
} |
} |
|
|
sub end_meta { |
sub end_meta { |
my ($target,$token,$tagstack,$parstack,$parser) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $args=''; |
my $args=''; |
Line 407 sub end_meta {
|
Line 407 sub end_meta {
|
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring=&Apache::lonxml::endredirection(); |
my $content=&Apache::lonxml::get_param('content',$parstack,$safeeval); |
$currentstring=''; |
my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval); |
|
if ((not defined $content) && (not defined $name)) { |
|
&Apache::lonxml::endredirection(); |
|
} |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 463 sub start_body {
|
Line 466 sub start_body {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
|
if ($Apache::lonhomework::parsing_a_problem) { |
|
&Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems."); |
|
return ''; |
|
} |
if (!$Apache::lonxml::registered) { |
if (!$Apache::lonxml::registered) { |
$currentstring.='<head>'. |
$currentstring.='<head>'. |
&Apache::lonmenu::registerurl(undef,$target).'</head>'; |
&Apache::lonmenu::registerurl(undef,$target).'</head>'; |
Line 534 sub end_body {
|
Line 541 sub end_body {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring = '\end{document}'; |
$currentstring = '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1418 sub start_a {
|
Line 1425 sub start_a {
|
} |
} |
|
|
sub end_a { |
sub end_a { |
my ($target,$token,$tagstack,$parstack,$safeeval) = @_; |
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]; |
Line 1428 sub end_a {
|
Line 1435 sub end_a {
|
|
|
#-- <li> tag |
#-- <li> tag |
sub start_li { |
sub start_li { |
my ($target,$token,$tagstack,$parstack,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
Line 1631 sub start_dl {
|
Line 1638 sub start_dl {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring = '\begin{description}'; |
$currentstring = '\begin{description}'; |
|
@Apache::londefdef::description=(); |
|
$Apache::londefdef::DD_redirection=0; |
|
$Apache::londefdef::DT_redirection=0; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
sub end_dl { |
sub end_dl { |
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') { |
$currentstring = '\end{description}'; |
if ($Apache::londefdef::DT_redirection) { |
|
my $data=&item_cleanup; |
|
push @Apache::londefdef::description,'\item['.$data.']'; |
|
$Apache::londefdef::DT_redirection=0; |
|
} elsif ($Apache::londefdef::DD_redirection) { |
|
$Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); |
|
} |
|
foreach my $element (@Apache::londefdef::description) { |
|
$currentstring.=' '.$element.' '; |
|
} |
|
@Apache::londefdef::description=(); |
|
$currentstring.='\end{description}'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <dt> tag |
#-- <dt> tag (end tag optional) |
sub start_dt { |
sub start_dt { |
my ($target,$token) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring=''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring = '\item['; |
if ($Apache::londefdef::DT_redirection) { |
|
my $data=&item_cleanup; |
|
push @Apache::londefdef::description,'\item['.$data.']'; |
|
$Apache::londefdef::DT_redirection=0; |
|
} elsif ($Apache::londefdef::DD_redirection) { |
|
$Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); |
|
$Apache::londefdef::DD_redirection=0; |
|
} |
|
&Apache::lonxml::startredirection(); |
|
$Apache::londefdef::DT_redirection=1; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
sub end_dt { |
sub end_dt { |
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') { |
$currentstring = ']'; |
my $data=&item_cleanup; |
|
push @Apache::londefdef::description,'\item['.$data.']'; |
|
$Apache::londefdef::DT_redirection=0; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
sub item_cleanup { |
|
my $item=&Apache::lonxml::endredirection(); |
|
$item=~s/\\begin{center}//g; |
|
$item=~s/\\end{center}//g; |
|
return $item; |
|
} |
|
|
#-- <dd> tag |
#-- <dd> tag |
sub start_dd { |
sub start_dd { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
Line 1677 sub start_dd {
|
Line 1716 sub start_dd {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
if ($$tagstack[-2] eq 'dl') { |
if ($Apache::londefdef::DT_redirection) { |
$currentstring = ' \item [] '; |
my $data=&item_cleanup; |
} elsif ($$tagstack[-2] eq 'dt') { |
push @Apache::londefdef::description,'\item['.$data.']'; |
$currentstring = ']'; |
$Apache::londefdef::DT_redirection=0; |
} |
} |
|
$Apache::londefdef::DD_redirection=1; |
|
&Apache::lonxml::startredirection(); |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
sub end_dd { |
sub end_dd { |
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') { |
|
$Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); |
|
$Apache::londefdef::DD_redirection=0; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 1792 sub end_table {
|
Line 1836 sub end_table {
|
$needed=$#length_row_final-$needed+1; |
$needed=$#length_row_final-$needed+1; |
for (my $jn=0;$jn<=$#length_row_final;$jn++) { |
for (my $jn=0;$jn<=$#length_row_final;$jn++) { |
if ($length_row_final[$jn]==0) { |
if ($length_row_final[$jn]==0) { |
if ($length_raw_row[$jn]<$available_length/3) { |
if ($length_raw_row[$jn]<$available_length) { |
$length_row_final[$jn]=$length_raw_row[$jn]; |
$length_row_final[$jn]=$length_raw_row[$jn]; |
$available_length=$available_length-$length_raw_row[$jn]; |
$available_length=$available_length-$length_raw_row[$jn]; |
$needed--; |
$needed--; |
Line 1828 sub end_table {
|
Line 1872 sub end_table {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <tr> tag |
#-- <tr> tag (end tag optional) |
sub start_tr { |
sub start_tr { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1865 sub end_tr {
|
Line 1909 sub end_tr {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <td> tag |
#-- <td> tag (end tag optional) |
sub start_td { |
sub start_td { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1924 sub end_td_tex {
|
Line 1968 sub end_td_tex {
|
$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 { |
$data=~s/^\s+(\S.*)/$1/; |
$data=~s/^\s+(\S.*)/$1/; |
$data=~s/(.*\S)\s+$/$1/; |
$data=~s/(.*\S)\s+$/$1/; |
my $current_length=2*length($data); |
$data=~s/(\s)+/$1/; |
|
my $current_length=0; |
|
if ($data=~/\\vskip/) { |
|
my $newdata=$data; |
|
$newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g; |
|
my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata); |
|
foreach my $elementdata (@newdata) { |
|
$elementdata=~s/^\s+(\S.*)/$1/; |
|
$elementdata=~s/(.*\S)\s+$/$1/; |
|
$elementdata=~s/(\s)+/$1/; |
|
my $lengthnewdata=1.8*length($elementdata); |
|
if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;} |
|
} |
|
} else { |
|
$current_length=1.8*length($data); |
|
} |
$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,'; |
} |
} |
Line 1950 sub end_td {
|
Line 2009 sub end_td {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <th> tag |
#-- <th> tag (end tag optional) |
sub start_th { |
sub start_th { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 3104 sub end_tbody {
|
Line 3163 sub end_tbody {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <tfoot> tag |
#-- <tfoot> tag (end tag optional) |
sub start_tfoot { |
sub start_tfoot { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 3123 sub end_tfoot {
|
Line 3182 sub end_tfoot {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <thead> tag |
#-- <thead> tag (end tag optional) |
sub start_thead { |
sub start_thead { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |