[HepData-svn] r1935 - in trunk/hepdata-webapp: . src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Mar 29 11:11:40 BST 2016


Author: watt
Date: Tue Mar 29 11:11:39 2016
New Revision: 1935

Log:
YAML formatter: suppress writing dscomment and location if empty

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

Modified: trunk/hepdata-webapp/pom.xml
==============================================================================
--- trunk/hepdata-webapp/pom.xml	Mon Mar 21 11:22:28 2016	(r1934)
+++ trunk/hepdata-webapp/pom.xml	Tue Mar 29 11:11:39 2016	(r1935)
@@ -277,11 +277,12 @@
 <url>http://www.mvnrepository.com</url>
 </repository>
 
+    <!--
     <repository>
       <id>Ibiblio</id>
-      <!-- <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url> -->
-      <url>http://maven.ibiblio.org/maven2</url>
+      <url>http://mirrors.ibiblio.org/maven2</url>
     </repository>
+    -->
     
     <!--
     <repository>

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Mar 21 11:22:28 2016	(r1934)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Tue Mar 29 11:11:39 2016	(r1935)
@@ -191,13 +191,15 @@
         for (String ct : ds.getComments()){
             if(ct.startsWith("Location:")) {
 		location = ct.replaceFirst("Location:","").replaceAll(" ","");
-                s.append("label: '"+ct.replaceFirst("Location:","Data from").replaceAll("'","''")+"'\n"); 
+		if (!location.equals("")) {
+		    s.append("label: '"+ct.replaceFirst("Location:","Data from").replaceAll("'","''")+"'\n");
+		}
             }
         }
 
 	boolean first=true;
 	for (String ct : ds.getComments()){
-	    if (!ct.startsWith("Location:")) {
+	    if (!ct.startsWith("Location:") && !ct.replaceAll(" ","").equals("")) {
 		if (first) {
 		    s.append("description: |\n");
 		    first = false;


More information about the HepData-svn mailing list