|
[HepData-svn] r1887 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formatsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Jul 29 17:36:22 BST 2015
Author: watt Date: Wed Jul 29 17:36:22 2015 New Revision: 1887 Log: Added single-quote marks around qualifier names in 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 Jul 27 14:52:42 2015 (r1886) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java Wed Jul 29 17:36:22 2015 (r1887) @@ -326,7 +326,7 @@ name=xax.getHeader().substring(0,xax.getHeader().indexOf(" IN ")).trim(); unit=xax.getHeader().substring(xax.getHeader().indexOf(" IN ")+4).trim(); } - s.append(sp+"header: {name: '"+name+"'"); + s.append(sp+"header: {name: '"+name.replaceAll("'","''")+"'"); if(!unit.equals("")){ s.append(", units: '"+unit+"'"); } s.append("}\n"); s.append(s4+"values:\n"); @@ -408,7 +408,7 @@ name=yax.getHeader().substring(0,yax.getHeader().indexOf(" IN ")).trim(); unit=yax.getHeader().substring(yax.getHeader().indexOf(" IN ")+4).trim(); } - s.append(sp+"header: {name: '"+name+"'"); + s.append(sp+"header: {name: '"+name.replaceAll("'","''")+"'"); if(!unit.equals("")){ s.append(", units: '"+unit+"'"); } s.append("}\n"); boolean first=true; @@ -416,7 +416,7 @@ if(first) { s.append(s4+"qualifiers:\n"); } first=false; - s.append(s4+sp+"{name: "+prop.getName()); + s.append(s4+sp+"{name: '"+prop.getName().replaceAll("'","''")+"'"); if(prop.getFocus()!=null || prop.getLowValue()!=null || prop.getHighValue()!=null){ s.append(", value: '"); @@ -456,8 +456,8 @@ unit=type.substring(type.indexOf(" IN ")+4).trim(); type=type.substring(0,type.indexOf(" IN ")).trim(); } - s.append(s4+sp+"{name: "+type); - s.append(", value: '"+ value+"'"); + s.append(s4+sp+"{name: '"+type.replaceAll("'","''")+"'"); + s.append(", value: '"+ value.replaceAll("'","''")+"'"); if(!unit.equals("")){ s.append(", units: '"+ unit+"'"); }
More information about the HepData-svn mailing list |