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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 26 13:47:57 BST 2012


Author: whalley
Date: Tue Jun 26 13:47:57 2012
New Revision: 1551

Log:
adding formatter for new input code

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	Tue Jun 26 13:47:42 2012	(r1550)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Tue Jun 26 13:47:57 2012	(r1551)
@@ -37,7 +37,7 @@
         parseBaseViewContext(context);
 
         // Handle pattern parsing separately
-        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain.txt|yoda|aida|pyroot.py|root|mpl|bdms|hepml|jhepwork.py)" + "\\Z",
+        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain.txt|yoda|aida|pyroot.py|root|mpl|bdms|hepml|jhepwork.py|input)" + "\\Z",
                                        Pattern.CASE_INSENSITIVE);
         for (int i = 0; i < context.getCount(); i++) {
             String ps = context.get(String.class, i);
@@ -55,6 +55,7 @@
             if (fmt.equals("jhepwork.py")) return asJhepwork();
             if (fmt.equals("hepml")) return asHepML();
             if (fmt.equals("bdms")) return asBDMS();
+            if (fmt.equals("input")) return asINPUT();
             if (fmt.equals("plain.txt")) return asPlain();
             if (fmt.equals("aida")) return asAIDA();
             if (fmt.equals("pyroot.py")) return asPyROOT();
@@ -120,6 +121,18 @@
         return new TextStreamResponse("text/plain", asBDMS);
     }
 
+    public Object getInputContext() {
+        return formatContext("input");
+    }
+    public StreamResponse asINPUT() {
+        Paper p = getPaper();
+        String asINPUT = InputFormatter.format(p);
+        if (asINPUT == null) {
+            asINPUT = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asINPUT);
+    }
+
 
     public Object getPlainContext() {
         return formatContext("plain.txt");


More information about the HepData-svn mailing list