You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/08/02 15:07:06 UTC

[maven-doxia] branch DOXIA-668 created (now 93a2a407)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch DOXIA-668
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git


      at 93a2a407 [DOXIA-668] Remove all obsolete attributes in HTML5

This branch includes the following new commits:

     new 93a2a407 [DOXIA-668] Remove all obsolete attributes in HTML5

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-doxia] 01/01: [DOXIA-668] Remove all obsolete attributes in HTML5

Posted by mi...@apache.org.
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 93a2a407470b84a751594e998505cd1c0c2dc88d
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Aug 2 17:06:50 2022 +0200

    [DOXIA-668] Remove all obsolete attributes in HTML5
---
 .../maven/doxia/parser/Xhtml5BaseParser.java       |  45 +-----
 .../apache/maven/doxia/sink/impl/SinkUtils.java    |  29 ++--
 .../maven/doxia/sink/impl/Xhtml5BaseSink.java      | 151 +--------------------
 .../maven/doxia/parser/Xhtml5BaseParserTest.java   |   4 +-
 .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java  |  29 ++--
 .../apache/maven/doxia/module/fml/FmlParser.java   |   4 +-
 .../apache/maven/doxia/module/xdoc/XdocSink.java   |  19 ---
 .../maven/doxia/module/xdoc/XdocSinkTest.java      |   8 +-
 .../src/test/resources/test.xhtml                  |  30 ++--
 9 files changed, 53 insertions(+), 266 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..203cc2f8 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
@@ -389,7 +389,8 @@ public class Xhtml5BaseParser
         }
         else if ( parser.getName().equals( HtmlMarkup.TABLE.toString() ) )
         {
-            handleTableStart( sink, attribs, parser );
+            sink.table( attribs );
+            sink.tableRows( new int[0], false );
         }
         else if ( parser.getName().equals( HtmlMarkup.TR.toString() ) )
         {
@@ -632,7 +633,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 +1044,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;
-                }
-            }
         }
     }
 
@@ -1215,29 +1205,4 @@ public class Xhtml5BaseParser
         sink.section_( sectionLevel-- );
     }
 
-    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 ) )
-        {
-            grid = false;
-        }
-
-        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 );
-    }
 }
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..f0c814c1 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
@@ -25,10 +25,8 @@ import java.io.Writer;
 import java.util.ArrayList;
 import java.util.EmptyStackException;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 import java.util.Stack;
 import java.util.regex.Pattern;
@@ -39,7 +37,6 @@ import javax.swing.text.html.HTML.Tag;
 
 import org.apache.maven.doxia.markup.HtmlMarkup;
 import org.apache.maven.doxia.markup.Markup;
-import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkEventAttributes;
 import org.apache.maven.doxia.util.DoxiaUtils;
 import org.apache.maven.doxia.util.HtmlTools;
@@ -86,15 +83,6 @@ public class Xhtml5BaseSink
     /** An indication on if we're in verbatim mode. */
     private boolean verbatimFlag;
 
-    /** Stack of alignment int[] of table cells. */
-    private final LinkedList<int[]> cellJustifStack;
-
-    /** Stack of justification of table cells. */
-    private final LinkedList<Boolean> isCellJustifStack;
-
-    /** Stack of current table cell. */
-    private final LinkedList<Integer> cellCountStack;
-
     /** Used to style successive table rows differently. */
     private boolean evenTableRow = true;
 
@@ -111,21 +99,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
     // ----------------------------------------------------------------------
@@ -139,9 +112,6 @@ public class Xhtml5BaseSink
     {
         this.writer = new PrintWriter( out );
 
-        this.cellJustifStack = new LinkedList<>();
-        this.isCellJustifStack = new LinkedList<>();
-        this.cellCountStack = new LinkedList<>();
         this.tableContentWriterStack = new LinkedList<>();
         this.tableCaptionWriterStack = new LinkedList<>();
         this.tableCaptionXMLWriterStack = new LinkedList<>();
@@ -204,47 +174,6 @@ public class Xhtml5BaseSink
         return this.verbatimFlag ;
     }
 
-    /**
-     * <p>Setter for the field <code>cellJustif</code>.</p>
-     *
-     * @param justif the new cell justification array.
-     */
-    protected void setCellJustif( int[] justif )
-    {
-        this.cellJustifStack.addLast( justif );
-        this.isCellJustifStack.addLast( Boolean.TRUE );
-    }
-
-    /**
-     * <p>Getter for the field <code>cellJustif</code>.</p>
-     *
-     * @return the current cell justification array.
-     */
-    protected int[] getCellJustif()
-    {
-        return this.cellJustifStack.getLast();
-    }
-
-    /**
-     * <p>Setter for the field <code>cellCount</code>.</p>
-     *
-     * @param count the new cell count.
-     */
-    protected void setCellCount( int count )
-    {
-        this.cellCountStack.addLast( count );
-    }
-
-    /**
-     * <p>Getter for the field <code>cellCount</code>.</p>
-     *
-     * @return the current cell count.
-     */
-    protected int getCellCount()
-    {
-        return Integer.parseInt( this.cellCountStack.getLast().toString() );
-    }
-
     /** {@inheritDoc} */
     @Override
     protected void init()
@@ -253,9 +182,6 @@ public class Xhtml5BaseSink
 
         resetTextBuffer();
 
-        this.cellJustifStack.clear();
-        this.isCellJustifStack.clear();
-        this.cellCountStack.clear();
         this.tableContentWriterStack.clear();
         this.tableCaptionWriterStack.clear();
         this.tableCaptionXMLWriterStack.clear();
