--- loncom/xml/londefdef.pm 2003/09/25 16:09:14 1.173 +++ loncom/xml/londefdef.pm 2003/09/26 18:59:59 1.174 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.173 2003/09/25 16:09:14 sakharuk Exp $ +# $Id: londefdef.pm,v 1.174 2003/09/26 18:59:59 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -1638,18 +1638,32 @@ sub start_dl { if ($target eq 'web') { $currentstring = $token->[4]; } 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; } sub end_dl { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; } 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; } @@ -1661,7 +1675,16 @@ sub start_dt { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - &Apache::lonxml::startredirection();; + 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; } @@ -1673,13 +1696,14 @@ sub end_dt { $currentstring = $token->[2]; } elsif ($target eq 'tex') { my $data=&item_cleanup; - $currentstring.='\item['.$data.']'; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; } return $currentstring; } sub item_cleanup { - my $item=&Apache::lonxml::endredirection();; + my $item=&Apache::lonxml::endredirection(); $item=~s/\\begin{center}//g; $item=~s/\\end{center}//g; return $item; @@ -1692,20 +1716,26 @@ sub start_dd { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - if ($$tagstack[-2] eq 'dt') { + if ($Apache::londefdef::DT_redirection) { my $data=&item_cleanup; - $currentstring.='\item['.$data.']'; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; } + $Apache::londefdef::DD_redirection=1; + &Apache::lonxml::startredirection(); } return $currentstring; } sub end_dd { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; - } + } elsif ($target eq 'tex') { + $Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); + $Apache::londefdef::DD_redirection=0; + } return $currentstring; }