[HepData-svn] r1917 - in trunk/hepdata-webapp/src/main: java/cedar/hepdata/formats resources/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Jan 27 15:02:35 GMT 2016


Author: watt
Date: Wed Jan 27 15:02:35 2016
New Revision: 1917

Log:
Write key phrases to YAML format.  Publicly link YAML format from records.

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/OutputHelp.tml
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Wed Jan 27 11:47:27 2016	(r1916)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Wed Jan 27 15:02:35 2016	(r1917)
@@ -233,16 +233,22 @@
                 else {s.append(", ");}  
             }
         }
-	//        if(p.getKeywords().size() > 0) {
-	//            s.append(sp+"{name: keywords, values: [");
-	//            int np=0;
-	//            for (String pkey : p.getKeywords()){
-	//                s.append("'"+pkey+"'");
-	//                if(++np==p.getKeywords().size()){s.append("]}\n"); } 
-	//                else {s.append(", ");}  
-	//            }
-	//        }
-
+	if (p.getKeywords().size() > 0 || ds.getDsKeywords().size() > 0) {
+	    s.append(sp+"{name: phrases, values: [");
+	    int np=0;
+	    for (String pkey : p.getKeywords()){
+		s.append("'"+pkey+"'");
+		if (++np!=p.getKeywords().size() || ds.getDsKeywords().size() > 0)
+		    { s.append(", "); }
+	    }
+	    int nd=0;
+	    for (String dskey : ds.getDsKeywords()){
+		s.append("'"+dskey+"'");
+		if (++nd!=ds.getDsKeywords().size())
+		    { s.append(", "); }
+	    }
+	    s.append("]}\n");
+	}
 
         Double ecmlow=99999.0;
         Double ecmhigh=-99999.0; 

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/OutputHelp.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/OutputHelp.tml	Wed Jan 27 11:47:27 2016	(r1916)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/OutputHelp.tml	Wed Jan 27 15:02:35 2016	(r1917)
@@ -40,6 +40,7 @@
 <dt><b>mpl</b><dd>Output in <a href="http://matplotlib.org/">matplotlib</a> format</dd></dt>
 <dt><b>ScaVis</b><dd>Output in <a href="http://jwork.org/scavis/">SCaVis</a> format</dd></dt>
 <dt><b>MarcXML</b><dd>Output in <a href="http://www.loc.gov/standards/marcxml/">MARCXML</a> format</dd></dt>
+<dt><b>YAML</b><dd>Output in <a href="http://yaml.org/">YAML</a> format (native format for new <a href="http://hepdata.net/">hepdata.net</a> site)</dd></dt>
 </dl>
 There are additional links at the bottom of the "y" columns:
 <dl>

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml	Wed Jan 27 11:47:27 2016	(r1916)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml	Wed Jan 27 15:02:35 2016	(r1917)
@@ -83,9 +83,9 @@
       <a href="#" t:type="pagelink" t:page="view" t:context="yodaContext">YODA</a>,  
       <a href="#" t:type="pagelink" t:page="view" t:context="rootContext">ROOT</a>, 
       <a href="#" t:type="pagelink" t:page="view" t:context="matplotlibContext">mpl</a>,   
-      <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a> or 
-      <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a>  
-
+      <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a>,  
+      <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a> or
+      <a href="#" t:type="pagelink" t:page="view" t:context="yamlContext">YAML</a> 
 
 
       <t:if test="haveMultiple">
@@ -317,8 +317,9 @@
 		  <a href="#" t:type="pagelink" t:page="view" t:context="yodaContext">YODA</a>, 
 		  <a href="#" t:type="pagelink" t:page="view" t:context="rootContext">ROOT</a>,  
 		  <a href="#" t:type="pagelink" t:page="view" t:context="matplotlibContext">mpl</a>,  
-		  <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a> or 
-		  <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a>  
+		  <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a>, 
+		  <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a> or
+		  <a href="#" t:type="pagelink" t:page="view" t:context="yamlContext">YAML</a> 
 		  <!-- </p> -->
 		  <t:displayDatasetComments ds="dataset" />
 		  <!--          <t:datasetAsHtml dataset="dataset" format="${format}" /> -->
@@ -376,8 +377,9 @@
 		    <a href="#" t:type="pagelink" t:page="view" t:context="yodaContext">YODA</a>, 
 		    <a href="#" t:type="pagelink" t:page="view" t:context="rootContext">ROOT</a>,  
 		    <a href="#" t:type="pagelink" t:page="view" t:context="matplotlibContext">mpl</a>, 
-		    <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a> or 
-		    <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a>  
+		    <a href="#" t:type="pagelink" t:page="view" t:context="jhepworkContext">ScaVis</a>, 
+		    <a href="#" t:type="pagelink" t:page="view" t:context="marcXMLContext">MarcXML</a> or
+		    <a href="#" t:type="pagelink" t:page="view" t:context="yamlContext">YAML</a> 
 		    <!-- </p> -->
 		    <t:displayDatasetComments ds="dataset" />
 		  </div>


More information about the HepData-svn mailing list