Update of /var/cvs/src/org/mmbase/util/transformers
In directory james.mmbase.org:/tmp/cvs-serv27325

Modified Files:
      Tag: MMBase-1_8
        XmlField.java 
Log Message:
  MMB-1652


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util/transformers
See also: http://www.mmbase.org/jira/browse/MMB-1652


Index: XmlField.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/transformers/XmlField.java,v
retrieving revision 1.46.2.2
retrieving revision 1.46.2.3
diff -u -b -r1.46.2.2 -r1.46.2.3
--- XmlField.java       22 Apr 2008 11:14:58 -0000      1.46.2.2
+++ XmlField.java       3 Jun 2008 11:18:45 -0000       1.46.2.3
@@ -20,7 +20,7 @@
  * XMLFields in MMBase. This class can encode such a field to several other 
formats.
  *
  * @author Michiel Meeuwissen
- * @version $Id: XmlField.java,v 1.46.2.2 2008/04/22 11:14:58 michiel Exp $
+ * @version $Id: XmlField.java,v 1.46.2.3 2008/06/03 11:18:45 michiel Exp $
  * @todo   THIS CLASS NEEDS A CONCEPT! It gets a bit messy.
  */
 
@@ -70,21 +70,21 @@
             return;
         }
         char listChar = '-';
-        if (isListChar(obj.charAt(0)) && !isListChar(obj.charAt(1))) { // hoo, 
we even _start_ with a list;
+        if (isListChar(obj.charAt(0)) && obj.charAt(1) == ' ' && 
!isListChar(obj.charAt(2))) { // hoo, we even _start_ with a list;
             listChar = obj.charAt(0);
             obj.insert(0, "\n"); // in the loop \n- is deleted, so it must be 
there.
         } else {
             while (true) {
-                int pos1 = obj.indexOf("\n-", pos); // search the first
-                int pos2 = obj.indexOf("\n*", pos); // search the first
+                int pos1 = obj.indexOf("\n- ", pos); // search the first
+                int pos2 = obj.indexOf("\n* ", pos); // search the first
 
                 pos = (pos1 > 0 && pos1 < pos2) || pos2 < 0 ? pos1 : pos2;
-                if (pos == -1 || obj.length() <= pos + 2) break;
-                if (! isListChar(obj.charAt(pos + 2))) {
+                if (pos == -1 || obj.length() <= pos + 3) break;
+                if (! isListChar(obj.charAt(pos + 3))) {
                     listChar = obj.charAt(pos + 1);
                     break;
                 }
-                pos += 2;
+                pos += 3;
             }
         }
 
@@ -136,16 +136,16 @@
                 }
             } else { // search for next item
                 while (true) {
-                    int pos1 = obj.indexOf("\n-", pos);
-                    int pos2 = obj.indexOf("\n*", pos);
+                    int pos1 = obj.indexOf("\n- ", pos);
+                    int pos2 = obj.indexOf("\n* ", pos);
 
                     pos = (pos1 > 0 && pos1 < pos2) || pos2 < 0 ? pos1 : pos2;
-                    if (pos == -1 || obj.length() <= pos + 2) break;
-                    if (! isListChar(obj.charAt(pos + 2))) {
+                    if (pos == -1 || obj.length() <= pos + 3) break;
+                    if (! isListChar(obj.charAt(pos + 3))) {
                         listChar = obj.charAt(pos + 1);
                         break; // should not start with two -'s, because this 
is some seperation line
                     }
-                    pos += 2;
+                    pos += 3;
                 }
             }
         }
@@ -156,6 +156,7 @@
         }
 
     }
+
     /**
      * If you want to add a _ in your text, that should be possible too...
      * Should be done last, because no tags can appear in <em>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to