[HepData-svn] r1375 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 11 17:10:20 BST 2010


Author: whalley
Date: Wed Aug 11 17:10:20 2010
New Revision: 1375

Log:
adding root,mpl links

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Wed Aug 11 14:55:35 2010	(r1374)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Wed Aug 11 17:10:20 2010	(r1375)
@@ -36,7 +36,7 @@
         parseBaseViewContext(context);
 
         // Handle pattern parsing separately
-        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain|yoda|aida|pyroot|root|mpl|bdms)" + "\\Z",
+        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain|yoda|aida|pyroot|root|mpl|bdms|hepml)" + "\\Z",
                                        Pattern.CASE_INSENSITIVE);
         for (int i = 0; i < context.getCount(); i++) {
             String ps = context.get(String.class, i);
@@ -51,6 +51,7 @@
         // Now handle the special formats (after parsing *all* context elements)
         String fmt = getQueryParam("format");
         if (fmt != null) {
+            if (fmt.equals("hepml")) return asHepML();
             if (fmt.equals("bdms")) return asBDMS();
             if (fmt.equals("plain")) return asPlain();
             if (fmt.equals("aida")) return asAIDA();
@@ -80,6 +81,18 @@
 
 
     ///////////////////////////////////////////////
+    //
+    public Object getHepMLContext() {
+        return formatContext("hepml");
+    }
+    public StreamResponse asHepML() {
+        Paper p = getPaper();
+        String asHepML = HepMLFormatter.format(p);
+        if (asHepML == null) {
+            asHepML = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asHepML);
+    }
 
     public Object getBdmsContext() {
         return formatContext("bdms");


More information about the HepData-svn mailing list