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 957da21aea53a35c06116232d2f3d68de6881ab9 Author: Michael Osipov <micha...@apache.org> AuthorDate: Tue Aug 2 17:06:50 2022 +0200 [DOXIA-668] Remove all obsolete attributes in HTML5 This closes #114 --- .../maven/doxia/parser/Xhtml5BaseParser.java | 47 ++++++------------- .../apache/maven/doxia/sink/impl/SinkUtils.java | 29 ++++-------- .../maven/doxia/sink/impl/Xhtml5BaseSink.java | 53 +++++----------------- .../maven/doxia/parser/Xhtml5BaseParserTest.java | 8 ++-- .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java | 29 +++++++----- .../apache/maven/doxia/module/fml/FmlParser.java | 4 +- .../apache/maven/doxia/module/xdoc/XdocSink.java | 10 ---- .../maven/doxia/module/xdoc/XdocSinkTest.java | 6 +-- .../maven/doxia/module/xhtml5/Xhtml5SinkTest.java | 4 +- .../src/test/resources/test.xhtml | 30 ++++++------ 10 files changed, 75 insertions(+), 145 deletions(-) diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java index 6672f280..a6e7918c 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java @@ -21,6 +21,7 @@ package org.apache.maven.doxia.parser; import java.io.Reader; import java.util.Stack; +import java.util.regex.Pattern; import javax.swing.text.html.HTML.Attribute; @@ -46,6 +47,10 @@ public class Xhtml5BaseParser { private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5BaseParser.class ); + /** Used to identify if a class string contains `bodyTableBorder` */ + private static final Pattern BODYTABLEBORDER_CLASS_PATTERN = + Pattern.compile( "(?:.*\\s|^)bodyTableBorder(?:\\s.*|$)" ); + /** * True if a <script></script> or <style></style> block is read. CDATA sections within are * handled as rawText. @@ -632,7 +637,6 @@ public class Xhtml5BaseParser else if ( parser.getName().equals( HtmlMarkup.TABLE.toString() ) ) { sink.tableRows_(); - sink.table_(); } else if ( parser.getName().equals( HtmlMarkup.TR.toString() ) ) @@ -1044,22 +1048,12 @@ public class Xhtml5BaseParser } else { - String name = parser.getAttributeValue( null, Attribute.NAME.toString() ); - - if ( name != null ) + String id = parser.getAttributeValue( null, Attribute.ID.toString() ); + if ( id != null ) { - sink.anchor( validAnchor( name ), attribs ); + sink.anchor( validAnchor( id ), attribs ); isAnchor = true; } - else - { - String id = parser.getAttributeValue( null, Attribute.ID.toString() ); - if ( id != null ) - { - sink.anchor( validAnchor( id ), attribs ); - isAnchor = true; - } - } } } @@ -1218,26 +1212,13 @@ public class Xhtml5BaseParser private void handleTableStart( Sink sink, SinkEventAttributeSet attribs, XmlPullParser parser ) { sink.table( attribs ); - String border = parser.getAttributeValue( null, Attribute.BORDER.toString() ); - boolean grid = true; - - if ( border == null || "0".equals( border ) ) + String givenTableClass = parser.getAttributeValue( null, Attribute.CLASS.toString() ); + boolean grid = false; + if ( givenTableClass != null && BODYTABLEBORDER_CLASS_PATTERN.matcher( givenTableClass ).matches() ) { - grid = false; + grid = true; } - - String align = parser.getAttributeValue( null, Attribute.ALIGN.toString() ); - int[] justif = {Sink.JUSTIFY_LEFT}; - - if ( "center".equals( align ) ) - { - justif[0] = Sink.JUSTIFY_CENTER; - } - else if ( "right".equals( align ) ) - { - justif[0] = Sink.JUSTIFY_RIGHT; - } - - sink.tableRows( justif, grid ); + sink.tableRows( null, grid ); } + } diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkUtils.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkUtils.java index f1c1ede4..87d405f1 100644 --- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkUtils.java +++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkUtils.java @@ -103,54 +103,41 @@ public class SinkUtils private static final String[] IMG_ATTRIBUTES = { - SinkEventAttributes.ALIGN, SinkEventAttributes.ALT, SinkEventAttributes.BORDER, - SinkEventAttributes.HEIGHT, SinkEventAttributes.HSPACE, SinkEventAttributes.ISMAP, - SinkEventAttributes.SRC, SinkEventAttributes.USEMAP, SinkEventAttributes.VSPACE, - SinkEventAttributes.WIDTH + SinkEventAttributes.ALT, SinkEventAttributes.HEIGHT, SinkEventAttributes.ISMAP, + SinkEventAttributes.SRC, SinkEventAttributes.WIDTH }; private static final String[] HR_ATTRIBUTES = { - SinkEventAttributes.ALIGN, SinkEventAttributes.NOSHADE, SinkEventAttributes.SIZE, - SinkEventAttributes.WIDTH }; private static final String[] LINK_ATTRIBUTES = { - SinkEventAttributes.CHARSET, SinkEventAttributes.COORDS, SinkEventAttributes.HREF, - SinkEventAttributes.HREFLANG, SinkEventAttributes.REL, SinkEventAttributes.REV, - SinkEventAttributes.SHAPE, SinkEventAttributes.TARGET, SinkEventAttributes.TYPE + SinkEventAttributes.HREF, SinkEventAttributes.HREFLANG, SinkEventAttributes.REL, + SinkEventAttributes.TARGET, SinkEventAttributes.TYPE }; private static final String[] TABLE_ATTRIBUTES = { - SinkEventAttributes.ALIGN, SinkEventAttributes.BGCOLOR, SinkEventAttributes.BORDER, - SinkEventAttributes.CELLPADDING, SinkEventAttributes.CELLSPACING, SinkEventAttributes.FRAME, - SinkEventAttributes.RULES, SinkEventAttributes.SUMMARY, SinkEventAttributes.WIDTH }; private static final String[] TABLE_CELL_ATTRIBUTES = { - SinkEventAttributes.ABBRV, SinkEventAttributes.ALIGN, SinkEventAttributes.AXIS, - SinkEventAttributes.BGCOLOR, SinkEventAttributes.COLSPAN, SinkEventAttributes.HEADERS, - SinkEventAttributes.HEIGHT, SinkEventAttributes.NOWRAP, SinkEventAttributes.ROWSPAN, - SinkEventAttributes.SCOPE, SinkEventAttributes.VALIGN, SinkEventAttributes.WIDTH + SinkEventAttributes.COLSPAN, SinkEventAttributes.HEADERS, SinkEventAttributes.ROWSPAN }; static { SINK_IMG_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, IMG_ATTRIBUTES ); SINK_SECTION_ATTRIBUTES = - join( SINK_BASE_ATTRIBUTES, new String[] {SinkEventAttributes.ALIGN} ); + join( SINK_BASE_ATTRIBUTES, new String[0] ); SINK_VERBATIM_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, - new String[] {SinkEventAttributes.ALIGN, SinkEventAttributes.DECORATION, SinkEventAttributes.WIDTH} ); + new String[] {SinkEventAttributes.DECORATION} ); SINK_HR_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, HR_ATTRIBUTES ); SINK_LINK_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, LINK_ATTRIBUTES ); SINK_TABLE_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, TABLE_ATTRIBUTES ); - SINK_TR_ATTRIBUTES = - join( SINK_BASE_ATTRIBUTES, - new String[] {SinkEventAttributes.ALIGN, SinkEventAttributes.BGCOLOR, SinkEventAttributes.VALIGN} ); + SINK_TR_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, new String[0] ); SINK_TD_ATTRIBUTES = join( SINK_BASE_ATTRIBUTES, TABLE_CELL_ATTRIBUTES ); } 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..817156bc 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() ) @@ -1457,7 +1438,8 @@ public class Xhtml5BaseSink /** * The default class style is <code>bodyTable</code>. - * The default align is <code>center</code>. + * + * @param grid if {@code true} the default class {@code bodyTableBorder} will be added * * {@inheritDoc} * @see javax.swing.text.html.HTML.Tag#TABLE @@ -1465,24 +1447,13 @@ 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() ) ) - { - att.addAttribute( Attribute.BORDER, ( grid ? "1" : "0" ) ); - } if ( !this.tableAttributes.isDefined( Attribute.CLASS.toString() ) ) { - att.addAttribute( Attribute.CLASS, "bodyTable" ); + att.addAttribute( Attribute.CLASS, "bodyTable" + ( grid ? " bodyTableBorder" : "" ) ); } att.addAttributes( this.tableAttributes ); @@ -1497,7 +1468,6 @@ public class Xhtml5BaseSink @Override public void tableRows_() { - this.tableRows = false; if ( !this.cellJustifStack.isEmpty() ) { this.cellJustifStack.removeLast(); @@ -1518,11 +1488,6 @@ public class Xhtml5BaseSink @Override public void tableRow() { - // To be backward compatible - if ( !this.tableRows ) - { - tableRows( null, false ); - } tableRow( null ); } @@ -1625,12 +1590,16 @@ public class Xhtml5BaseSink && cellJustifStack != null && !cellJustifStack.isEmpty() && getCellJustif() != null ) { int cellCount = getCellCount(); - if ( cellCount < getCellJustif().length ) + if ( cellCount < getCellJustif().length + && ( attributes == null || !attributes.isDefined( Attribute.STYLE.toString() ) ) ) { Map<Integer, MutableAttributeSet> hash = new HashMap<>(); - hash.put( Sink.JUSTIFY_CENTER, SinkEventAttributeSet.CENTER ); - hash.put( Sink.JUSTIFY_LEFT, SinkEventAttributeSet.LEFT ); - hash.put( Sink.JUSTIFY_RIGHT, SinkEventAttributeSet.RIGHT ); + hash.put( Sink.JUSTIFY_CENTER, + new SinkEventAttributeSet( SinkEventAttributes.STYLE, "text-align: center;" ).unmodifiable() ); + hash.put( Sink.JUSTIFY_LEFT, + new SinkEventAttributeSet( SinkEventAttributes.STYLE, "text-align: left;" ).unmodifiable() ); + hash.put( Sink.JUSTIFY_RIGHT, + new SinkEventAttributeSet( SinkEventAttributes.STYLE, "text-align: right;" ).unmodifiable() ); MutableAttributeSet atts = hash.get( getCellJustif()[cellCount] ); if ( attributes == null ) diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java index 9fd83ef4..895388c8 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java +++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java @@ -160,7 +160,7 @@ public class Xhtml5BaseParserTest { // TODO: table caption, see DOXIA-177 - String text = "<table align=\"center\"><tr><th>Header</th></tr><tr><td>cell</td></tr></table>"; + String text = "<table><tr><th>Header</th></tr><tr><td>cell</td></tr></table>"; parser.parse( text, sink ); @@ -739,8 +739,8 @@ public class Xhtml5BaseParserTest "<a href=\"valid\"></a>" + "<a href=\"#1invalid\"></a>" + "<a href=\"http://www.fo.com/index.html#1invalid\"></a>" + - "<a name=\"valid\"></a>" + - "<a name=\"1invalid\"></a>" + + "<a id=\"valid\"></a>" + + "<a id=\"1invalid\"></a>" + "<a id=\"1invalid\"></a></div>"; parser.parse( text, sink ); @@ -797,7 +797,7 @@ public class Xhtml5BaseParserTest public void testAttributeEntities() throws Exception { - String text = "<script type=\"text/javascript\" src=\"http://ex.com/ex.js?v=l&l=e\"></script>"; + String text = "<script src=\"http://ex.com/ex.js?v=l&l=e\"></script>"; parser.parse( text, sink ); 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..61838c51 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 @@ -169,15 +169,15 @@ public class Xhtml5BaseSinkTest String actual = writer.toString(); assertTrue( - actual.contains( "<table border=\"0\" class=\"bodyTable\">" + "<caption>caption&1</caption>" ) ); + actual.contains( "<table class=\"bodyTable\">" + "<caption>caption&1</caption>" ) ); assertTrue( actual.contains( - "<table border=\"0\" class=\"bodyTable\" align=\"left\">" + "<caption>caption2</caption>" ) ); + "<table class=\"bodyTable\">" + "<caption>caption2</caption>" ) ); assertTrue( actual.contains( - "<table border=\"0\" class=\"bodyTable\" align=\"right\">" + "<caption>caption3</caption>" ) ); + "<table class=\"bodyTable\">" + "<caption>caption3</caption>" ) ); - assertTrue( actual.contains( "<td align=\"center\">cell11</td>" ) ); - assertTrue( actual.contains( "<td align=\"left\">nestedTable1Cell11</td>" ) ); - assertTrue( actual.contains( "<td align=\"right\">nestedTable2Cell11</td>" ) ); + assertTrue( actual.contains( "<td style=\"text-align: center;\">cell11</td>" ) ); + assertTrue( actual.contains( "<td style=\"text-align: left;\">nestedTable1Cell11</td>" ) ); + assertTrue( actual.contains( "<td style=\"text-align: right;\">nestedTable2Cell11</td>" ) ); assertTrue( actual.contains( "<td>nestedTable1Cell22</td>" ) ); assertTrue( actual.contains( "<td>cell22</td>" ) ); } @@ -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 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_(); @@ -1098,7 +1101,7 @@ public class Xhtml5BaseSinkTest sink.close(); } - String xmlExpected = "<table border=\"0\" class=\"bodyTable\">" + EOL + "<tr style=\"bold\" class=\"a\"></tr>" + String xmlExpected = "<table class=\"bodyTable\">" + EOL + "<tr style=\"bold\" class=\"a\"></tr>" + EOL + "<tr class=\"b\"></tr></table>"; assertEquals( xmlExpected, writer.toString() ); @@ -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,13 +1148,15 @@ public class Xhtml5BaseSinkTest sink.tableRow_(); sink.tableRow(); sink.tableRow_(); + sink.tableRows_(); + sink.table_(); } finally { sink.close(); } - StringBuilder sbExpeted = new StringBuilder( "<table border=\"0\" class=\"bodyTable\">" ); + StringBuilder sbExpeted = new StringBuilder( "<table class=\"bodyTable\">" ); sbExpeted.append( EOL ).append( "<tr class=\"a\"></tr>" ).append( EOL ); sbExpeted.append( "<tr style=\"bold\" class=\"b\"></tr>" ).append( EOL ); sbExpeted.append( "<tr class=\"hidden xyz abc a\"></tr>" ).append( EOL ); @@ -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() ); @@ -1231,7 +1238,7 @@ public class Xhtml5BaseSinkTest } assertEquals( - "<table border=\"0\" class=\"bodyTable\">" + "<caption style=\"bold\">caption</caption></table>", + "<table class=\"bodyTable\">" + "<caption style=\"bold\">caption</caption></table>", writer.toString() ); } diff --git a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java index 70cb8a43..92e0ccb2 100644 --- a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java +++ b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java @@ -675,9 +675,7 @@ public class FmlParser */ private void writeTopLink( Sink sink ) { - SinkEventAttributeSet atts = new SinkEventAttributeSet(); - atts.addAttribute( SinkEventAttributeSet.ALIGN, "right" ); - sink.paragraph( atts ); + sink.paragraph(); sink.link( "#top" ); sink.text( "[top]" ); sink.link_(); 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 de012612..2a79ed2b 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 @@ -396,7 +396,6 @@ public class XdocSink MutableAttributeSet atts = SinkUtils.filterAttributes( attributes, SinkUtils.SINK_VERBATIM_ATTRIBUTES ); - if ( atts == null ) { atts = new SinkEventAttributeSet(); @@ -418,7 +417,6 @@ public class XdocSink } else { - atts.removeAttribute( Attribute.ALIGN.toString() ); writeStartTag( PRE, atts ); } } @@ -455,15 +453,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() ) ) @@ -488,7 +479,6 @@ public class XdocSink public void tableRow() { MutableAttributeSet att = new SinkEventAttributeSet(); - att.addAttribute( Attribute.VALIGN, "top" ); writeStartTag( TR, att ); diff --git a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java index 3e8613f8..59f9c1ce 100644 --- a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java +++ b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java @@ -233,7 +233,7 @@ public class XdocSinkTest protected String getTableBlock( String cell, String caption ) { return "<table border=\"0\"><caption>" + caption - + "</caption>\n<tr valign=\"top\">\n<td align=\"center\">" + cell + "</td></tr></table>"; + + "</caption>\n<tr>\n<td style=\"text-align: center;\">" + cell + "</td></tr></table>"; } /** {@inheritDoc} */ @@ -392,15 +392,13 @@ public class XdocSinkTest sink.verbatim_(); sink.verbatim( SinkEventAttributeSet.BOXED ); sink.verbatim_(); - sink.verbatim( new SinkEventAttributeSet( SinkEventAttributeSet.WIDTH, "20%" ) ); - sink.verbatim_(); } finally { sink.close(); } - assertEquals( "<pre></pre><source></source>\n<pre width=\"20%\"></pre>", writer.toString() ); + assertEquals( "<pre></pre><source></source>", writer.toString() ); } /** diff --git a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java index 9b900454..a6e4dfdf 100644 --- a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java +++ b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java @@ -112,7 +112,7 @@ public class Xhtml5SinkTest protected String getHeadBlock() { return "<!DOCTYPE html\">" + - "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/></head>"; + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title></title>\n<meta charset=\"UTF-8\"/></head>"; } /** {@inheritDoc} */ @@ -226,7 +226,7 @@ public class Xhtml5SinkTest /** {@inheritDoc} */ protected String getTableBlock( String cell, String caption ) { - return "<table border=\"0\" class=\"bodyTable\">" + return "<table class=\"bodyTable\">" + "<caption>Table caption</caption><tr class=\"a\">\n<td>cell</td></tr>" + "</table>"; } diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml index a93e0d3f..e98d00c5 100644 --- a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml +++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml @@ -75,34 +75,34 @@ under the License. <p>--- instead of +-- suppresses the box around verbatim text.</p> <div class="figure"> - <p align="center"><img src="figure.png" alt="figure.png" /></p> - <p align="center"><i>Figure caption</i></p> + <p style="text-align: center;"><img src="figure.png" alt="figure.png" /></p> + <p style="text-align: center;"><i>Figure caption</i></p> </div> -<table align="center" border="1" class="bodyTable"> +<table style="margin-left: auto; margin-right: auto;" class="bodyTable bodyTableBorder"> <caption>Table caption</caption> <tr class="a"> - <th align="center">Centered<br />cell 1,1</th> - <th align="left">Left-aligned<br />cell 1,2</th> - <th align="right">Right-aligned<br />cell 1,3</th> + <th style="text-align: center;">Centered<br />cell 1,1</th> + <th style="text-align: left;">Left-aligned<br />cell 1,2</th> + <th style="text-align: right;">Right-aligned<br />cell 1,3</th> </tr> <tr class="b"> - <td align="center">cell 2,1</td> - <td align="left">cell 2,2</td> - <td align="right">cell 2,3</td> + <td style="text-align: center;">cell 2,1</td> + <td style="text-align: left;">cell 2,2</td> + <td style="text-align: right;">cell 2,3</td> </tr> </table> <p>No grid, no caption:</p> -<table align="center" border="0" class="bodyTable"> +<table style="margin-left: auto; margin-right: auto;" class="bodyTable"> <tr class="a"> - <td align="center">cell</td> - <td align="center">cell</td> + <td style="text-align: center;">cell</td> + <td style="text-align: center;">cell</td> </tr> <tr class="b"> - <td align="center">cell</td> - <td align="center">cell</td> + <td style="text-align: center;">cell</td> + <td style="text-align: center;">cell</td> </tr> </table> @@ -114,7 +114,7 @@ under the License. <p><i>Italic</i> font. <b>Bold</b> font. <code>Monospaced</code> font.</p> <p> - <a name="Anchor">Anchor</a>. + <a id="Anchor">Anchor</a>. Link to <a href="#Anchor">Anchor</a>. Link to <a href="http://www.pixware.fr" class="externalLink">http://www.pixware.fr</a>. Link to <a href="#Anchor">showing alternate text</a>.