maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r804450 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src: main/java/org/apache/maven/doxia/module/fo/FoSink.java test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
Date Sat, 15 Aug 2009 10:36:53 GMT
Author: vsiveton
Date: Sat Aug 15 10:36:53 2009
New Revision: 804450

URL: http://svn.apache.org/viewvc?rev=804450&view=rev
Log:
DOXIA-357: NoSuchElementException with a table caption

o handle tableRows_() for table caption
o updated test case

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=804450&r1=804449&r2=804450&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Sat Aug 15 10:36:53 2009
@@ -986,6 +986,21 @@
     /** {@inheritDoc} */
     public void tableRows_()
     {
+        String tableCaption = null;
+        if ( tableCaptionXMLWriter != null )
+        {
+            tableCaption = tableCaptionWriter.toString();
+            tableCaptionXMLWriter = null;
+            tableCaptionWriter = null;
+
+            SinkEventAttributeSet atts = new SinkEventAttributeSet();
+            atts.addAttribute( SinkEventAttributes.ALIGN, "center" );
+
+            paragraph( atts );
+            write( tableCaption );
+            paragraph_();
+        }
+
         this.cellJustif = null;
         this.isCellJustif = false;
         writeEndTag( TABLE_BODY_TAG );

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java?rev=804450&r1=804449&r2=804450&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
Sat Aug 15 10:36:53 2009
@@ -20,6 +20,8 @@
  */
 
 import java.io.File;
+import java.io.StringReader;
+import java.io.StringWriter;
 import java.io.Writer;
 
 import org.apache.maven.doxia.document.DocumentMeta;
@@ -27,6 +29,7 @@
 import org.apache.maven.doxia.document.DocumentTOC;
 import org.apache.maven.doxia.document.DocumentTOCItem;
 
+import org.apache.maven.doxia.parser.XhtmlBaseParser;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.AbstractSinkTest;
 import org.apache.maven.doxia.sink.SinkTestDocument;
@@ -426,4 +429,31 @@
     {
         return "<!-- Simple comment with - - - - -->";
     }
+
+    /**
+     * DOXIA-357
+     *
+     * @throws Exception if any
+     */
+    public void testTableCaption()
+        throws Exception
+    {
+        StringBuffer html = new StringBuffer();
+        html.append( "<table>" ).append( EOL );
+        html.append( "<caption>caption table</caption>" ).append( EOL );
+        html.append( "<tr>" ).append( EOL );
+        html.append( "<td>foo</td>" ).append( EOL );
+        html.append( "</tr>" ).append( EOL );
+        html.append( "<tr>" ).append( EOL );
+        html.append( "<td>bar</td>" ).append( EOL );
+        html.append( "</tr>" ).append( EOL );
+        html.append( "</table>" ).append( EOL );
+
+        StringWriter sw = new StringWriter();
+        XhtmlBaseParser parser = new XhtmlBaseParser();
+        Sink sink = createSink( sw );
+        parser.parse( new StringReader( html.toString() ), sink );
+        sink.close();
+        assertTrue( true );
+    }
 }



Mime
View raw message