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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Jan 11 16:49:20 GMT 2016


Author: watt
Date: Mon Jan 11 16:49:19 2016
New Revision: 1913

Log:
Fixes to YAML formatter: account for y-axis comments without colon, don't remove full stop in middle of comment

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	Wed Dec 16 17:22:41 2015	(r1912)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Jan 11 16:49:19 2016	(r1913)
@@ -491,8 +491,14 @@
 		if(first) { s.append(s4+"qualifiers:\n"); }
 		first=false;
 		unit="";
-		String type=comment.substring(0,comment.indexOf(":")-1).trim();
-		String value=comment.substring(comment.indexOf(":")+1).trim();
+		String type="";
+		String value="";
+		if (comment.contains(":")) {
+		    type = comment.substring(0,comment.indexOf(":")-1).trim();
+		    value = comment.substring(comment.indexOf(":")+1).trim();
+		} else {
+		    type = comment;
+		}
 		//                String type="SYS";
 		//                String value=comment;
 		//                if(comment.indexOf(":")>-1) {
@@ -528,8 +534,12 @@
 	    }
 	    Collections.sort(storelist);
 	    for (int i=0; i<storelist.size(); i++){
-		s.append(storelist.get(i).replaceFirst("zzzz",""));
-	    }         
+		if (storelist.get(i).startsWith("zzzz")) {
+		    s.append(storelist.get(i).replaceFirst("zzzz",""));
+		} else {
+		    s.append(storelist.get(i).replaceFirst("zzzz","\\."));
+		}
+	    }
 
 	    for(Uncertainty error : ds.getErrors()){
 		if(error.getPlus()==0.0){


More information about the HepData-svn mailing list