This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch DOXIA-668 in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit 77f3c1391c22f28453331e6fde221499d14f2977 Author: Michael Osipov <[email protected]> AuthorDate: Sat Oct 1 20:56:59 2022 +0200 [DOXIA-673] Remove compat handling of absent Sink#tableRows() calls --- .../maven/doxia/sink/impl/Xhtml5BaseSink.java | 32 ---------------------- .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java | 11 ++++++-- .../apache/maven/doxia/module/xdoc/XdocSink.java | 7 ----- 3 files changed, 9 insertions(+), 41 deletions(-) diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java index 5a9a4cc7..1364d71b 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java @@ -111,21 +111,6 @@ public class Xhtml5BaseSink /** used to store attributes passed to table(). */ protected MutableAttributeSet tableAttributes; - /** 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> - * */ - protected boolean tableRows = false; - // ---------------------------------------------------------------------- // Constructor // ---------------------------------------------------------------------- @@ -268,7 +253,6 @@ public class Xhtml5BaseSink this.evenTableRow = true; this.tableAttributes = null; - this.tableRows = false; } /** @@ -1387,7 +1371,6 @@ public class Xhtml5BaseSink public void table( SinkEventAttributes attributes ) { this.tableContentWriterStack.addLast( new StringWriter() ); - this.tableRows = false; if ( paragraphFlag ) { @@ -1416,8 +1399,6 @@ public class Xhtml5BaseSink @Override public void table_() { - this.tableRows = false; - writeEndTag( HtmlMarkup.TABLE ); if ( !this.cellCountStack.isEmpty() ) @@ -1465,15 +1446,8 @@ public class Xhtml5BaseSink @Override public void tableRows( int[] justification, boolean grid ) { - this.tableRows = true; - setCellJustif( justification ); - if ( this.tableAttributes == null ) - { - this.tableAttributes = new SinkEventAttributeSet( 0 ); - } - MutableAttributeSet att = new SinkEventAttributeSet(); if ( !this.tableAttributes.isDefined( Attribute.BORDER.toString() ) ) { @@ -1497,7 +1471,6 @@ public class Xhtml5BaseSink @Override public void tableRows_() { - this.tableRows = false; if ( !this.cellJustifStack.isEmpty() ) { this.cellJustifStack.removeLast(); @@ -1518,11 +1491,6 @@ public class Xhtml5BaseSink @Override public void tableRow() { - // To be backward compatible - if ( !this.tableRows ) - { - tableRows( null, false ); - } tableRow( null ); } diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java index 2ac2dbc8..5e4aedc1 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java +++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java @@ -1064,15 +1064,17 @@ public class Xhtml5BaseSinkTest { sink = new Xhtml5BaseSink( writer ); + sink.table(); sink.tableRows( justification, grid ); sink.tableRows_(); + sink.table_(); } finally { sink.close(); } - assertEquals( "<table border=\"0\" class=\"bodyTable\">", writer.toString() ); + assertEquals( "<table border=\"0\" class=\"bodyTable\"></table>", writer.toString() ); } /** @@ -1085,6 +1087,7 @@ public class Xhtml5BaseSinkTest { sink = new Xhtml5BaseSink( writer ); + sink.table(); sink.tableRows( null, false ); sink.tableRow( attributes ); sink.tableRow_(); @@ -1117,6 +1120,8 @@ public class Xhtml5BaseSinkTest attributes3.addAttributes( attributes ); sink = new Xhtml5BaseSink( writer ); + sink.table(); + sink.tableRows( null, false ); sink.tableRow(); sink.tableRow_(); sink.tableRow( attributes ); @@ -1143,6 +1148,8 @@ public class Xhtml5BaseSinkTest sink.tableRow_(); sink.tableRow(); sink.tableRow_(); + sink.tableRows_(); + sink.table_(); } finally { @@ -1159,7 +1166,7 @@ public class Xhtml5BaseSinkTest sbExpeted.append( "<tr class=\"xyz not-hidden a\"></tr>" ).append( EOL ); sbExpeted.append( "<tr style=\"bold\" class=\"xyz abc hidden b\"></tr>" ).append( EOL ); sbExpeted.append( "<tr class=\"xyz hidden-not b\"></tr>" ).append( EOL ); - sbExpeted.append( "<tr class=\"a\"></tr>" ); + sbExpeted.append( "<tr class=\"a\"></tr></table>" ); String xmlExpected = sbExpeted.toString(); assertEquals( xmlExpected, writer.toString() ); diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java index cc4a3089..ad6b8cdf 100644 --- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java +++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java @@ -454,15 +454,8 @@ public class XdocSink { // similar to super.tableRows( justification, grid ) but without class. - this.tableRows = true; - setCellJustif( justification ); - if ( this.tableAttributes == null ) - { - this.tableAttributes = new SinkEventAttributeSet( 0 ); - } - MutableAttributeSet att = new SinkEventAttributeSet(); if ( !tableAttributes.isDefined( Attribute.BORDER.toString() ) )
