[HepData-svn] r1877 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Jun 24 18:28:39 BST 2015


Author: watt
Date: Wed Jun 24 18:28:39 2015
New Revision: 1877

Log:
Minor tweaks to YAML formatter

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Jun 22 12:34:53 2015	(r1876)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Wed Jun 24 18:28:39 2015	(r1877)
@@ -130,7 +130,7 @@
                     catch (IOException e){}
                     try {
                         BufferedReader in = new BufferedReader(new FileReader(linkfile));
-                        link="http://hepdata.cedar.ac.uk"+in.readLine();	    
+                        link=in.readLine();	    
                     } 
                     catch (IOException e){}
 		    s.append(sp+"{location: '"+link+"', description: '"+desc.replaceAll("'","''")+"'}\n");
@@ -144,7 +144,7 @@
 	    File testinsert = new File(insertfile);
 	    String insert="";
 	    if(testinsert.exists()){
-		s.append(sp+"{location: 'http://hepdata.cedar.ac.uk/resource/"+ids[j]+"/insert.html', description: 'insert.html'}\n");
+		s.append(sp+"{location: '/resource/"+ids[j]+"/insert.html', description: 'insert.html'}\n");
 	    }
 	}
 
@@ -380,7 +380,7 @@
                 if(first) { s.append(s4+"qualifiers:\n"); }
                 first=false;
 
-                s.append(s4+sp+"{type: "+prop.getName());
+                s.append(s4+sp+"{name: "+prop.getName());
 
                 if(prop.getFocus()!=null || prop.getLowValue()!=null || prop.getHighValue()!=null){
                     s.append(", value: '");
@@ -420,7 +420,7 @@
                     unit=type.substring(type.indexOf(" IN ")+4).trim();
                     type=type.substring(0,type.indexOf(" IN ")).trim();
                 }
-                s.append(s4+sp+"{type: "+type);
+                s.append(s4+sp+"{name: "+type);
                 s.append(", value: '"+ value+"'");
                 if(!unit.equals("")){
                     s.append(", units: '"+ unit+"'");
@@ -486,7 +486,7 @@
         StringBuffer s = new StringBuffer();
         Double test = error.getMinus();
         if(which.equals("point")) test=-test;
-        if(error.getPlus()>=0.0 && (error.getPlus().equals(test))){
+        if((error.getPlus()>=0.0 && (error.getPlus().equals(test))) || error.hasZeroSize()){
             s.append(s4+s4+sp+"{symerror: "); 
             s.append(error.getPlus());
             if(error.getNormType()==ErrorNorm.PCT){  s.append("%"); }


More information about the HepData-svn mailing list