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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Sep 25 14:29:17 BST 2014


Author: watt
Date: Thu Sep 25 14:29:17 2014
New Revision: 1818

Log:
Use \n instead of \n as newline character.  Enable MathJax in Plot.tml.  Advertise MathJax support in SubmittingData.tml.

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetComments.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayPaperComments.java
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Plot.tml
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/SubmittingData.tml

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Fri Sep  5 10:51:08 2014	(r1817)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Thu Sep 25 14:29:17 2014	(r1818)
@@ -43,7 +43,7 @@
 		s.append("*title: "+p.getTitle()+"\n");
             }
             for (String comment : p.getComments()){
-                comment=comment.replaceAll("\\\\n","\\\\\\\\n");
+                //comment=comment.replaceAll("\\\\n","\\\\\\\\n");
                 s.append("*comment: "+comment+"\n");
 	    }
 	}
@@ -63,7 +63,7 @@
         }
         for (String comment : ds.getComments()){
             if(!comment.startsWith("Location")){
-                comment=comment.replaceAll("\\\\n","\\\\\\\\n");
+                //comment=comment.replaceAll("\\\\n","\\\\\\\\n");
                 s.append("*dscomment: "+comment+"\n");
             }    
         }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetComments.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetComments.java	Fri Sep  5 10:51:08 2014	(r1817)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetComments.java	Thu Sep 25 14:29:17 2014	(r1818)
@@ -42,7 +42,8 @@
             while (ls>0){
                 int iend = ls;
 //                int ihash = bs.indexOf("#");
-                int ihash = bs.indexOf("\\n");
+//                int ihash = bs.indexOf("\\n");
+		int ihash = bs.indexOf("\n"); // G.W. 24/09/2014
 //              System.out.println("ihash "+ihash+" iend " + ls);
                
                 if(ihash>=0) { iend = ihash; }
@@ -50,8 +51,9 @@
                 writer.write(bs.substring(0,iend));
                 if(iend<ls){ 
 //                     bs=bs.substring(ihash+1);
-                     bs=bs.substring(ihash+2);
-                     ls=bs.length();
+//                     bs=bs.substring(ihash+2);
+		    bs=bs.substring(ihash+1); // G.W. 24/09/2014
+		    ls=bs.length();
                 } else {
                     ls=0;
                 }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayPaperComments.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayPaperComments.java	Fri Sep  5 10:51:08 2014	(r1817)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayPaperComments.java	Thu Sep 25 14:29:17 2014	(r1818)
@@ -71,15 +71,17 @@
             while (ls>0){
                 int iend = ls;
               // int ihash = bs.indexOf("#");
-                int ihash = bs.indexOf("\\n");
+              // int ihash = bs.indexOf("\\n");
+		int ihash = bs.indexOf("\n"); // G.W. 24/09/2014
 //              System.out.println("ihash "+ihash+" iend " + ls);
                
                 if(ihash>=0) { iend = ihash; }
                 writer.element("br"); writer.end();
                 writer.write(bs.substring(0,iend));
                 if(iend<ls){ 
-                    // bs=bs.substring(ihash+1);
-                     bs=bs.substring(ihash+2);
+		    // bs=bs.substring(ihash+1);
+                    // bs=bs.substring(ihash+2);
+		    bs=bs.substring(ihash+1); // G.W. 24/09/2014
                      ls=bs.length();
                 } else {
                     ls=0;

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Plot.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Plot.tml	Fri Sep  5 10:51:08 2014	(r1817)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Plot.tml	Thu Sep 25 14:29:17 2014	(r1818)
@@ -1,6 +1,20 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
 
+<head>
+<script type="text/x-mathjax-config">
+  MathJax.Hub.Config({
+    tex2jax: {
+      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
+      processEscapes: true
+    }
+  });
+</script>
+<script type="text/javascript"
+    src="http://hepdata.cedar.ac.uk/resource/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
+</script>
+</head>
+
   <title>HepData data plot</title>
 
 <div class="paperbox">  

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/SubmittingData.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/SubmittingData.tml	Fri Sep  5 10:51:08 2014	(r1817)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/SubmittingData.tml	Thu Sep 25 14:29:17 2014	(r1818)
@@ -20,6 +20,8 @@
 Any text files you send us will be processed into a standard format, which can be seen from the "input" link on any of the existing records.  Data submissions provided in text formats closer to the "input" format (<i>not</i> the "plain text" format) can therefore be entered more quickly into the database.  You can start by looking at the "input" file for an existing record that is similar to your submitted data.  An annotated <a href="http://hepdata.cedar.ac.uk/resource/sample.input">sample input file</a> is available, as is a <a href="http://hepdata.cedar.ac.uk/resource/6150.pl">Perl script</a> or <a href="http://hepdata.cedar.ac.uk/resource/6150.py">Python script</a> used to produce the "input" file from the <a href="http://hepdata.cedar.ac.uk/resource/zz.txt">original submission</a>.  Some nomenclature that is still used in practice is defined in the historical 1970s <a href="http://hepdata.cedar.ac.uk/resource/EncodingManual.pdf">encoding manual</a> (14 MB).  It is useful to pro
 vide key metadata for each table such as a caption, the process being considered (initial-state and final-state particles), important kinematic cuts, and headers for the x and y columns specifying the quantity with units.  Multiple x and y values can be given in the same row separated by semicolons and non-existent entries can be indicated by dashes "-".  Numerical values should be given with an appropriate and not excessive number of significant figures (in general, a maximum of 4), avoiding giving more decimal places for the errors than the central values.  An <a href="http://hepdata.cedar.ac.uk/resource-cgi/input">online form</a> is available to test data input.  Click on "Browse..." to select your input file, followed by "Upload" and "Process", then click "Display" for the first 10 tables, or "All" for the whole record.  Please note that this <a href="http://hepdata.cedar.ac.uk/resource-cgi/input">online form</a> is only for testing purposes, and the final submittal to HepData m
 ust still be done by email to hepdata(at)projects.hepforge.org.
 <p/>
 A Python <a href="http://hepdata.cedar.ac.uk/resource/hepconverter.py">script</a> has been written by Mike Flowerdew (ATLAS) to convert objects in .root files to the HepData "input" format.  A test .root file can be made with another Python <a href="http://hepdata.cedar.ac.uk/resource/MakeTestFile.py">script</a> and some brief usage <a href="http://hepdata.cedar.ac.uk/resource/hepconverternotes.txt">notes</a> are provided.
+<p/>
+It is possible to use LaTeX mathematical expressions in the "input" file, which will be rendered using <a href="http://www.mathjax.org">MathJax</a> in the HTML display; see <a href="http://hepdata.cedar.ac.uk/view/ins1298811">here</a> or <a href="http://hepdata.cedar.ac.uk/view/ins1306294">here</a> for example records that use LaTeX.
 </td>
 </tr>
 </table>


More information about the HepData-svn mailing list