struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@apache.org
Subject svn commit: r372732 - in /struts/shale/trunk/clay-plugin/src: java/org/apache/shale/clay/config/beans/ java/org/apache/shale/clay/parser/ test/org/apache/shale/clay/config/ test/org/apache/shale/clay/parser/
Date Fri, 27 Jan 2006 04:57:11 GMT
Author: gvanmatre
Date: Thu Jan 26 20:56:58 2006
New Revision: 372732

URL: http://svn.apache.org/viewcvs?rev=372732&view=rev
Log:
Fixes for two bugs reported by Richard Wallace.  The html parser was truncating the text of
a node when the last node was not a markup tag.  The symbols were not consistently handling
case insensitive.

Modified:
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentBean.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/NodeTokenizer.java
    struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/address-config.xml
    struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentBean.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentBean.java?rev=372732&r1=372731&r2=372732&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentBean.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentBean.java
Thu Jan 26 20:56:58 2006
@@ -215,7 +215,7 @@
     /**
      * <p>The replacement symbol table for the component meta-data.</p>
      */
-    private Map symbols = new TreeMap();
+    private Map symbols = new Attributes();
     
     
     

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/NodeTokenizer.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/NodeTokenizer.java?rev=372732&r1=372731&r2=372732&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/NodeTokenizer.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/NodeTokenizer.java
Thu Jan 26 20:56:58 2006
@@ -222,7 +222,7 @@
         }
         
         if ((buffer.length()) > s + 1) {
-            TokenOffset offset = new TokenOffset(s + 1, (buffer.length() - 1), lineNumber,
lineBeginOffset);
+            TokenOffset offset = new TokenOffset(s, (buffer.length()), lineNumber, lineBeginOffset);
             tokenIndex.add(offset);
             
             if (log.isDebugEnabled()) {

Modified: struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/address-config.xml
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/address-config.xml?rev=372732&r1=372731&r2=372732&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/address-config.xml
(original)
+++ struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/address-config.xml
Thu Jan 26 20:56:58 2006
@@ -263,7 +263,7 @@
 	   <element renderId="1" jsfid="symbol1Label" />         
 	   <element renderId="2" jsfid="symbol1Label">
 	   	   <symbols >
-	          <set name="mystyle" value="color:red"/>
+	          <set name="myStyle" value="color:red"/>
 	       </symbols>
 	   </element>	      
 	</component>

Modified: struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java?rev=372732&r1=372731&r2=372732&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java
(original)
+++ struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/parser/ParserTestCase.java
Thu Jan 26 20:56:58 2006
@@ -639,6 +639,38 @@
 
     }
     
+    //parse document ending in text
+    public void testPlainText() {
+   
+        Parser p = new Parser();
+        StringBuffer doc = new StringBuffer();
+        
+        doc.append("<br/>test");
+
+        List nodes = p.parse(doc);
+        assertTrue("Plain text, 2 node", nodes.size() == 2);
+
+        Node root = (Node) nodes.get(1);
+        assertNotNull("last node", root);
+
+        assertEquals("node raw text", root.getToken().getRawText(), "test");
+
+
+        doc.setLength(0);
+        doc.append("This is a test.");
+
+        nodes = p.parse(doc);
+        assertTrue("Plain text, 1 node", nodes.size() == 1);
+
+        root = (Node) nodes.get(0);
+        assertNotNull("first node", root);
+
+        assertEquals("node raw text", root.getToken().getRawText(), doc.toString());
+
+        
+    }
+    
+    
     /**
      * <p>Test parsing a DOCTYPE Tag.</p>
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message