maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r771271 - in /maven/doxia/doxia/trunk/doxia-core/src: main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
Date Mon, 04 May 2009 11:42:14 GMT
Author: vsiveton
Date: Mon May  4 11:42:14 2009
New Revision: 771271

URL: http://svn.apache.org/viewvc?rev=771271&view=rev
Log:
DOXIA-310: Unable to get custom entity references to work

o changed PATTERN_ENTITY_2 to accept 5 characters

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

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=771271&r1=771270&r2=771271&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
Mon May  4 11:42:14 2009
@@ -82,12 +82,12 @@
 
     /**
      * Entity pattern for Unicode entity, i.e. &
-     * "<!ENTITY(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,4};)*)(\\s)*\"(\\s)*>"
+     * "<!ENTITY(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,5};)*)(\\s)*\"(\\s)*>"
      * <br/>
      * see <a href="http://www.w3.org/TR/REC-xml/#NT-EntityDecl">http://www.w3.org/TR/REC-xml/#NT-EntityDecl</a>.
      */
     private static final Pattern PATTERN_ENTITY_2 =
-        Pattern.compile( ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,4};)*)(\\s)*\"(\\s)*>"
);
+        Pattern.compile( ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,5};)*)(\\s)*\"(\\s)*>"
);
 
     /**
      * Doctype pattern i.e. ".*<!DOCTYPE([^>]*)>.*"

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=771271&r1=771270&r2=771271&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
Mon May  4 11:42:14 2009
@@ -360,9 +360,8 @@
     public void testEntities()
         throws Exception
     {
-        final String text = "<!DOCTYPE test [<!ENTITY foo \"&#x159;\">]>"
-                + "<body><h2>&amp;&foo;</h2><p>&amp;&foo;</p></body>";
-
+        final String text = "<!DOCTYPE test [<!ENTITY foo \"&#x159;\">\n<!ENTITY
tritPos \"&#x1d7ed;\">]>"
+                + "<body><h2>&amp;&foo;</h2><p>&amp;&foo;</p><p>&tritPos;</p></body>";
 
         parser.setValidate( false );
         parser.parse( text, sink );
@@ -393,6 +392,14 @@
 
         assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
         //assertEquals( "section1_", ( (SinkEventElement) it.next() ).getName() );
+
+        assertEquals( "paragraph", ( (SinkEventElement) it.next() ).getName() );
+        textEvt = (SinkEventElement) it.next();
+        assertEquals( "rawText", textEvt.getName() );
+        System.out.println( textEvt.getName() + " " + textEvt.getArgs()[0] );
+        assertEquals( "&#x1d7ed;", textEvt.getArgs()[0] );
+        assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
+
         assertFalse( it.hasNext() );
     }
 



Mime
View raw message