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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 25 Sep 2003 15:52:57 -0000


sakharuk		Thu Sep 25 11:52:57 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Bug 2230 (<dl><dt><center>hi</center></dt></dl>) is fixed. In addition you can omit </dt> tag which is optional in HTML. But this bug has originated a lot of other questions - we can have far more complicated situations with different combinations of HTML tags in definition list. Continue to work with this but close 2230. 
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.171 loncom/xml/londefdef.pm:1.172
--- loncom/xml/londefdef.pm:1.171	Fri Sep  5 15:35:40 2003
+++ loncom/xml/londefdef.pm	Thu Sep 25 11:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.171 2003/09/05 19:35:40 sakharuk Exp $
+# $Id: londefdef.pm,v 1.172 2003/09/25 15:52:57 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1654,25 +1654,28 @@
     return $currentstring;
 }
 
-#-- <dt> tag
+#-- <dt> tag (end tag optional)
 sub start_dt {
-    my ($target,$token) = @_;
-    my $currentstring = '';
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
+    my $currentstring='';
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	$currentstring = '\item[';  
+	&Apache::lonxml::startredirection();; 
     } 
     return $currentstring;
 }
 
 sub end_dt {
-    my ($target,$token) = @_;
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';
     if ($target eq 'web') {
 	$currentstring = $token->[2];    
     } elsif ($target eq 'tex') {
-	$currentstring = ']';  
+	my $data=&Apache::lonxml::endredirection();
+	$data=~s/\\begin{center}//g;
+	$data=~s/\\end{center}//g;
+	$currentstring.='\item['.$data.']';
     } 
     return $currentstring;
 }
@@ -1684,10 +1687,8 @@
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	if ($$tagstack[-2] eq 'dl') {
-	    $currentstring = ' \item [] ';  
-	} elsif ($$tagstack[-2] eq 'dt') {
-	    $currentstring = ']'; 
+	if ($$tagstack[-2] eq 'dt') {
+	    $currentstring.='\item['.&Apache::lonxml::endredirection().']';
 	}
     } 
     return $currentstring;