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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 25 Aug 2004 19:08:33 -0000


sakharuk		Wed Aug 25 15:08:33 2004 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Bug 3388 (Mix and Match printing wrong) is fixed. The source of bug is presence of type="A" attribute directly in <li> tags not in <ol> tag. This is why I was forced to define a new globals: array @Apache:londefdef::alphabit and scalar $Apache::londefdef::alphabit_infdex to trace the current value of index.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.236 loncom/xml/londefdef.pm:1.237
--- loncom/xml/londefdef.pm:1.236	Mon Aug 23 11:23:53 2004
+++ loncom/xml/londefdef.pm	Wed Aug 25 15:08:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.236 2004/08/23 15:23:53 sakharuk Exp $
+# $Id: londefdef.pm,v 1.237 2004/08/25 19:08:32 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -66,6 +66,8 @@
     @Apache::londefdef::description=();
     $Apache::londefdef::DD_redirection=0;
     $Apache::londefdef::DT_redirection=0;
+    @Apache::londefdef::alphabit=('A'..'Z');
+    $Apache::londefdef::alphabit_index=0;
 }
 
 #======================= TAG SUBROUTINES =====================
@@ -1485,13 +1487,21 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	my  $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1);
+	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] ';
 	} elsif ($type=~/square/) {
 	    $currentstring .= ' \item[$\Box$] ';
-	} elsif ($type ne '') { 
-	    $currentstring .= ' \item['.$type.'] ';
+	} elsif ($type eq 'A') {
+	    $currentstring .= ' \item['.$Apache::londefdef::alphabit[$Apache::londefdef::alphabit_index].']';
+	    $Apache::londefdef::alphabit_index++;
+	} elsif ($type eq 'a') {
+	    my $lower_case=lc $Apache::londefdef::alphabit[$Apache::londefdef::alphabit_index];
+	    $currentstring .= ' \item['.$lower_case.']';
+	    $Apache::londefdef::alphabit_index++;
+	} elsif ($value ne '') {
+	    $currentstring .= ' \item['.$value.'] ';
 	} else {
 	    $currentstring .= ' \item ';
 	}  
@@ -1630,6 +1640,7 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
+	$Apache::londefdef::alpabit_index=0;
 	my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
 	if ($type eq '1') {
 	    $currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'.