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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 18 Oct 2004 22:02:02 -0000


albertel		Mon Oct 18 18:02:02 2004 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - <dl> <dt> <dd> didn't
       - print the HTML 4.01 examples
       - allows nesting
       - BUG#3549
   
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.242 loncom/xml/londefdef.pm:1.243
--- loncom/xml/londefdef.pm:1.242	Tue Oct 12 18:55:22 2004
+++ loncom/xml/londefdef.pm	Mon Oct 18 18:02:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.242 2004/10/12 22:55:22 albertel Exp $
+# $Id: londefdef.pm,v 1.243 2004/10/18 22:02:02 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -63,9 +63,9 @@
     $Apache::londefdef::TD_redirection=0;
     @Apache::londefdef::table = ();
     $Apache::londefdef::select=0;
-    @Apache::londefdef::description=();
-    $Apache::londefdef::DD_redirection=0;
-    $Apache::londefdef::DT_redirection=0;
+    undef(@Apache::londefdef::description);
+    @Apache::londefdef::DD=(0);
+    @Apache::londefdef::DT=(0);
     $Apache::londefdef::list_index=0;
 }
 
@@ -1697,9 +1697,10 @@
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
 	$currentstring = '\begin{description}';
-	@Apache::londefdef::description=();
-	$Apache::londefdef::DD_redirection=0;
-	$Apache::londefdef::DT_redirection=0;
+	$Apache::londefdef::DL++;
+	push(@Apache::londefdef::description,[]);
+	$Apache::londefdef::DD[$Apache::londefdef::DL]=0;
+	$Apache::londefdef::DT[$Apache::londefdef::DL]=0;
     } 
     return $currentstring;
 }
@@ -1710,18 +1711,16 @@
     if ($target eq 'web') {
 	$currentstring = $token->[2];     
     } elsif ($target eq 'tex') {
-	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) {
+	if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
+	if ($Apache::londefdef::DD[-1]) { &end_dd(@_); }
+	foreach my $element (@{$Apache::londefdef::description[-1]}) {
 	    $currentstring.=' '.$element.' ';
 	}
-	@Apache::londefdef::description=();
+	pop(@Apache::londefdef::description);
 	$currentstring.='\end{description}';  
+	delete($Apache::londefdef::DD[$Apache::londefdef::DL]);
+	delete($Apache::londefdef::DT[$Apache::londefdef::DL]);
+	$Apache::londefdef::DL--;
     } 
     return $currentstring;
 }
@@ -1733,16 +1732,10 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	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;
-	}
+	if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
+	if ($Apache::londefdef::DD[-1]) { &end_dd(@_); }
 	&Apache::lonxml::startredirection();
-	$Apache::londefdef::DT_redirection=1;
+	$Apache::londefdef::DT[-1]++;
     } 
     return $currentstring;
 }
@@ -1753,9 +1746,11 @@
     if ($target eq 'web') {
 	$currentstring = $token->[2];    
     } elsif ($target eq 'tex') {
-	my $data=&item_cleanup;
-	push @Apache::londefdef::description,'\item['.$data.']';
-	$Apache::londefdef::DT_redirection=0;
+	if ($Apache::londefdef::DT[-1]) {
+	    my $data=&item_cleanup();
+	    push(@{$Apache::londefdef::description[-1]},'\item['.$data.']');
+	    $Apache::londefdef::DT[-1]--;
+	}
     } 
     return $currentstring;
 }
@@ -1774,12 +1769,11 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	if ($Apache::londefdef::DT_redirection) {
-	    my $data=&item_cleanup;
-	    push @Apache::londefdef::description,'\item['.$data.']';
-	    $Apache::londefdef::DT_redirection=0;
-	}
-	$Apache::londefdef::DD_redirection=1;
+	if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
+	if ($Apache::londefdef::DD[-1]) { &end_dd(@_);}
+	push(@{$Apache::londefdef::description[-1]},'');
+	$Apache::londefdef::description[-1]->[-1].=' \strut ';
+	$Apache::londefdef::DD[-1]++;
 	&Apache::lonxml::startredirection();
     } 
     return $currentstring;
@@ -1791,8 +1785,9 @@
     if ($target eq 'web') {
 	$currentstring = $token->[2];    
     }  elsif ($target eq 'tex') {
-	$Apache::londefdef::description[-1].=&Apache::lonxml::endredirection();
-	$Apache::londefdef::DD_redirection=0;
+	$Apache::londefdef::description[-1]->[-1].=
+	    &Apache::lonxml::endredirection().' \vskip 0mm ';
+	$Apache::londefdef::DD[-1]--;
     }
     return $currentstring;
 }