r9908 - helma/helma/trunk/src/helma/util

[email protected] Wed, 16 Sep 2009 11:52:46 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090916095246.844CA3D0E3@mia>
Author: hannes
Date: 2009-09-16 11:52:46 +0200 (Wed, 16 Sep 2009)
New Revision: 9908

Modified:
   helma/helma/trunk/src/helma/util/MarkdownProcessor.java
Log:
Implement single line break by ending a line with two or more spaces, remove unused field definitions.

Details at http://dev.helma.org/trac/helma/changeset/9908

Modified: helma/helma/trunk/src/helma/util/MarkdownProcessor.java
===================================================================
--- helma/helma/trunk/src/helma/util/MarkdownProcessor.java	2009-09-16 09:20:25 UTC (rev 9907)
+++ helma/helma/trunk/src/helma/util/MarkdownProcessor.java	2009-09-16 09:52:46 UTC (rev 9908)
@@ -17,7 +17,6 @@
     private int paragraphStartMarker = 0;
     private boolean listParagraphs = false;
     private int codeEndMarker = 0;
-    private boolean strong, em;
     private ElementStack stack = new ElementStack();
     private HashMap spanTags;
 
@@ -26,9 +25,11 @@
     // private Logger log = Logger.getLogger(MarkdownProcessor.class);
     private int line;
 
-    private final int NONE = 0, NEWLINE = 1, LINK_ID = 2, LINK_URL = 3,
+    private final int
+        // stage 1 states
+        NONE = 0, NEWLINE = 1, LINK_ID = 2, LINK_URL = 3,
         // stage 2 states
-        HEADER = 4, PARAGRAPH = 5, LIST = 6, HTML_BLOCK = 7, CODE = 8, BLOCKQUOTE = 9;
+        HEADER = 4, PARAGRAPH = 5, LIST = 6, HTML_BLOCK = 7, CODE = 8;
 
     static final Set blockTags = new HashSet();
 
@@ -869,6 +870,8 @@
                 (chars[i + 1] == '\n' || buffer.charAt(buffer.length() - 1) == '\n')) {
             buffer.insert(paragraphEndMarker, "</p>");
             buffer.insert(paragraphStartMarker, "<p>");
+        } else if (i > 1 && chars[i-1] == ' ' && chars[i-2] == ' ') {
+            buffer.append("<br />");
         }
     }