[LON-CAPA-cvs] cvs: loncom /homework edit.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 07 Sep 2007 00:21:06 -0000


albertel		Thu Sep  6 20:21:06 2007 EDT

  Modified files:              
    /loncom/homework	edit.pm 
  Log:
  - preserve the attribute ordering when rewriting the tag
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.108 loncom/homework/edit.pm:1.109
--- loncom/homework/edit.pm:1.108	Tue Jun 19 16:24:42 2007
+++ loncom/homework/edit.pm	Thu Sep  6 20:21:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.108 2007/06/19 20:24:42 banghart Exp $
+# $Id: edit.pm,v 1.109 2007/09/07 00:21:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -686,11 +686,13 @@
     my $result;
     if ($token->[0] eq 'S') {
 	$result = '<'.$token->[1];
-	while (my ($key,$val)= each(%{$token->[2]})) {
-	    $val=~s:^\s+|\s+$::g;
-	    $val=~s:"::g; #"
-	    &Apache::lonxml::debug("setting :$key: to  :$val:");
-	    $result.=' '.$key.'="'.$val.'"';
+	#FIXME do this in non random order
+	foreach my $attribute (@{ $token->[3] }) {
+	    my $value = $token->[2]{$attribute};
+	    $value =~s/^\s+|\s+$//g;
+	    $value =~s/\"//g;
+	    &Apache::lonxml::debug("setting :$attribute: to  :$value:");
+	    $result.=' '.$attribute.'="'.$value.'"';
 	}
 	if ($token->[4] =~ m:/>$:) {
 	    $result.=' />';