--- loncom/xml/londefdef.pm 2004/09/15 20:30:43 1.231.2.3 +++ loncom/xml/londefdef.pm 2004/08/16 17:11:10 1.232 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.231.2.3 2004/09/15 20:30:43 albertel Exp $ +# $Id: londefdef.pm,v 1.232 2004/08/16 17:11:10 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -66,7 +66,6 @@ sub initialize_londefdef { @Apache::londefdef::description=(); $Apache::londefdef::DD_redirection=0; $Apache::londefdef::DT_redirection=0; - $Apache::londefdef::list_index=0; } #======================= TAG SUBROUTINES ===================== @@ -155,7 +154,7 @@ sub start_html { &Apache::lonxml::fontsettings(); } elsif ($target eq 'tex') { @Apache::londefdef::table = (); - $currentstring .= '\documentclass[letterpaper]{article}'; + $currentstring .= '\documentclass[letterpaper]{book}'; if ($ENV{'form.latex_type'}=~'batchmode') {$currentstring .='\batchmode';} $currentstring .= '\newcommand{\keephidden}[1]{}'. '\renewcommand{\deg}{$^{\circ}$}'. @@ -177,10 +176,10 @@ sub start_html { } sub end_html { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { - $currentstring = &Apache::lonxml::xmlend(); + $currentstring = &Apache::lonxml::xmlend($target,$parser); } return $currentstring; } @@ -1135,15 +1134,13 @@ sub end_p { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (not defined $align) { - $currentstring.='\strut\\\\\strut '; - } elsif ($align eq 'center') { + if ($align eq 'center') { $currentstring .= '\end{center}'; } elsif ($align eq 'right') { $currentstring .= '}}'; } elsif ($align eq 'left') { $currentstring .= '}\hfill}'; - } + } } return $currentstring; } @@ -1486,28 +1483,17 @@ sub start_li { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); - my $value=&Apache::lonxml::get_param('value',$parstack,$safeeval,undef,0); - #FIXME need to support types i and I - if ($type=~/disc/) { - $currentstring .= ' \item[$\bullet$] '; - } elsif ($type=~/circle/) { - $currentstring .= ' \item[$\circ$] '; + my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1); + if ($type=~/circle/) { + $currentstring .= ' \item[o] '; } elsif ($type=~/square/) { - $currentstring .= ' \item[$\diamond$] '; - } elsif ($type eq '1') { - $currentstring .= ' \item['.($Apache::londefdef::list_index+1).'.]'; - } elsif ($type eq 'A') { - $currentstring .= ' \item['.('A'..'Z')[$Apache::londefdef::list_index].'.]'; - } elsif ($type eq 'a') { - $currentstring .= ' \item['.('a'..'z')[$Apache::londefdef::list_index].'.]'; - } elsif ($value ne '') { - $currentstring .= ' \item['.$value.'] '; + $currentstring .= ' \item[$\Box$] '; + } elsif ($type ne '') { + $currentstring .= ' \item['.$type.'] '; } else { $currentstring .= ' \item '; } - $Apache::londefdef::list_index++; - } + } return $currentstring; } @@ -1554,7 +1540,6 @@ sub start_ul { $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); - $Apache::londefdef::list_index=0; if ($TeXtype eq 'disc') { $currentstring .= '\renewcommand{\labelitemi}{$\bullet$}'. '\renewcommand{\labelitemii}{$\bullet$}'. @@ -1643,7 +1628,6 @@ sub start_ol { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $Apache::londefdef::list_index=0; my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); if ($type eq '1') { $currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'. @@ -2673,7 +2657,7 @@ sub start_allow { $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= &Apache::lonnet::clutter($src); - if ($target eq 'tex') { &image_replication($src); } + &image_replication($src); my $result; if ($target eq 'edit') { $result .=&Apache::edit::tag_start($target,$token);