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/10/01 19:42:16 UTC
[maven-doxia] branch DOXIA-668 updated: [DOXIA-668] Remove all obsolete attributes in HTML5
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
The following commit(s) were added to refs/heads/DOXIA-668 by this push:
new 8e1ae105 [DOXIA-668] Remove all obsolete attributes in HTML5
8e1ae105 is described below
commit 8e1ae105e7c91bad3cf02fc7eac91ba839c9168c
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Oct 1 21:41:41 2022 +0200
[DOXIA-668] Remove all obsolete attributes in HTML5
This closes #114
---
.../apache/maven/doxia/sink/impl/SinkUtils.java | 29 ++++++----------------
.../maven/doxia/parser/Xhtml5BaseParserTest.java | 2 +-
.../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java | 4 +--
.../apache/maven/doxia/module/fml/FmlParser.java | 4 +--
.../apache/maven/doxia/module/xdoc/XdocSink.java | 1 -
.../maven/doxia/module/xdoc/XdocSinkTest.java | 4 +--
.../maven/doxia/module/xhtml5/Xhtml5SinkTest.java | 2 +-
7 files changed, 14 insertions(+), 32 deletions(-)
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/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
index 466ff7cd..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
@@ -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 38af60ac..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
@@ -171,9 +171,9 @@ public class Xhtml5BaseSinkTest
assertTrue(
actual.contains( "<table class=\"bodyTable\">" + "<caption>caption&1</caption>" ) );
assertTrue( actual.contains(
- "<table class=\"bodyTable\" align=\"left\">" + "<caption>caption2</caption>" ) );
+ "<table class=\"bodyTable\">" + "<caption>caption2</caption>" ) );
assertTrue( actual.contains(
- "<table class=\"bodyTable\" align=\"right\">" + "<caption>caption3</caption>" ) );
+ "<table class=\"bodyTable\">" + "<caption>caption3</caption>" ) );
assertTrue( actual.contains( "<td style=\"text-align: center;\">cell11</td>" ) );
assertTrue( actual.contains( "<td style=\"text-align: left;\">nestedTable1Cell11</td>" ) );
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 d7a4ccdf..bbee8c29 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
@@ -417,7 +417,6 @@ public class XdocSink
}
else
{
- atts.removeAttribute( Attribute.ALIGN.toString() );
writeStartTag( PRE, atts );
}
}
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 6c7ea8b4..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
@@ -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 2d95a466..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} */