--- loncom/xml/londefdef.pm 2004/07/20 15:05:32 1.231 +++ loncom/xml/londefdef.pm 2004/08/25 20:16:44 1.231.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.231 2004/07/20 15:05:32 sakharuk Exp $ +# $Id: londefdef.pm,v 1.231.2.2 2004/08/25 20:16:44 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -66,6 +66,7 @@ sub initialize_londefdef { @Apache::londefdef::description=(); $Apache::londefdef::DD_redirection=0; $Apache::londefdef::DT_redirection=0; + $Apache::londefdef::list_index=0; } #======================= TAG SUBROUTINES ===================== @@ -1134,13 +1135,15 @@ sub end_p { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if ($align eq 'center') { + if (not defined $align) { + $currentstring.='\strut\\\\\strut '; + } elsif ($align eq 'center') { $currentstring .= '\end{center}'; } elsif ($align eq 'right') { $currentstring .= '}}'; } elsif ($align eq 'left') { $currentstring .= '}\hfill}'; - } + } } return $currentstring; } @@ -1483,17 +1486,28 @@ sub start_li { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1); - if ($type=~/circle/) { - $currentstring .= ' \item[o] '; + 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$] '; } elsif ($type=~/square/) { - $currentstring .= ' \item[$\Box$] '; - } elsif ($type ne '') { - $currentstring .= ' \item['.$type.'] '; + $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.'] '; } else { $currentstring .= ' \item '; } - } + $Apache::londefdef::list_index++; + } return $currentstring; } @@ -1540,6 +1554,7 @@ 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$}'. @@ -1628,6 +1643,7 @@ 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}.}'.