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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 16 Oct 2002 20:37:46 -0000


albertel		Wed Oct 16 16:37:46 2002 EDT

  Modified files:              
    /loncom/xml	style.pm 
  Log:
  - fixes for putting a tag inside of itself
  
  
Index: loncom/xml/style.pm
diff -u loncom/xml/style.pm:1.13 loncom/xml/style.pm:1.14
--- loncom/xml/style.pm:1.13	Thu Nov 29 14:03:58 2001
+++ loncom/xml/style.pm	Wed Oct 16 16:37:46 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Style Parser Module (new version)
 #
-# $Id: style.pm,v 1.13 2001/11/29 19:03:58 www Exp $
+# $Id: style.pm,v 1.14 2002/10/16 20:37:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -77,24 +77,27 @@
 		if ($stoken->[0] eq 'T') {
 		    $current_value .= $stoken->[1];
 		} elsif ($stoken->[0] eq 'S') {
-		    my $number = &testkey($stoken->[0],$stoken->[1],@keys);
+		    my $number=-1;
+		    if ($stoken->[1] ne "$current_key") {
+			$number = &testkey($stoken->[0],$stoken->[1],@keys);
+		    }
 		    if ($number != -1) {
 			$current_value .= &testvalue($number,$stoken->[0],$stoken->[2],@values);
 		    } else {
 			$current_value .= $stoken->[4];
-		    } 
+		    }
 	        } else {
-		    my $number = &testkey($stoken->[0],$stoken->[1],@keys);
+		    my $number=-1;
+		    if (('/'.$stoken->[1]) ne "$current_key") {
+			$number = &testkey($stoken->[0],$stoken->[1],@keys);
+		    }
 		    if ($number != -1) {
 			$current_value .= &testvalue($number,$stoken->[0],$stoken->[2],@values);
 		    } else {
 			$current_value .= $stoken->[2];
-		    } 
+		    }
 	        }
-
-
-
-	    } 
+	    }
 	}
         $current_value =~ s/\n//g;
 ###########
@@ -150,12 +153,12 @@
     my ($number,$zeroth,$second,@values) = @_;   
     my $current_content = $values[$number];
     if ($zeroth eq 'S') {
-    my %tempo_hash = %$second;
-    while ((my $current_k,my $current_v) = each %tempo_hash) {
-        $current_content =~ s/\$$current_k/$current_v/g;
-    }
+	my %tempo_hash = %$second;
+	while ((my $current_k,my $current_v) = each %tempo_hash) {
+	    $current_content =~ s/\$$current_k/$current_v/g;
+	}
     } elsif ($zeroth eq 'E') {
-        $current_content = $values[$number];
+	$current_content = $values[$number];
     }
     return $current_content;
 }