maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r694499 - in /maven/doxia/doxia/trunk: doxia-core/src/main/java/org/apache/maven/doxia/parser/ doxia-core/src/test/java/org/apache/maven/doxia/parser/ doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/doc...
Date Thu, 11 Sep 2008 21:38:52 GMT
Author: vsiveton
Date: Thu Sep 11 14:38:51 2008
New Revision: 694499

URL: http://svn.apache.org/viewvc?rev=694499&view=rev
Log:
o revert DOXIA-251, will implement DOXIA-226

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
    maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java?rev=694499&r1=694498&r2=694499&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
Thu Sep 11 14:38:51 2008
@@ -138,10 +138,7 @@
             }
             else if ( eventType == XmlPullParser.TEXT )
             {
-                if ( !parser.getText().trim().equals( "" ) )
-                {
-                    handleText( parser, sink );
-                }
+                handleText( parser, sink );
             }
             else if ( eventType == XmlPullParser.CDSECT )
             {
@@ -155,10 +152,6 @@
             {
                 handleEntity( parser, sink );
             }
-            else if ( eventType == XmlPullParser.IGNORABLE_WHITESPACE )
-            {
-                // nop
-            }
 
             try
             {

Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java?rev=694499&r1=694498&r2=694499&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
Thu Sep 11 14:38:51 2008
@@ -148,12 +148,17 @@
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
 
+        SinkEventElement el = (SinkEventElement) it.next();
+        assertEquals( "text", el.getName() );
+        assertEquals( " ",  (String) el.getArgs()[0] );
+
         assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
         assertFalse( it.hasNext() );
 
+
         // same test with EOL
         String EOL = System.getProperty( "line.separator" );
         text = "<p><b>word</b>" + EOL + "<i>word</i></p>";
@@ -167,6 +172,11 @@
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
 
+        el = (SinkEventElement) it.next();
+        assertEquals( "text", el.getName() );
+        // according to section 2.11 of the XML spec, parsers must normalize line breaks
to "\n"
+        assertEquals( "\n",  (String) el.getArgs()[0] );
+
         assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
@@ -187,7 +197,7 @@
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
 
-        SinkEventElement el = (SinkEventElement) it.next();
+        el = (SinkEventElement) it.next();
         assertEquals( "text", el.getName() );
         assertEquals( ".",  (String) el.getArgs()[0] );
 

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java?rev=694499&r1=694498&r2=694499&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java
Thu Sep 11 14:38:51 2008
@@ -116,12 +116,17 @@
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
 
+        SinkEventElement el = (SinkEventElement) it.next();
+        assertEquals( "text", el.getName() );
+        assertEquals( " ",  (String) el.getArgs()[0] );
+
         assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
         assertFalse( it.hasNext() );
 
+
         // same test with EOL
         text = "<para><command>word</command>" + EOL + "<emphasis>word</emphasis></para>";
 
@@ -134,10 +139,15 @@
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
 
+        el = (SinkEventElement) it.next();
+        assertEquals( "text", el.getName() );
+        assertEquals( EOL,  (String) el.getArgs()[0] );
+
         assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
         assertFalse( it.hasNext() );
+
     }
 }



Mime
View raw message