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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 22 Mar 2002 16:04:09 -0000


matthew		Fri Mar 22 11:04:09 2002 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  Minor cleanup of insert functions to make the xml a little neater.
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.60 loncom/xml/lonplot.pm:1.61
--- loncom/xml/lonplot.pm:1.60	Fri Mar 22 10:43:42 2002
+++ loncom/xml/lonplot.pm	Fri Mar 22 11:04:09 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.60 2002/03/22 15:43:42 matthew Exp $
+# $Id: lonplot.pm,v 1.61 2002/03/22 16:04:09 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1140,11 +1140,11 @@
 sub insert_gnuplot {
     my $result = '';
     #  plot attributes
-    $result .= "<gnuplot \n";
+    $result .= "\n<gnuplot ";
     foreach my $attr (keys(%gnuplot_defaults)) {
-	$result .= "     $attr=\"$gnuplot_defaults{$attr}->{'default'}\"\n";
+	$result .= "\n     $attr=\"$gnuplot_defaults{$attr}->{'default'}\"";
     }
-    $result .= ">\n";
+    $result .= ">";
     # Add the components (most are commented out for simplicity)
     # $result .= &insert_key();
     # $result .= &insert_axis();
@@ -1153,7 +1153,7 @@
     # $result .= &insert_ylabel();    
     $result .= &insert_curve();
     # close up the <gnuplot>
-    $result .= "</gnuplot>\n";
+    $result .= "\n</gnuplot>";
     return $result;
 }
 
@@ -1167,9 +1167,9 @@
     my $result;
     $result .= "\n    <xtics ";
     foreach my $attr (keys(%tic_defaults)) {
-	$result .= "$attr=\"$tic_defaults{$attr}->{'default'}\" ";
+	$result .= "\n        $attr=\"$tic_defaults{$attr}->{'default'}\" ";
     }
-    $result .= "/>\n";
+    $result .= "/>";
     return $result;
 }
 
@@ -1177,19 +1177,19 @@
     my $result;
     $result .= "\n    <ytics ";
     foreach my $attr (keys(%tic_defaults)) {
-	$result .= "$attr=\"$tic_defaults{$attr}->{'default'}\" ";
+	$result .= "\n        $attr=\"$tic_defaults{$attr}->{'default'}\" ";
     }
-    $result .= "/>\n";
+    $result .= "/>";
     return $result;
 }
 
 sub insert_key {
     my $result;
-    $result .= "\n    <key \n";
+    $result .= "\n    <key ";
     foreach my $attr (keys(%key_defaults)) {
-	$result .= "         $attr=\"$key_defaults{$attr}->{'default'}\"\n";
+	$result .= "\n         $attr=\"$key_defaults{$attr}->{'default'}\"";
     }
-    $result .= "   />\n";
+    $result .= " />";
     return $result;
 }
 
@@ -1197,24 +1197,24 @@
     my $result;
     $result .= "\n    <axis ";
    foreach my $attr (keys(%axis_defaults)) {
-	$result .= "         $attr=\"$axis_defaults{$attr}->{'default'}\"\n";
+	$result .= "\n         $attr=\"$axis_defaults{$attr}->{'default'}\"";
     }
-    $result .= "   />\n";
+    $result .= " />";
     return $result;
 }
 
-sub insert_title { return "\n    <title></title>\n"; }
-sub insert_xlabel { return "\n    <xlabel></xlabel>\n"; }
-sub insert_ylabel { return "\n    <ylabel></ylabel>\n"; }
+sub insert_title  { return "\n    <title></title>"; }
+sub insert_xlabel { return "\n    <xlabel></xlabel>"; }
+sub insert_ylabel { return "\n    <ylabel></ylabel>"; }
 
 sub insert_label {
     my $result;
     $result .= "\n    <label ";
     foreach my $attr (keys(%label_defaults)) {
-	$result .= '         '.$attr.'="'.
-	    $label_defaults{$attr}->{'default'}."\"\n";
+	$result .= "\n         $attr=\"".
+            $label_defaults{$attr}->{'default'}."\"";
     }
-    $result .= "   ></label>\n";
+    $result .= "></label>";
     return $result;
 }
 
@@ -1222,22 +1222,22 @@
     my $result;
     $result .= "\n    <curve ";
     foreach my $attr (keys(%curve_defaults)) {
-	$result .= '         '.$attr.'="'.
-	    $curve_defaults{$attr}->{'default'}."\"\n";
+	$result .= "\n         $attr=\"".
+	    $curve_defaults{$attr}->{'default'}."\"";
     }
-    $result .= "    >\n";
-    $result .= &insert_data().&insert_data()."</curve>\n";
+    $result .= " >";
+    $result .= &insert_data().&insert_data()."\n    </curve>";
 }
 
 sub insert_function {
     my $result;
-    $result .= "<function></function>\n";
+    $result .= "\n        <function></function>";
     return $result;
 }
 
 sub insert_data {
     my $result;
-    $result .= "     <data></data>\n";
+    $result .= "\n        <data></data>";
     return $result;
 }