That's exactly what I'm doing right now. Building the reference guide works for me now, I just need to clean up a few things and will later send a changeset for review. Do you volunteer for reviewing the changes?

- André


On 3/29/2010 4:10 PM, P T Withington wrote:
On 2010-03-29, at 10:07, P T Withington wrote:

On 2010-03-28, at 20:53, André Bargull wrote:

Ok, here's what's going on. From "org.openlaszlo.js2doc.Comment.extractJS2DocComment 
(String)":
       String cr = System.getProperty("line.separator");

       Comment parsedComment = new Comment();

       if (sourceComment != null) {
           String content = 
contentsPattern.matcher(sourceComment).replaceAll("$1");

           String[] lines = content.split(cr);



That's obviously wrong. On a Windows machine the separator is \r\n, but all 
line endings in the files are just \n, so no lines will be split! I'm going to 
change that..

Hm...

Our source code is supposed to be text and _should_ have platform line-endings 
when checked out via svn.

See:  "How to I ensure that eol style will be mapped to native format when I 
checkout/checkin?" at (http://wiki.openlaszlo.org/SubversionTips).

But when using Windows, there are the added twists of what the platform 
line-ending is in Cygwin (if you are using that) and what Java thinks the 
platform ending is (which I believe has its own twist because you install it 
under Windows and then might call it from Windows _or_ Cygwin).  [Curse you 
Bill Gates for ripping off Gary Kildall so faithfully!]

[Later}

Probably the simplest solution is to use a pattern to split and accept either 
LF or CR/LF, rather than try to figure out the Java/Cygwin/Windows stack.  You 
could even say you were just being XHTML-compliant.  :P


--- C:/Users/André/AppData/Local/Temp/Comment-0.2.java  Mon Mar 29 16:14:01 2010
+++ 
d:/Entwicklung/OpenLaszlo/cygwin/home/André/src/svn/openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/Comment.java
      Mon Mar 29 11:28:25 2010
@@ -17,6 +17,8 @@
 
     private static Logger logger = 
Logger.getLogger("org.openlaszlo.js2doc.Comment");
     
+    private static final Pattern lineSeparatorPattern = 
Pattern.compile("\r\n?|\n"); 
+
     static private final Pattern commentLineStart = 
Pattern.compile("^\\s*/\\*((?:.)*)$");
     static private final Pattern commentLineEnd   = 
Pattern.compile("^((?:.)*)\\*/.*$");
     
@@ -66,15 +68,11 @@
     }
     
     static public Comment extractJS2DocComment(String sourceComment) {
-        
-        String cr = System.getProperty("line.separator");
-
         Comment parsedComment = new Comment();
         
         if (sourceComment != null) {
             String content = 
contentsPattern.matcher(sourceComment).replaceAll("$1");
-    
-            String[] lines = content.split(cr);
+            String[] lines = lineSeparatorPattern.split(content);
     
             int i=0;
             String textContent = "";

Reply via email to