You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/07/11 14:53:26 UTC

svn commit: r675939 - /lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java

Author: andreas
Date: Fri Jul 11 05:53:25 2008
New Revision: 675939

URL: http://svn.apache.org/viewvc?rev=675939&view=rev
Log:
Use line breaks instead of <div> elements for diff formatting.

Modified:
    lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java

Modified: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java?rev=675939&r1=675938&r2=675939&view=diff
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java (original)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java Fri Jul 11 05:53:25 2008
@@ -10,6 +10,7 @@
     protected static final String ATTR_CLASS = "class";
     protected static final String ELEM_SPAN = "span";
     protected static final String ELEM_DIV = "div";
+    protected static final String ELEM_BR = "br";
     public static final String ADDED = "added";
     public static final String REMOVED = "removed";
     
@@ -26,7 +27,7 @@
 
     public void element(Object obj) throws Exception {
         if (obj instanceof StartTagStart) {
-            startElement(ELEM_DIV);
+            lineBreak();
             StartTagStart startTag = (StartTagStart) obj;
             characters("<" + startTag.getLocalName());
             this.handlingText = false;
@@ -39,7 +40,7 @@
         else if (obj instanceof EndTag) {
             EndTag endTag = (EndTag) obj;
             characters("</" + endTag.getLocalName() + ">");
-            endElement(ELEM_DIV);
+            lineBreak();
             this.handlingText = false;
         }
         else if (obj instanceof AttributeName) {
@@ -57,6 +58,11 @@
             this.handlingText = true;
         }
     }
+
+    protected void lineBreak() throws Exception {
+        startElement(ELEM_BR);
+        endElement(ELEM_BR);
+    }
     
     protected void closeAttribute() throws Exception {
         if (this.handlingAttr) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org