@@ -268,7 +194,6 @@ public class Xhtml5BaseSink
 
         this.evenTableRow = true;
         this.tableAttributes = null;
-        this.tableRows = false;
     }
 
     /**
@@ -1387,7 +1312,6 @@ public class Xhtml5BaseSink
     public void table( SinkEventAttributes attributes )
     {
         this.tableContentWriterStack.addLast( new StringWriter() );
-        this.tableRows = false;
 
         if ( paragraphFlag )
         {
@@ -1416,15 +1340,8 @@ public class Xhtml5BaseSink
     @Override
     public void table_()
     {
-        this.tableRows = false;
-
         writeEndTag( HtmlMarkup.TABLE );
 
-        if ( !this.cellCountStack.isEmpty() )
-        {
-            this.cellCountStack.removeLast().toString();
-        }
-
         if ( this.tableContentWriterStack.isEmpty() )
         {
             LOGGER.warn( "No table content" );
@@ -1457,7 +1374,7 @@ public class Xhtml5BaseSink
 
     /**
      * The default class style is <code>bodyTable</code>.
-     * The default align is <code>center</code>.
+     * Note: both parameters are ignored because they have been superseded by CSS in HTML5.
      *
      * {@inheritDoc}
      * @see javax.swing.text.html.HTML.Tag#TABLE
@@ -1465,20 +1382,7 @@ 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() ) )
         {
@@ -1489,24 +1393,12 @@ public class Xhtml5BaseSink
         this.tableAttributes.removeAttributes( this.tableAttributes );
 
         writeStartTag( HtmlMarkup.TABLE, att );
-
-        this.cellCountStack.addLast( 0 );
     }
 
     /** {@inheritDoc} */
     @Override
     public void tableRows_()
     {
-        this.tableRows = false;
-        if ( !this.cellJustifStack.isEmpty() )
-        {
-            this.cellJustifStack.removeLast();
-        }
-        if ( !this.isCellJustifStack.isEmpty() )
-        {
-            this.isCellJustifStack.removeLast();
-        }
-
         this.evenTableRow = true;
     }
 
@@ -1518,11 +1410,6 @@ public class Xhtml5BaseSink
     @Override
     public void tableRow()
     {
-        // To be backward compatible
-        if ( !this.tableRows )
-        {
-            tableRows( null, false );
-        }
         tableRow( null );
     }
 
@@ -1565,12 +1452,6 @@ public class Xhtml5BaseSink
         {
             evenTableRow = !evenTableRow;
         }
-
-        if ( !this.cellCountStack.isEmpty() )
-        {
-            this.cellCountStack.removeLast();
-            this.cellCountStack.addLast( 0 );
-        }
     }
 
     /**
@@ -1621,29 +1502,6 @@ public class Xhtml5BaseSink
     {
         Tag t = ( headerRow ? HtmlMarkup.TH : HtmlMarkup.TD );
 
-        if ( !headerRow && cellCountStack != null && !cellCountStack.isEmpty()
-            && cellJustifStack != null && !cellJustifStack.isEmpty() && getCellJustif() != null )
-        {
-            int cellCount = getCellCount();
-            if ( cellCount < getCellJustif().length )
-            {
-                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 );
-                MutableAttributeSet atts = hash.get( getCellJustif()[cellCount] );
-
-                if ( attributes == null )
-                {
-                    attributes = new SinkEventAttributeSet();
-                }
-                if ( atts != null )
-                {
-                    attributes.addAttributes( atts );
-                }
-            }
-        }
-
         if ( attributes == null )
         {
             writeStartTag( t, null );
@@ -1681,13 +1539,6 @@ public class Xhtml5BaseSink
         Tag t = ( headerRow ? HtmlMarkup.TH : HtmlMarkup.TD );
 
         writeEndTag( t );
-
-        if ( !this.isCellJustifStack.isEmpty() && this.isCellJustifStack.getLast().equals( Boolean.TRUE )
-            && !this.cellCountStack.isEmpty() )
-        {
-            int cellCount = Integer.parseInt( this.cellCountStack.removeLast().toString() );
-            this.cellCountStack.addLast( ++cellCount );
-        }
     }
 
     /**
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..05c073f4 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
@@ -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 );
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..706e0e76 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&amp;1</caption>" ) );
+                actual.contains( "<table class=\"bodyTable\">" + "<caption>caption&amp;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>cell11</td>" ) );
+        assertTrue( actual.contains( "<td>nestedTable1Cell11</td>" ) );
+        assertTrue( actual.contains( "<td>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..2461c6c1 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,22 +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() ) )
-        {
-            att.addAttribute( Attribute.BORDER, ( grid ? "1" : "0" ) );
-        }
-
         att.addAttributes( tableAttributes );
 
         tableAttributes.removeAttributes( tableAttributes );
@@ -488,11 +472,8 @@ public class XdocSink
     public void tableRow()
     {
         MutableAttributeSet att = new SinkEventAttributeSet();
-        att.addAttribute( Attribute.VALIGN, "top" );
 
         writeStartTag( TR, att );
-
-        setCellCount( 0 );
     }
 
     /**
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..2d12d159 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
@@ -232,8 +232,8 @@ public class XdocSinkTest
     /** {@inheritDoc} */
     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>";
+        return "<table><caption>" + caption
+                + "</caption>\n<tr>\n<td>" + 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/resources/test.xhtml b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
index 45f924dc..9a858ebd 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
+++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
@@ -76,34 +76,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">
   <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>
 
@@ -115,7 +115,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>.