[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 25 Aug 2004 19:57:27 -0000


albertel		Wed Aug 25 15:57:27 2004 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - alphabet was misspelled
  - count is now always right, added support for more types to <li>
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.237 loncom/xml/londefdef.pm:1.238
--- loncom/xml/londefdef.pm:1.237	Wed Aug 25 15:08:32 2004
+++ loncom/xml/londefdef.pm	Wed Aug 25 15:57:27 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.237 2004/08/25 19:08:32 sakharuk Exp $
+# $Id: londefdef.pm,v 1.238 2004/08/25 19:57:27 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -66,8 +66,7 @@
     @Apache::londefdef::description=();
     $Apache::londefdef::DD_redirection=0;
     $Apache::londefdef::DT_redirection=0;
-    @Apache::londefdef::alphabit=('A'..'Z');
-    $Apache::londefdef::alphabit_index=0;
+    $Apache::londefdef::list_index=0;
 }
 
 #======================= TAG SUBROUTINES =====================
@@ -1489,23 +1488,26 @@
     } 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);
-	if ($type=~/circle/) {
-	    $currentstring .= ' \item[o] ';
+	#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$] ';
+	    $currentstring .= ' \item[$\diamond$] ';
+	} elsif ($type eq '1') {
+	    $currentstring .= ' \item['.($Apache::londefdef::list_index+1).'.]';
 	} elsif ($type eq 'A') {
-	    $currentstring .= ' \item['.$Apache::londefdef::alphabit[$Apache::londefdef::alphabit_index].']';
-	    $Apache::londefdef::alphabit_index++;
+	    $currentstring .= ' \item['.('A'..'Z')[$Apache::londefdef::list_index].'.]';
 	} elsif ($type eq 'a') {
-	    my $lower_case=lc $Apache::londefdef::alphabit[$Apache::londefdef::alphabit_index];
-	    $currentstring .= ' \item['.$lower_case.']';
-	    $Apache::londefdef::alphabit_index++;
+	    $currentstring .= ' \item['.('a'..'z')[$Apache::londefdef::list_index].'.]';
 	} elsif ($value ne '') {
 	    $currentstring .= ' \item['.$value.'] ';
 	} else {
 	    $currentstring .= ' \item ';
 	}  
-    } 
+	$Apache::londefdef::list_index++;
+    }
     return $currentstring;
 }
 
@@ -1552,6 +1554,7 @@
 	$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$}'. 
@@ -1640,7 +1643,7 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	$Apache::londefdef::alpabit_index=0;
+	$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}.}'.