Author: vsiveton Date: Sun Mar 1 12:41:31 2009 New Revision: 749015 URL: http://svn.apache.org/viewvc?rev=749015&view=rev Log: DOXIA-292: Be sure to call tableRows(int[], boolean) to be backward compatible with Doxia 1.0
o fixed Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java?rev=749015&r1=749014&r2=749015&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java (original) +++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java Sun Mar 1 12:41:31 2009 @@ -95,6 +95,21 @@ /** Indicates that an image is part of a figure. */ private boolean inFigure; + /** Flag to know if {...@link #tableRows(int[], boolean)} is called or not. It is mainly to be backward compatible + * with some plugins (like checkstyle) which uses: + * <pre> + * sink.table(); + * sink.tableRow(); + * </pre> + * instead of + * <pre> + * sink.table(); + * sink.tableRows( justify, true ); + * sink.tableRow(); + * </pre> + * */ + boolean tableRows = false; + // ---------------------------------------------------------------------- // Constructor // ---------------------------------------------------------------------- @@ -1085,6 +1100,8 @@ /** {...@inheritdoc} */ public void table( SinkEventAttributes attributes ) { + this.tableRows = false; + if ( paragraphFlag ) { // The content of element type "p" must match @@ -1111,6 +1128,8 @@ */ public void table_() { + this.tableRows = false; + writeEndTag( Tag.TABLE ); String content = tempWriter.toString(); @@ -1168,6 +1187,8 @@ */ public void tableRows( int[] justification, boolean grid ) { + this.tableRows = true; + this.cellJustif = justification; this.isCellJustif = true; @@ -1203,6 +1224,7 @@ /** {...@inheritdoc} */ public void tableRows_() { + this.tableRows = false; this.cellJustif = null; this.isCellJustif = false; @@ -1217,6 +1239,11 @@ */ public void tableRow() { + // To be backward compatible + if ( !this.tableRows ) + { + tableRows( null, false ); + } tableRow( null ); }