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/05/29 09:07:28 UTC
[maven-doxia] 01/02: Stupid replacement
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch default-xhtml5
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit aaa6f2a58aff692ae77de102592f76c400cf2866
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat May 28 20:37:38 2022 +0200
Stupid replacement
---
.../maven/doxia/sink/impl/Xhtml5BaseSink.java | 2 +-
.../apache/maven/doxia/macro/EchoMacroTest.java | 4 +-
.../doxia/macro/snippet/SnippetMacroTest.java | 5 +-
.../apache/maven/doxia/macro/toc/TocMacroTest.java | 12 ++--
.../maven/doxia/parser/Xhtml5BaseParserTest.java | 20 +++---
.../apache/maven/doxia/module/fml/FmlParser.java | 4 +-
.../maven/doxia/module/fml/FmlParserTest.java | 12 ++--
doxia-modules/doxia-module-markdown/pom.xml | 8 +--
.../doxia-module-markdown/src/it/general/pom.xml | 2 +-
.../doxia/module/markdown/MarkdownParser.java | 10 +--
.../doxia/module/markdown/MarkdownParserTest.java | 9 ++-
.../apache/maven/doxia/module/xdoc/XdocParser.java | 4 +-
.../apache/maven/doxia/module/xdoc/XdocSink.java | 4 +-
.../maven/doxia/module/xdoc/XdocSinkTest.java | 72 ++++++++++++++++------
.../maven/doxia/module/xhtml5/Xhtml5Markup.java | 4 +-
.../maven/doxia/module/xhtml5/Xhtml5Parser.java | 4 +-
.../doxia-module-xhtml5/src/site/site.xml | 4 +-
.../xhtml5/Xhtml5SinkWithLanguageIdTest.java | 4 +-
.../src/test/resources/test.xhtml | 2 +-
doxia-modules/pom.xml | 1 -
20 files changed, 109 insertions(+), 78 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 91b40bb9..891471ad 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
@@ -531,7 +531,7 @@ public class Xhtml5BaseSink
{
MutableAttributeSet att = new SinkEventAttributeSet();
att.addAttributes( SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES ) );
+ attributes, SinkUtils.SINK_BASE_ATTRIBUTES ) );
writeStartTag( HtmlMarkup.SECTION, att );
}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
index 639a2416..e3eb83ac 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import org.apache.maven.doxia.parser.XhtmlBaseParser;
+import org.apache.maven.doxia.parser.Xhtml5BaseParser;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
@@ -49,7 +49,7 @@ public class EchoMacroTest
final Map<String,Object> macroParameters = new HashMap<>();
macroParameters.put( "paramName", "paramValue" );
- XhtmlBaseParser parser = new XhtmlBaseParser();
+ Xhtml5BaseParser parser = new Xhtml5BaseParser();
SinkEventTestingSink sink = new SinkEventTestingSink();
MacroRequest request = new MacroRequest( null, parser, macroParameters, new File( "." ) );
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/snippet/SnippetMacroTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/snippet/SnippetMacroTest.java
index 79878179..d75f5f68 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/snippet/SnippetMacroTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/snippet/SnippetMacroTest.java
@@ -26,10 +26,9 @@ import java.util.Map;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
-import org.apache.maven.doxia.parser.XhtmlBaseParser;
+import org.apache.maven.doxia.parser.Xhtml5BaseParser;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.testing.PlexusTest;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
@@ -163,7 +162,7 @@ public class SnippetMacroTest
{
File basedir = new File( getBasedir() );
- XhtmlBaseParser parser = new XhtmlBaseParser();
+ Xhtml5BaseParser parser = new Xhtml5BaseParser();
SinkEventTestingSink sink = new SinkEventTestingSink();
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
index 5fd41a4c..038fa962 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
@@ -28,11 +28,11 @@ import java.util.Map;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
-import org.apache.maven.doxia.parser.XhtmlBaseParser;
+import org.apache.maven.doxia.parser.Xhtml5BaseParser;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
-import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
+import org.apache.maven.doxia.sink.impl.Xhtml5BaseSink;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
@@ -55,7 +55,7 @@ public class TocMacroTest
{
String sourceContent = "<div><h1>h11</h1><h1>h12</h1><h2>h2</h2><h3>h3</h3><h1>h13</h1></div>";
- XhtmlBaseParser parser = new XhtmlBaseParser();
+ Xhtml5BaseParser parser = new Xhtml5BaseParser();
Map<String, Object> macroParameters = new HashMap<>();
macroParameters.put( "section", "sec1" );
@@ -103,7 +103,7 @@ public class TocMacroTest
// test parameters
- parser = new XhtmlBaseParser();
+ parser = new Xhtml5BaseParser();
macroParameters.put( "section", "2" );
macroParameters.put( "fromDepth", "1" );
macroParameters.put( "toDepth", "2" );
@@ -152,7 +152,7 @@ public class TocMacroTest
String sourceContent =
"<div><h1>h<b>11</b></h1><h1>h<i>12</i></h1><h2>h<tt>2</tt></h2><h3>h3</h3><h1>h13</h1></div>";
- XhtmlBaseParser parser = new XhtmlBaseParser();
+ Xhtml5BaseParser parser = new Xhtml5BaseParser();
Map<String, Object> macroParameters = new HashMap<>();
macroParameters.put( "section", "sec1" );
@@ -160,7 +160,7 @@ public class TocMacroTest
File basedir = new File( "" );
StringWriter out = new StringWriter();
- XhtmlBaseSink sink = new XhtmlBaseSink( out );
+ Xhtml5BaseSink sink = new Xhtml5BaseSink( out );
MacroRequest request = new MacroRequest( sourceContent, parser, macroParameters, basedir );
TocMacro macro = new TocMacro();
macro.execute( sink, request );
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 e6669aeb..a5166bb4 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
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
- * Test for XhtmlBaseParser.
+ * Test for Xhtml5BaseParser.
*/
public class Xhtml5BaseParserTest
extends AbstractParserTest
@@ -63,8 +63,8 @@ public class Xhtml5BaseParserTest
@Test
public void testDoxiaVersion()
{
- assertNotNull( XhtmlBaseParser.doxiaVersion() );
- assertNotEquals( "unknown", XhtmlBaseParser.doxiaVersion() );
+ assertNotNull( Xhtml5BaseParser.doxiaVersion() );
+ assertNotEquals( "unknown", Xhtml5BaseParser.doxiaVersion() );
}
@Test
@@ -307,7 +307,7 @@ public class Xhtml5BaseParserTest
throws Exception
{
// test EOLs within <pre>: the sink MUST receive a text event for the EOL
- String text = "<pre><a href=\"what.html\">what</a>" + XhtmlBaseParser.EOL
+ String text = "<pre><a href=\"what.html\">what</a>" + Xhtml5BaseParser.EOL
+ "<a href=\"what.html\">what</a></pre>";
parser.parse( text, sink );
@@ -330,12 +330,12 @@ public class Xhtml5BaseParserTest
throws Exception
{
StringBuilder sb = new StringBuilder();
- sb.append( "<!DOCTYPE test [" ).append( XhtmlBaseParser.EOL );
- sb.append( "<!ENTITY foo \"ř\">" ).append( XhtmlBaseParser.EOL );
- sb.append( "<!ENTITY foo1 \" \">" ).append( XhtmlBaseParser.EOL );
- sb.append( "<!ENTITY foo2 \"š\">" ).append( XhtmlBaseParser.EOL );
- sb.append( "<!ENTITY tritPos \"𝟭\">" ).append( XhtmlBaseParser.EOL );
- sb.append( "]>" ).append( XhtmlBaseParser.EOL );
+ sb.append( "<!DOCTYPE test [" ).append( Xhtml5BaseParser.EOL );
+ sb.append( "<!ENTITY foo \"ř\">" ).append( Xhtml5BaseParser.EOL );
+ sb.append( "<!ENTITY foo1 \" \">" ).append( Xhtml5BaseParser.EOL );
+ sb.append( "<!ENTITY foo2 \"š\">" ).append( Xhtml5BaseParser.EOL );
+ sb.append( "<!ENTITY tritPos \"𝟭\">" ).append( Xhtml5BaseParser.EOL );
+ sb.append( "]>" ).append( Xhtml5BaseParser.EOL );
sb.append( "<p>&foo;&foo1;&foo2;&tritPos;</p>" );
parser.setValidate( false );
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 a1c36022..52f34e8b 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
@@ -41,7 +41,7 @@ import org.apache.maven.doxia.parser.AbstractXmlParser;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
+import org.apache.maven.doxia.sink.impl.Xhtml5BaseSink;
import org.apache.maven.doxia.util.DoxiaUtils;
import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.IOUtil;
@@ -478,7 +478,7 @@ public class FmlParser
try
{
StringWriter sw = new StringWriter();
- XhtmlBaseSink sink = new XhtmlBaseSink( sw );
+ Xhtml5BaseSink sink = new Xhtml5BaseSink( sw );
executeMacro( macroName, request, sink );
sink.close();
buffer.append( sw.toString() );
diff --git a/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java b/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
index bebb5bd9..eeaab5ae 100644
--- a/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
+++ b/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
@@ -35,7 +35,7 @@ import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
-import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
+import org.apache.maven.doxia.sink.impl.Xhtml5BaseSink;
import org.codehaus.plexus.util.IOUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -63,18 +63,18 @@ public class FmlParserTest
// Be sure to delete them
String tmpDir = System.getProperty( "java.io.tmpdir" );
- // Using FileFilter, because is it is much faster then FileUtils.listFiles
+ // Using FileFilter, because is it is much faster then FileUtils.listFiles
File[] tmpFiles = new File( tmpDir ).listFiles( new FileFilter()
{
final Pattern xsdPatterns = Pattern.compile( "(xml|fml\\-.+)\\.xsd" );
-
+
@Override
public boolean accept( File pathname )
{
- return xsdPatterns.matcher( pathname.getName() ).matches();
+ return xsdPatterns.matcher( pathname.getName() ).matches();
}
} );
-
+
for ( File tmpFile : tmpFiles )
{
tmpFile.delete();
@@ -271,7 +271,7 @@ public class FmlParserTest
try ( Writer output = getTestWriter( "macro" );
Reader reader = getTestReader( "macro" ) )
{
- Sink sink = new XhtmlBaseSink( output );
+ Sink sink = new Xhtml5BaseSink( output );
createParser().parse( reader, sink );
sink.close();
}
diff --git a/doxia-modules/doxia-module-markdown/pom.xml b/doxia-modules/doxia-module-markdown/pom.xml
index c9f17668..dc1fb009 100644
--- a/doxia-modules/doxia-module-markdown/pom.xml
+++ b/doxia-modules/doxia-module-markdown/pom.xml
@@ -74,7 +74,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xhtml</artifactId>
+ <artifactId>doxia-module-xhtml5</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -107,18 +107,18 @@ under the License.
<executions>
<!-- integration-test -->
- <!-- Copy the Doxia XHTML module from our working directory to the local-repo -->
+ <!-- Copy the Doxia XHTML5 module from our working directory to the local-repo -->
<!-- We do that manually because the invoker:install goal (below) doesn't do it, as -->
<!-- it's not the artifact we're working on, but the ones that are produced by our "siblings" -->
<execution>
- <id>copy-doxia-module-xhtml-to-local-repo</id>
+ <id>copy-doxia-module-xhtml5-to-local-repo</id>
<phase>integration-test</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
- <file>${project.basedir}/../doxia-module-xhtml/target/doxia-module-xhtml-${project.version}.jar</file>
+ <file>${project.basedir}/../doxia-module-xhtml5/target/doxia-module-xhtml5-${project.version}.jar</file>
</configuration>
</execution>
<execution>
diff --git a/doxia-modules/doxia-module-markdown/src/it/general/pom.xml b/doxia-modules/doxia-module-markdown/src/it/general/pom.xml
index 12afb4fd..cfc15a95 100644
--- a/doxia-modules/doxia-module-markdown/src/it/general/pom.xml
+++ b/doxia-modules/doxia-module-markdown/src/it/general/pom.xml
@@ -51,7 +51,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xhtml</artifactId>
+ <artifactId>doxia-module-xhtml5</artifactId>
<version>@project.version@</version>
</dependency>
<dependency>
diff --git a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
index 6ae517e9..2844eaba 100644
--- a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
+++ b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
@@ -26,9 +26,9 @@ import javax.inject.Singleton;
import com.vladsch.flexmark.ast.Heading;
import com.vladsch.flexmark.ast.HtmlCommentBlock;
import com.vladsch.flexmark.util.ast.Node;
+import com.vladsch.flexmark.util.options.MutableDataSet;
import com.vladsch.flexmark.ast.util.TextCollectingVisitor;
import com.vladsch.flexmark.html.HtmlRenderer;
-import com.vladsch.flexmark.util.options.MutableDataSet;
import com.vladsch.flexmark.ext.escaped.character.EscapedCharacterExtension;
import com.vladsch.flexmark.ext.abbreviation.AbbreviationExtension;
import com.vladsch.flexmark.ext.autolink.AutolinkExtension;
@@ -40,7 +40,7 @@ import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension;
import org.apache.maven.doxia.markup.HtmlMarkup;
import org.apache.maven.doxia.markup.TextMarkup;
-import org.apache.maven.doxia.module.xhtml.XhtmlParser;
+import org.apache.maven.doxia.module.xhtml5.Xhtml5Parser;
import org.apache.maven.doxia.parser.AbstractTextParser;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.sink.Sink;
@@ -60,7 +60,7 @@ import java.util.regex.Pattern;
* </p>
* <p>
* Defers effective parsing to the <a href="https://github.com/vsch/flexmark-java">flexmark-java library</a>,
- * which generates HTML content then delegates parsing of this content to a slightly modified Doxia Xhtml parser.
+ * which generates HTML content then delegates parsing of this content to a slightly modified Doxia Xhtml5 parser.
* (before 1.8, the <a href="http://pegdown.org">PegDown library</a> was used)
* </p>
*
@@ -262,14 +262,14 @@ public class MarkdownParser
* <li> DIV elements are translated as Unknown Sink events
* <li> PRE elements are all considered as boxed
* </ul>
- * PRE elements need to be "boxed" because the XhtmlSink will surround the
+ * PRE elements need to be "boxed" because the Xhtml5Sink will surround the
* corresponding verbatim() Sink event with a DIV element with class="source",
* which is how most Maven Skin (incl. Fluido) recognize a block of code, which
* needs to be highlighted accordingly.
*/
@Named
public static class MarkdownHtmlParser
- extends XhtmlParser
+ extends Xhtml5Parser
{
public MarkdownHtmlParser()
{
diff --git a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
index 7c5329bf..8519fe38 100644
--- a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
+++ b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
@@ -110,7 +110,7 @@ public class MarkdownParserTest
SinkEventElement inline = eventList.get( 4 );
assertEquals( "inline", inline.getName() );
SinkEventAttributeSet atts = (SinkEventAttributeSet) inline.getArgs()[0];
- assertTrue( atts.containsAttribute( SinkEventAttributes.SEMANTICS, "bold" ) );
+ assertTrue( atts.containsAttribute( SinkEventAttributes.SEMANTICS, "strong" ) );
}
/**
@@ -132,7 +132,7 @@ public class MarkdownParserTest
SinkEventElement inline = eventList.get( 4 );
assertEquals( "inline", inline.getName() );
SinkEventAttributeSet atts = (SinkEventAttributeSet) inline.getArgs()[0];
- assertTrue( atts.containsAttribute( SinkEventAttributes.SEMANTICS, "italic" ) );
+ assertTrue( atts.containsAttribute( SinkEventAttributes.SEMANTICS, "emphasis" ) );
}
/**
@@ -389,9 +389,8 @@ public class MarkdownParserTest
{
Iterator<SinkEventElement> it = parseFileToEventTestingSink( "html-content" ).getEventList().iterator();
- // NOTE: DIV is rendered as "unknown" (see DOXIA-203)
- assertSinkEquals( it, "head", "head_", "body", "unknown", "text", "paragraph", "inline", "text",
- "inline_", "text", "inline", "text", "inline_", "text", "paragraph_", "text", "unknown", "text",
+ assertSinkEquals( it, "head", "head_", "body", "division", "text", "paragraph", "inline", "text",
+ "inline_", "text", "inline", "text", "inline_", "text", "paragraph_", "text", "division_", "text",
"horizontalRule", "section1", "sectionTitle1", "text", "sectionTitle1_", "paragraph", "text",
"paragraph_", "text", "table", "tableRows", "text", "tableRow", "tableHeaderCell", "text",
"tableHeaderCell_", "tableRow_", "text", "tableRow", "tableCell", "text", "tableCell_", "tableRow_",
diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
index 67dc1809..e7f84a51 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
@@ -34,7 +34,7 @@ import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
import org.apache.maven.doxia.macro.manager.MacroNotFoundException;
import org.apache.maven.doxia.parser.ParseException;
-import org.apache.maven.doxia.parser.XhtmlBaseParser;
+import org.apache.maven.doxia.parser.Xhtml5BaseParser;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.util.HtmlTools;
@@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
@Singleton
@Named( "xdoc" )
public class XdocParser
- extends XhtmlBaseParser
+ extends Xhtml5BaseParser
implements XdocMarkup
{
private static final Logger LOGGER = LoggerFactory.getLogger( XdocParser.class );
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 ea0b871d..de012612 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
@@ -27,7 +27,7 @@ import javax.swing.text.html.HTML.Attribute;
import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.impl.SinkUtils;
-import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
+import org.apache.maven.doxia.sink.impl.Xhtml5BaseSink;
import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.StringUtils;
@@ -42,7 +42,7 @@ import org.codehaus.plexus.util.StringUtils;
* @since 1.0
*/
public class XdocSink
- extends XhtmlBaseSink
+ extends Xhtml5BaseSink
implements XdocMarkup
{
// ----------------------------------------------------------------------
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 d33d5031..3f2ca708 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
@@ -37,6 +37,44 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class XdocSinkTest
extends AbstractSinkTest
{
+ /** {@inheritDoc} */
+ @Test
+ public void testSection1()
+ {
+ String title = "Title1";
+ getSink().section1();
+ getSink().sectionTitle1();
+ getSink().text( title );
+ getSink().sectionTitle1_();
+ getSink().section1_();
+ getSink().flush();
+ getSink().close();
+
+ String actual = getSinkContent();
+ String expected = getSection1Block( title );
+
+ assertEquals( expected, actual, "Wrong section1 block!" );
+ }
+
+ /** {@inheritDoc} */
+ @Test
+ public void testSection2()
+ {
+ String title = "Title2";
+ getSink().section2();
+ getSink().sectionTitle2();
+ getSink().text( title );
+ getSink().sectionTitle2_();
+ getSink().section2_();
+ getSink().flush();
+ getSink().close();
+
+ String actual = getSinkContent();
+ String expected = getSection2Block( title );
+
+ assertEquals( expected, actual, "Wrong section2 block!" );
+ }
+
/** {@inheritDoc} */
protected String outputExtension()
{
@@ -92,19 +130,19 @@ public class XdocSinkTest
/** {@inheritDoc} */
protected String getArticleBlock()
{
- return "";
+ return "<article></article>";
}
/** {@inheritDoc} */
protected String getNavigationBlock()
{
- return "";
+ return "<nav></nav>";
}
/** {@inheritDoc} */
protected String getSidebarBlock()
{
- return "";
+ return "<aside></aside>";
}
/** {@inheritDoc} */
@@ -128,37 +166,37 @@ public class XdocSinkTest
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return "<h3>" + title + "</h3>";
+ return "<header>" + EOL + "<h3>" + title + "</h3></header>";
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return "<h4>" + title + "</h4>";
+ return "<header>" + EOL + "<h4>" + title + "</h4></header>";
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return "<h5>" + title + "</h5>";
+ return "<header>" + EOL + "<h5>" + title + "</h5></header>";
}
/** {@inheritDoc} */
protected String getHeaderBlock()
{
- return "";
+ return "<header></header>";
}
/** {@inheritDoc} */
protected String getContentBlock()
{
- return "";
+ return "<main>" + EOL + "<div class=\"content\"></div></main>";
}
/** {@inheritDoc} */
protected String getFooterBlock()
{
- return "";
+ return "<footer></footer>";
}
/** {@inheritDoc} */
@@ -182,16 +220,12 @@ public class XdocSinkTest
/** {@inheritDoc} */
protected String getFigureBlock( String source, String caption )
{
- String figureBlock = "<img src=\"" + escapeHTML( source ) + "\"";
+ String figureBlock = "<figure><img src=\"" + escapeHTML( source ) + "\" alt=\"\" />";
if ( caption != null )
{
- figureBlock += " alt=\"" + caption + "\"";
+ figureBlock += "<figcaption>" + caption + "</figcaption>";
}
- else //@todo fix DOXIA-361
- {
- figureBlock += " alt=\"\"";
- }
- figureBlock += " />";
+ figureBlock += "</figure>";
return figureBlock;
}
@@ -211,13 +245,13 @@ public class XdocSinkTest
/** {@inheritDoc} */
protected String getDataBlock( String value, String text )
{
- return text;
+ return "<data value=\"" + value + "\">" + text + "</data>";
}
/** {@inheritDoc} */
protected String getTimeBlock( String datetime, String text )
{
- return text;
+ return "<time datetime=\"" + datetime + "\">" + text + "</time>";
}
/** {@inheritDoc} */
@@ -319,7 +353,7 @@ public class XdocSinkTest
/** {@inheritDoc} */
protected String getLineBreakOpportunityBlock()
{
- return "";
+ return "<wbr />";
}
/** {@inheritDoc} */
diff --git a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Markup.java b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Markup.java
index bdd4e9f1..111bc6b8 100644
--- a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Markup.java
+++ b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Markup.java
@@ -22,9 +22,9 @@ package org.apache.maven.doxia.module.xhtml5;
import org.apache.maven.doxia.markup.HtmlMarkup;
/**
- * List of <code>Xhtml</code> markups.
+ * List of <code>Xhtml5</code> markups.
* <br>
- * Xhtml uses all {@link javax.swing.text.html.HTML.Tag} and {@link javax.swing.text.html.HTML.Attribute}
+ * Xhtml5 uses all {@link javax.swing.text.html.HTML.Tag} and {@link javax.swing.text.html.HTML.Attribute}
* as markups.
*/
@SuppressWarnings( "checkstyle:interfaceistype" )
diff --git a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
index 392ac4f0..48a695a7 100644
--- a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
+++ b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
@@ -45,7 +45,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Parse an xhtml model and emit events into a Doxia Sink.
+ * Parse an xhtml5 model and emit events into a Doxia Sink.
*/
@Singleton
@Named( "xhtml5" )
@@ -56,7 +56,7 @@ public class Xhtml5Parser
private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5Parser.class );
/** For boxed verbatim. */
- private boolean boxed;
+ protected boolean boxed;
/** Empty elements don't write a closing tag. */
private boolean isEmptyElement;
diff --git a/doxia-modules/doxia-module-xhtml5/src/site/site.xml b/doxia-modules/doxia-module-xhtml5/src/site/site.xml
index 5f058c88..4ac71f1c 100644
--- a/doxia-modules/doxia-module-xhtml5/src/site/site.xml
+++ b/doxia-modules/doxia-module-xhtml5/src/site/site.xml
@@ -23,7 +23,7 @@
<project xmlns="http://maven.apache.org/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 https://maven.apache.org/xsd/decoration-1.1.0.xsd"
- name="Xhtml">
+ name="Xhtml5">
<body>
@@ -40,4 +40,4 @@
</body>
-</project>
\ No newline at end of file
+</project>
diff --git a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkWithLanguageIdTest.java b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkWithLanguageIdTest.java
index 3a9945e8..2e84f7cd 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkWithLanguageIdTest.java
+++ b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkWithLanguageIdTest.java
@@ -31,13 +31,13 @@ public class Xhtml5SinkWithLanguageIdTest
/** {@inheritDoc} */
protected Sink createSink( Writer writer )
{
- return new Xhtml5Sink( writer, "UTF-8", Locale.US.getLanguage() );
+ return new Xhtml5Sink( writer, "UTF-8", Locale.ENGLISH.getLanguage() );
}
/** {@inheritDoc} */
protected String getHeadBlock()
{
- return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
+ return "<!DOCTYPE html>"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">"
+ "<head><title></title>"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/></head>";
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 5e4fa810..45f924dc 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
+++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
diff --git a/doxia-modules/pom.xml b/doxia-modules/pom.xml
index 723d9b00..574772f2 100644
--- a/doxia-modules/pom.xml
+++ b/doxia-modules/pom.xml
@@ -39,7 +39,6 @@ under the License.
<module>doxia-module-xdoc</module>
<module>doxia-module-xhtml</module>
<module>doxia-module-xhtml5</module>
- <!-- this has a dep on xhtml module, so needs to be built last! -->
<module>doxia-module-markdown</module>
</modules>