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/07/22 17:32:52 UTC
[maven-doxia] 01/01: [DOXIA-663] Remove deprecated XHTML module
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch DOXIA-663
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit 253440f7131cb3f3dc0facedfbea57a99487b978
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat May 28 22:19:28 2022 +0200
[DOXIA-663] Remove deprecated XHTML module
---
.../apache/maven/doxia/parser/XhtmlBaseParser.java | 1242 -----------
.../maven/doxia/sink/impl/XhtmlBaseSink.java | 2229 --------------------
.../maven/doxia/parser/XhtmlBaseParserTest.java | 772 -------
.../maven/doxia/sink/impl/XhtmlBaseSinkTest.java | 1181 -----------
doxia-modules/doxia-module-xhtml/pom.xml | 84 -
.../doxia/module/xhtml/AbstractXhtmlSink.java | 34 -
.../maven/doxia/module/xhtml/XhtmlMarkup.java | 46 -
.../maven/doxia/module/xhtml/XhtmlParser.java | 366 ----
.../doxia/module/xhtml/XhtmlParserModule.java | 45 -
.../apache/maven/doxia/module/xhtml/XhtmlSink.java | 278 ---
.../maven/doxia/module/xhtml/XhtmlSinkFactory.java | 53 -
doxia-modules/doxia-module-xhtml/src/site/site.xml | 43 -
.../doxia/module/xhtml/XhtmlIdentityTest.java | 87 -
.../maven/doxia/module/xhtml/XhtmlParserTest.java | 210 --
.../maven/doxia/module/xhtml/XhtmlSinkTest.java | 462 ----
.../module/xhtml/XhtmlSinkWithLanguageIdTest.java | 48 -
.../src/test/resources/download.apt.vm | 79 -
.../src/test/resources/file.with.dot.in.name.xml | 20 -
.../doxia-module-xhtml/src/test/resources/fun.html | 66 -
.../src/test/resources/index.xml.vm | 231 --
.../src/test/resources/test.xhtml4 | 152 --
doxia-modules/pom.xml | 1 -
pom.xml | 7 +-
src/site/resources/images/doxia-deps.png | Bin 20465 -> 19941 bytes
src/site/xdoc/doxia-deps.odg | Bin 12670 -> 12594 bytes
src/site/xdoc/index.xml | 3 +-
26 files changed, 2 insertions(+), 7737 deletions(-)
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
deleted file mode 100644
index 109189dd..00000000
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
+++ /dev/null
@@ -1,1242 +0,0 @@
-package org.apache.maven.doxia.parser;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Reader;
-
-import javax.swing.text.html.HTML.Attribute;
-
-import org.apache.maven.doxia.macro.MacroExecutionException;
-import org.apache.maven.doxia.markup.HtmlMarkup;
-import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.sink.SinkEventAttributes;
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.apache.maven.doxia.util.DoxiaUtils;
-
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParser;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Common base parser for xhtml events.
- *
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public class XhtmlBaseParser
- extends AbstractXmlParser
- implements HtmlMarkup
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlBaseParser.class );
-
- /**
- * True if a <script></script> or <style></style> block is read. CDATA sections within are
- * handled as rawText.
- */
- private boolean scriptBlock;
-
- /** Used to distinguish <a href=""> from <a name="">. */
- private boolean isLink;
-
- /** Used to distinguish <a href=""> from <a name="">. */
- private boolean isAnchor;
-
- /** Used for nested lists. */
- private int orderedListDepth = 0;
-
- /** Counts section level. */
- private int sectionLevel;
-
- /** Verbatim flag, true whenever we are inside a <pre> tag. */
- private boolean inVerbatim;
-
- /** Used to recognize the case of img inside figure. */
- private boolean inFigure;
-
- /** Used to wrap the definedTerm with its definition, even when one is omitted */
- boolean hasDefinitionListItem = false;
-
- /** {@inheritDoc} */
- @Override
- public void parse( Reader source, Sink sink, String reference )
- throws ParseException
- {
- init();
-
- try
- {
- super.parse( source, sink, reference );
- }
- finally
- {
- setSecondParsing( false );
- init();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * Adds all XHTML (HTML 4.0) entities to the parser so that they can be recognized and resolved
- * without additional DTD.
- */
- @Override
- protected void initXmlParser( XmlPullParser parser )
- throws XmlPullParserException
- {
- super.initXmlParser( parser );
-
- // the entities taken from org.apache.maven.doxia.document.io.xpp3.DocumentXpp3Reader,
- // which is generated automatically
-
- // ----------------------------------------------------------------------
- // Latin 1 entities
- // ----------------------------------------------------------------------
-
- parser.defineEntityReplacementText( "nbsp", "\u00a0" );
- parser.defineEntityReplacementText( "iexcl", "\u00a1" );
- parser.defineEntityReplacementText( "cent", "\u00a2" );
- parser.defineEntityReplacementText( "pound", "\u00a3" );
- parser.defineEntityReplacementText( "curren", "\u00a4" );
- parser.defineEntityReplacementText( "yen", "\u00a5" );
- parser.defineEntityReplacementText( "brvbar", "\u00a6" );
- parser.defineEntityReplacementText( "sect", "\u00a7" );
- parser.defineEntityReplacementText( "uml", "\u00a8" );
- parser.defineEntityReplacementText( "copy", "\u00a9" );
- parser.defineEntityReplacementText( "ordf", "\u00aa" );
- parser.defineEntityReplacementText( "laquo", "\u00ab" );
- parser.defineEntityReplacementText( "not", "\u00ac" );
- parser.defineEntityReplacementText( "shy", "\u00ad" );
- parser.defineEntityReplacementText( "reg", "\u00ae" );
- parser.defineEntityReplacementText( "macr", "\u00af" );
- parser.defineEntityReplacementText( "deg", "\u00b0" );
- parser.defineEntityReplacementText( "plusmn", "\u00b1" );
- parser.defineEntityReplacementText( "sup2", "\u00b2" );
- parser.defineEntityReplacementText( "sup3", "\u00b3" );
- parser.defineEntityReplacementText( "acute", "\u00b4" );
- parser.defineEntityReplacementText( "micro", "\u00b5" );
- parser.defineEntityReplacementText( "para", "\u00b6" );
- parser.defineEntityReplacementText( "middot", "\u00b7" );
- parser.defineEntityReplacementText( "cedil", "\u00b8" );
- parser.defineEntityReplacementText( "sup1", "\u00b9" );
- parser.defineEntityReplacementText( "ordm", "\u00ba" );
- parser.defineEntityReplacementText( "raquo", "\u00bb" );
- parser.defineEntityReplacementText( "frac14", "\u00bc" );
- parser.defineEntityReplacementText( "frac12", "\u00bd" );
- parser.defineEntityReplacementText( "frac34", "\u00be" );
- parser.defineEntityReplacementText( "iquest", "\u00bf" );
- parser.defineEntityReplacementText( "Agrave", "\u00c0" );
- parser.defineEntityReplacementText( "Aacute", "\u00c1" );
- parser.defineEntityReplacementText( "Acirc", "\u00c2" );
- parser.defineEntityReplacementText( "Atilde", "\u00c3" );
- parser.defineEntityReplacementText( "Auml", "\u00c4" );
- parser.defineEntityReplacementText( "Aring", "\u00c5" );
- parser.defineEntityReplacementText( "AElig", "\u00c6" );
- parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
- parser.defineEntityReplacementText( "Egrave", "\u00c8" );
- parser.defineEntityReplacementText( "Eacute", "\u00c9" );
- parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
- parser.defineEntityReplacementText( "Euml", "\u00cb" );
- parser.defineEntityReplacementText( "Igrave", "\u00cc" );
- parser.defineEntityReplacementText( "Iacute", "\u00cd" );
- parser.defineEntityReplacementText( "Icirc", "\u00ce" );
- parser.defineEntityReplacementText( "Iuml", "\u00cf" );
- parser.defineEntityReplacementText( "ETH", "\u00d0" );
- parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
- parser.defineEntityReplacementText( "Ograve", "\u00d2" );
- parser.defineEntityReplacementText( "Oacute", "\u00d3" );
- parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
- parser.defineEntityReplacementText( "Otilde", "\u00d5" );
- parser.defineEntityReplacementText( "Ouml", "\u00d6" );
- parser.defineEntityReplacementText( "times", "\u00d7" );
- parser.defineEntityReplacementText( "Oslash", "\u00d8" );
- parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
- parser.defineEntityReplacementText( "Uacute", "\u00da" );
- parser.defineEntityReplacementText( "Ucirc", "\u00db" );
- parser.defineEntityReplacementText( "Uuml", "\u00dc" );
- parser.defineEntityReplacementText( "Yacute", "\u00dd" );
- parser.defineEntityReplacementText( "THORN", "\u00de" );
- parser.defineEntityReplacementText( "szlig", "\u00df" );
- parser.defineEntityReplacementText( "agrave", "\u00e0" );
- parser.defineEntityReplacementText( "aacute", "\u00e1" );
- parser.defineEntityReplacementText( "acirc", "\u00e2" );
- parser.defineEntityReplacementText( "atilde", "\u00e3" );
- parser.defineEntityReplacementText( "auml", "\u00e4" );
- parser.defineEntityReplacementText( "aring", "\u00e5" );
- parser.defineEntityReplacementText( "aelig", "\u00e6" );
- parser.defineEntityReplacementText( "ccedil", "\u00e7" );
- parser.defineEntityReplacementText( "egrave", "\u00e8" );
- parser.defineEntityReplacementText( "eacute", "\u00e9" );
- parser.defineEntityReplacementText( "ecirc", "\u00ea" );
- parser.defineEntityReplacementText( "euml", "\u00eb" );
- parser.defineEntityReplacementText( "igrave", "\u00ec" );
- parser.defineEntityReplacementText( "iacute", "\u00ed" );
- parser.defineEntityReplacementText( "icirc", "\u00ee" );
- parser.defineEntityReplacementText( "iuml", "\u00ef" );
- parser.defineEntityReplacementText( "eth", "\u00f0" );
- parser.defineEntityReplacementText( "ntilde", "\u00f1" );
- parser.defineEntityReplacementText( "ograve", "\u00f2" );
- parser.defineEntityReplacementText( "oacute", "\u00f3" );
- parser.defineEntityReplacementText( "ocirc", "\u00f4" );
- parser.defineEntityReplacementText( "otilde", "\u00f5" );
- parser.defineEntityReplacementText( "ouml", "\u00f6" );
- parser.defineEntityReplacementText( "divide", "\u00f7" );
- parser.defineEntityReplacementText( "oslash", "\u00f8" );
- parser.defineEntityReplacementText( "ugrave", "\u00f9" );
- parser.defineEntityReplacementText( "uacute", "\u00fa" );
- parser.defineEntityReplacementText( "ucirc", "\u00fb" );
- parser.defineEntityReplacementText( "uuml", "\u00fc" );
- parser.defineEntityReplacementText( "yacute", "\u00fd" );
- parser.defineEntityReplacementText( "thorn", "\u00fe" );
- parser.defineEntityReplacementText( "yuml", "\u00ff" );
-
- // ----------------------------------------------------------------------
- // Special entities
- // ----------------------------------------------------------------------
-
- parser.defineEntityReplacementText( "OElig", "\u0152" );
- parser.defineEntityReplacementText( "oelig", "\u0153" );
- parser.defineEntityReplacementText( "Scaron", "\u0160" );
- parser.defineEntityReplacementText( "scaron", "\u0161" );
- parser.defineEntityReplacementText( "Yuml", "\u0178" );
- parser.defineEntityReplacementText( "circ", "\u02c6" );
- parser.defineEntityReplacementText( "tilde", "\u02dc" );
- parser.defineEntityReplacementText( "ensp", "\u2002" );
- parser.defineEntityReplacementText( "emsp", "\u2003" );
- parser.defineEntityReplacementText( "thinsp", "\u2009" );
- parser.defineEntityReplacementText( "zwnj", "\u200c" );
- parser.defineEntityReplacementText( "zwj", "\u200d" );
- parser.defineEntityReplacementText( "lrm", "\u200e" );
- parser.defineEntityReplacementText( "rlm", "\u200f" );
- parser.defineEntityReplacementText( "ndash", "\u2013" );
- parser.defineEntityReplacementText( "mdash", "\u2014" );
- parser.defineEntityReplacementText( "lsquo", "\u2018" );
- parser.defineEntityReplacementText( "rsquo", "\u2019" );
- parser.defineEntityReplacementText( "sbquo", "\u201a" );
- parser.defineEntityReplacementText( "ldquo", "\u201c" );
- parser.defineEntityReplacementText( "rdquo", "\u201d" );
- parser.defineEntityReplacementText( "bdquo", "\u201e" );
- parser.defineEntityReplacementText( "dagger", "\u2020" );
- parser.defineEntityReplacementText( "Dagger", "\u2021" );
- parser.defineEntityReplacementText( "permil", "\u2030" );
- parser.defineEntityReplacementText( "lsaquo", "\u2039" );
- parser.defineEntityReplacementText( "rsaquo", "\u203a" );
- parser.defineEntityReplacementText( "euro", "\u20ac" );
-
- // ----------------------------------------------------------------------
- // Symbol entities
- // ----------------------------------------------------------------------
-
- parser.defineEntityReplacementText( "fnof", "\u0192" );
- parser.defineEntityReplacementText( "Alpha", "\u0391" );
- parser.defineEntityReplacementText( "Beta", "\u0392" );
- parser.defineEntityReplacementText( "Gamma", "\u0393" );
- parser.defineEntityReplacementText( "Delta", "\u0394" );
- parser.defineEntityReplacementText( "Epsilon", "\u0395" );
- parser.defineEntityReplacementText( "Zeta", "\u0396" );
- parser.defineEntityReplacementText( "Eta", "\u0397" );
- parser.defineEntityReplacementText( "Theta", "\u0398" );
- parser.defineEntityReplacementText( "Iota", "\u0399" );
- parser.defineEntityReplacementText( "Kappa", "\u039a" );
- parser.defineEntityReplacementText( "Lambda", "\u039b" );
- parser.defineEntityReplacementText( "Mu", "\u039c" );
- parser.defineEntityReplacementText( "Nu", "\u039d" );
- parser.defineEntityReplacementText( "Xi", "\u039e" );
- parser.defineEntityReplacementText( "Omicron", "\u039f" );
- parser.defineEntityReplacementText( "Pi", "\u03a0" );
- parser.defineEntityReplacementText( "Rho", "\u03a1" );
- parser.defineEntityReplacementText( "Sigma", "\u03a3" );
- parser.defineEntityReplacementText( "Tau", "\u03a4" );
- parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
- parser.defineEntityReplacementText( "Phi", "\u03a6" );
- parser.defineEntityReplacementText( "Chi", "\u03a7" );
- parser.defineEntityReplacementText( "Psi", "\u03a8" );
- parser.defineEntityReplacementText( "Omega", "\u03a9" );
- parser.defineEntityReplacementText( "alpha", "\u03b1" );
- parser.defineEntityReplacementText( "beta", "\u03b2" );
- parser.defineEntityReplacementText( "gamma", "\u03b3" );
- parser.defineEntityReplacementText( "delta", "\u03b4" );
- parser.defineEntityReplacementText( "epsilon", "\u03b5" );
- parser.defineEntityReplacementText( "zeta", "\u03b6" );
- parser.defineEntityReplacementText( "eta", "\u03b7" );
- parser.defineEntityReplacementText( "theta", "\u03b8" );
- parser.defineEntityReplacementText( "iota", "\u03b9" );
- parser.defineEntityReplacementText( "kappa", "\u03ba" );
- parser.defineEntityReplacementText( "lambda", "\u03bb" );
- parser.defineEntityReplacementText( "mu", "\u03bc" );
- parser.defineEntityReplacementText( "nu", "\u03bd" );
- parser.defineEntityReplacementText( "xi", "\u03be" );
- parser.defineEntityReplacementText( "omicron", "\u03bf" );
- parser.defineEntityReplacementText( "pi", "\u03c0" );
- parser.defineEntityReplacementText( "rho", "\u03c1" );
- parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
- parser.defineEntityReplacementText( "sigma", "\u03c3" );
- parser.defineEntityReplacementText( "tau", "\u03c4" );
- parser.defineEntityReplacementText( "upsilon", "\u03c5" );
- parser.defineEntityReplacementText( "phi", "\u03c6" );
- parser.defineEntityReplacementText( "chi", "\u03c7" );
- parser.defineEntityReplacementText( "psi", "\u03c8" );
- parser.defineEntityReplacementText( "omega", "\u03c9" );
- parser.defineEntityReplacementText( "thetasym", "\u03d1" );
- parser.defineEntityReplacementText( "upsih", "\u03d2" );
- parser.defineEntityReplacementText( "piv", "\u03d6" );
- parser.defineEntityReplacementText( "bull", "\u2022" );
- parser.defineEntityReplacementText( "hellip", "\u2026" );
- parser.defineEntityReplacementText( "prime", "\u2032" );
- parser.defineEntityReplacementText( "Prime", "\u2033" );
- parser.defineEntityReplacementText( "oline", "\u203e" );
- parser.defineEntityReplacementText( "frasl", "\u2044" );
- parser.defineEntityReplacementText( "weierp", "\u2118" );
- parser.defineEntityReplacementText( "image", "\u2111" );
- parser.defineEntityReplacementText( "real", "\u211c" );
- parser.defineEntityReplacementText( "trade", "\u2122" );
- parser.defineEntityReplacementText( "alefsym", "\u2135" );
- parser.defineEntityReplacementText( "larr", "\u2190" );
- parser.defineEntityReplacementText( "uarr", "\u2191" );
- parser.defineEntityReplacementText( "rarr", "\u2192" );
- parser.defineEntityReplacementText( "darr", "\u2193" );
- parser.defineEntityReplacementText( "harr", "\u2194" );
- parser.defineEntityReplacementText( "crarr", "\u21b5" );
- parser.defineEntityReplacementText( "lArr", "\u21d0" );
- parser.defineEntityReplacementText( "uArr", "\u21d1" );
- parser.defineEntityReplacementText( "rArr", "\u21d2" );
- parser.defineEntityReplacementText( "dArr", "\u21d3" );
- parser.defineEntityReplacementText( "hArr", "\u21d4" );
- parser.defineEntityReplacementText( "forall", "\u2200" );
- parser.defineEntityReplacementText( "part", "\u2202" );
- parser.defineEntityReplacementText( "exist", "\u2203" );
- parser.defineEntityReplacementText( "empty", "\u2205" );
- parser.defineEntityReplacementText( "nabla", "\u2207" );
- parser.defineEntityReplacementText( "isin", "\u2208" );
- parser.defineEntityReplacementText( "notin", "\u2209" );
- parser.defineEntityReplacementText( "ni", "\u220b" );
- parser.defineEntityReplacementText( "prod", "\u220f" );
- parser.defineEntityReplacementText( "sum", "\u2211" );
- parser.defineEntityReplacementText( "minus", "\u2212" );
- parser.defineEntityReplacementText( "lowast", "\u2217" );
- parser.defineEntityReplacementText( "radic", "\u221a" );
- parser.defineEntityReplacementText( "prop", "\u221d" );
- parser.defineEntityReplacementText( "infin", "\u221e" );
- parser.defineEntityReplacementText( "ang", "\u2220" );
- parser.defineEntityReplacementText( "and", "\u2227" );
- parser.defineEntityReplacementText( "or", "\u2228" );
- parser.defineEntityReplacementText( "cap", "\u2229" );
- parser.defineEntityReplacementText( "cup", "\u222a" );
- parser.defineEntityReplacementText( "int", "\u222b" );
- parser.defineEntityReplacementText( "there4", "\u2234" );
- parser.defineEntityReplacementText( "sim", "\u223c" );
- parser.defineEntityReplacementText( "cong", "\u2245" );
- parser.defineEntityReplacementText( "asymp", "\u2248" );
- parser.defineEntityReplacementText( "ne", "\u2260" );
- parser.defineEntityReplacementText( "equiv", "\u2261" );
- parser.defineEntityReplacementText( "le", "\u2264" );
- parser.defineEntityReplacementText( "ge", "\u2265" );
- parser.defineEntityReplacementText( "sub", "\u2282" );
- parser.defineEntityReplacementText( "sup", "\u2283" );
- parser.defineEntityReplacementText( "nsub", "\u2284" );
- parser.defineEntityReplacementText( "sube", "\u2286" );
- parser.defineEntityReplacementText( "supe", "\u2287" );
- parser.defineEntityReplacementText( "oplus", "\u2295" );
- parser.defineEntityReplacementText( "otimes", "\u2297" );
- parser.defineEntityReplacementText( "perp", "\u22a5" );
- parser.defineEntityReplacementText( "sdot", "\u22c5" );
- parser.defineEntityReplacementText( "lceil", "\u2308" );
- parser.defineEntityReplacementText( "rceil", "\u2309" );
- parser.defineEntityReplacementText( "lfloor", "\u230a" );
- parser.defineEntityReplacementText( "rfloor", "\u230b" );
- parser.defineEntityReplacementText( "lang", "\u2329" );
- parser.defineEntityReplacementText( "rang", "\u232a" );
- parser.defineEntityReplacementText( "loz", "\u25ca" );
- parser.defineEntityReplacementText( "spades", "\u2660" );
- parser.defineEntityReplacementText( "clubs", "\u2663" );
- parser.defineEntityReplacementText( "hearts", "\u2665" );
- parser.defineEntityReplacementText( "diams", "\u2666" );
- }
-
- /**
- * <p>
- * Goes through a common list of possible html start tags. These include only tags that can go into
- * the body of a xhtml document and so should be re-usable by different xhtml-based parsers.
- * </p>
- * <p>
- * The currently handled tags are:
- * </p>
- * <p>
- * <code>
- * <h1>, <h2>, <h3>, <h4>, <h5>, <p>, <pre>,
- * <ul>, <ol>, <li>, <dl>, <dt>, <dd>, <b>, <strong>,
- * <i>, <em>, <code>, <samp>, <tt>, <a>, <table>, <tr>,
- * <th>, <td>, <caption>, <br/>, <hr/>, <img/>.
- * </code>
- * </p>
- *
- * @param parser A parser.
- * @param sink the sink to receive the events.
- * @return True if the event has been handled by this method, i.e. the tag was recognized, false otherwise.
- */
- protected boolean baseStartTag( XmlPullParser parser, Sink sink )
- {
- boolean visited = true;
-
- SinkEventAttributeSet attribs = getAttributesFromParser( parser );
-
- if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
- {
- handleSectionStart( sink, Sink.SECTION_LEVEL_1, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
- {
- handleSectionStart( sink, Sink.SECTION_LEVEL_2, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
- {
- handleSectionStart( sink, Sink.SECTION_LEVEL_3, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
- {
- handleSectionStart( sink, Sink.SECTION_LEVEL_4, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
- {
- handleSectionStart( sink, Sink.SECTION_LEVEL_5, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.U.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.ANNOTATION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.S.toString() )
- || parser.getName().equals( HtmlMarkup.STRIKE.toString() )
- || parser.getName().equals( "del" ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.LINE_THROUGH );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SUB.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.SUBSCRIPT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SUP.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.SUPERSCRIPT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.P.toString() ) )
- {
- handlePStart( sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DIV.toString() ) )
- {
- visited = handleDivStart( parser, attribs, sink );
- }
- else if ( parser.getName().equals( HtmlMarkup.PRE.toString() ) )
- {
- handlePreStart( attribs, sink );
- }
- else if ( parser.getName().equals( HtmlMarkup.UL.toString() ) )
- {
- sink.list( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.OL.toString() ) )
- {
- handleOLStart( parser, sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.LI.toString() ) )
- {
- handleLIStart( sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DL.toString() ) )
- {
- sink.definitionList( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DT.toString() ) )
- {
- if ( hasDefinitionListItem )
- {
- // close previous listItem
- sink.definitionListItem_();
- }
- sink.definitionListItem( attribs );
- hasDefinitionListItem = true;
- sink.definedTerm( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DD.toString() ) )
- {
- if ( !hasDefinitionListItem )
- {
- sink.definitionListItem( attribs );
- }
- sink.definition( attribs );
- }
- else if ( ( parser.getName().equals( HtmlMarkup.B.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.STRONG.toString() ) ) )
- {
- sink.inline( SinkEventAttributeSet.Semantics.BOLD );
- }
- else if ( ( parser.getName().equals( HtmlMarkup.I.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.EM.toString() ) ) )
- {
- handleFigureCaptionStart( sink, attribs );
- }
- else if ( ( parser.getName().equals( HtmlMarkup.CODE.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.SAMP.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.TT.toString() ) ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.CODE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.A.toString() ) )
- {
- handleAStart( parser, sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.TABLE.toString() ) )
- {
- handleTableStart( sink, attribs, parser );
- }
- else if ( parser.getName().equals( HtmlMarkup.TR.toString() ) )
- {
- sink.tableRow( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.TH.toString() ) )
- {
- sink.tableHeaderCell( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.TD.toString() ) )
- {
- sink.tableCell( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.CAPTION.toString() ) )
- {
- sink.tableCaption( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.BR.toString() ) )
- {
- sink.lineBreak( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.HR.toString() ) )
- {
- sink.horizontalRule( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.IMG.toString() ) )
- {
- handleImgStart( parser, sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SCRIPT.toString() )
- || parser.getName().equals( HtmlMarkup.STYLE.toString() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_START );
- scriptBlock = true;
- }
- else
- {
- visited = false;
- }
-
- return visited;
- }
-
- /**
- * <p>
- * Goes through a common list of possible html end tags.
- * These should be re-usable by different xhtml-based parsers.
- * The tags handled here are the same as for {@link #baseStartTag(XmlPullParser,Sink)},
- * except for the empty elements ({@code <br/>, <hr/>, <img/>}).
- * </p>
- *
- * @param parser A parser.
- * @param sink the sink to receive the events.
- * @return True if the event has been handled by this method, false otherwise.
- */
- protected boolean baseEndTag( XmlPullParser parser, Sink sink )
- {
- boolean visited = true;
-
- if ( parser.getName().equals( HtmlMarkup.P.toString() ) )
- {
- if ( !inFigure )
- {
- sink.paragraph_();
- }
- }
- else if ( parser.getName().equals( HtmlMarkup.U.toString() )
- || parser.getName().equals( HtmlMarkup.S.toString() )
- || parser.getName().equals( HtmlMarkup.STRIKE.toString() )
- || parser.getName().equals( "del" ) )
- {
- sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SUB.toString() )
- || parser.getName().equals( HtmlMarkup.SUP.toString() ) )
- {
- sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DIV.toString() ) )
- {
- if ( inFigure )
- {
- sink.figure_();
- this.inFigure = false;
- }
- else
- {
- visited = false;
- }
- }
- else if ( parser.getName().equals( HtmlMarkup.PRE.toString() ) )
- {
- verbatim_();
-
- sink.verbatim_();
- }
- else if ( parser.getName().equals( HtmlMarkup.UL.toString() ) )
- {
- sink.list_();
- }
- else if ( parser.getName().equals( HtmlMarkup.OL.toString() ) )
- {
- sink.numberedList_();
- orderedListDepth--;
- }
- else if ( parser.getName().equals( HtmlMarkup.LI.toString() ) )
- {
- handleListItemEnd( sink );
- }
- else if ( parser.getName().equals( HtmlMarkup.DL.toString() ) )
- {
- if ( hasDefinitionListItem )
- {
- sink.definitionListItem_();
- hasDefinitionListItem = false;
- }
- sink.definitionList_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DT.toString() ) )
- {
- sink.definedTerm_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DD.toString() ) )
- {
- sink.definition_();
- sink.definitionListItem_();
- hasDefinitionListItem = false;
- }
- else if ( ( parser.getName().equals( HtmlMarkup.B.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.STRONG.toString() ) ) )
- {
- sink.inline_();
- }
- else if ( ( parser.getName().equals( HtmlMarkup.I.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.EM.toString() ) ) )
- {
- handleFigureCaptionEnd( sink );
- }
- else if ( ( parser.getName().equals( HtmlMarkup.CODE.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.SAMP.toString() ) )
- || ( parser.getName().equals( HtmlMarkup.TT.toString() ) ) )
- {
- sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.A.toString() ) )
- {
- handleAEnd( sink );
- }
-
- // ----------------------------------------------------------------------
- // Tables
- // ----------------------------------------------------------------------
-
- else if ( parser.getName().equals( HtmlMarkup.TABLE.toString() ) )
- {
- sink.tableRows_();
-
- sink.table_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TR.toString() ) )
- {
- sink.tableRow_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TH.toString() ) )
- {
- sink.tableHeaderCell_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TD.toString() ) )
- {
- sink.tableCell_();
- }
- else if ( parser.getName().equals( HtmlMarkup.CAPTION.toString() ) )
- {
- sink.tableCaption_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
- {
- sink.sectionTitle1_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
- {
- sink.sectionTitle2_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
- {
- sink.sectionTitle3_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
- {
- sink.sectionTitle4_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
- {
- sink.sectionTitle5_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SCRIPT.toString() )
- || parser.getName().equals( HtmlMarkup.STYLE.toString() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_END );
-
- scriptBlock = false;
- }
- else
- {
- visited = false;
- }
-
- return visited;
- }
-
- /**
- * {@inheritDoc}
- *
- * Just calls {@link #baseStartTag(XmlPullParser,Sink)}, this should be
- * overridden by implementing parsers to include additional tags.
- */
- protected void handleStartTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException
- {
- if ( !baseStartTag( parser, sink ) )
- {
- LOGGER.warn( "Unrecognized xml tag <{}> at [{}:{}]", parser.getName(),
- parser.getLineNumber(), parser.getColumnNumber() );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * Just calls {@link #baseEndTag(XmlPullParser,Sink)}, this should be
- * overridden by implementing parsers to include additional tags.
- */
- protected void handleEndTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException
- {
- if ( !baseEndTag( parser, sink ) )
- {
- // unrecognized tag is already logged in StartTag
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void handleText( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
-
- /*
- * NOTE: Don't do any whitespace trimming here. Whitespace normalization has already been performed by the
- * parser so any whitespace that makes it here is significant.
- *
- * NOTE: text within script tags is ignored, scripting code should be embedded in CDATA.
- */
- if ( StringUtils.isNotEmpty( text ) && !isScriptBlock() )
- {
- sink.text( text );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void handleComment( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
-
- if ( "PB".equals( text.trim() ) )
- {
- sink.pageBreak();
- }
- else
- {
- if ( isEmitComments() )
- {
- sink.comment( text );
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void handleCdsect( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
-
- if ( isScriptBlock() )
- {
- sink.unknown( CDATA, new Object[] { CDATA_TYPE, text }, null );
- }
- else
- {
- sink.text( text );
- }
- }
-
- /**
- * Make sure sections are nested consecutively.
- *
- * <p>
- * HTML doesn't have any sections, only sectionTitles (<h2> etc), that means we have to
- * open close any sections that are missing in between.
- * </p>
- *
- * <p>
- * For instance, if the following sequence is parsed:
- * </p>
- * <pre>
- * <h2></h2>
- * <h5></h5>
- * </pre>
- * <p>
- * we have to insert two section starts before we open the <code><h5></code>.
- * In the following sequence
- * </p>
- * <pre>
- * <h5></h5>
- * <h2></h2>
- * </pre>
- * <p>
- * we have to close two sections before we open the <code><h2></code>.
- * </p>
- *
- * <p>The current level is set to newLevel afterwards.</p>
- *
- * @param newLevel the new section level, all upper levels have to be closed.
- * @param sink the sink to receive the events.
- */
- protected void consecutiveSections( int newLevel, Sink sink )
- {
- closeOpenSections( newLevel, sink );
- openMissingSections( newLevel, sink );
-
- this.sectionLevel = newLevel;
- }
-
- /**
- * Close open sections.
- *
- * @param newLevel the new section level, all upper levels have to be closed.
- * @param sink the sink to receive the events.
- */
- private void closeOpenSections( int newLevel, Sink sink )
- {
- while ( this.sectionLevel >= newLevel )
- {
- if ( sectionLevel == Sink.SECTION_LEVEL_5 )
- {
- sink.section5_();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_4 )
- {
- sink.section4_();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_3 )
- {
- sink.section3_();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_2 )
- {
- sink.section2_();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_1 )
- {
- sink.section1_();
- }
-
- this.sectionLevel--;
- }
- }
-
- /**
- * Open missing sections.
- *
- * @param newLevel the new section level, all lower levels have to be opened.
- * @param sink the sink to receive the events.
- */
- private void openMissingSections( int newLevel, Sink sink )
- {
- while ( this.sectionLevel < newLevel - 1 )
- {
- this.sectionLevel++;
-
- if ( sectionLevel == Sink.SECTION_LEVEL_5 )
- {
- sink.section5();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_4 )
- {
- sink.section4();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_3 )
- {
- sink.section3();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_2 )
- {
- sink.section2();
- }
- else if ( sectionLevel == Sink.SECTION_LEVEL_1 )
- {
- sink.section1();
- }
- }
- }
-
- /**
- * Return the current section level.
- *
- * @return the current section level.
- */
- protected int getSectionLevel()
- {
- return this.sectionLevel;
- }
-
- /**
- * Set the current section level.
- *
- * @param newLevel the new section level.
- */
- protected void setSectionLevel( int newLevel )
- {
- this.sectionLevel = newLevel;
- }
-
- /**
- * Stop verbatim mode.
- */
- protected void verbatim_()
- {
- this.inVerbatim = false;
- }
-
- /**
- * Start verbatim mode.
- */
- protected void verbatim()
- {
- this.inVerbatim = true;
- }
-
- /**
- * Checks if we are currently inside a <pre> tag.
- *
- * @return true if we are currently in verbatim mode.
- */
- protected boolean isVerbatim()
- {
- return this.inVerbatim;
- }
-
- /**
- * Checks if we are currently inside a <script> tag.
- *
- * @return true if we are currently inside <code><script></code> tags.
- * @since 1.1.1.
- */
- protected boolean isScriptBlock()
- {
- return this.scriptBlock;
- }
-
- /**
- * Checks if the given id is a valid Doxia id and if not, returns a transformed one.
- *
- * @param id The id to validate.
- * @return A transformed id or the original id if it was already valid.
- * @see DoxiaUtils#encodeId(String)
- */
- protected String validAnchor( String id )
- {
- if ( !DoxiaUtils.isValidId( id ) )
- {
- String linkAnchor = DoxiaUtils.encodeId( id, true );
-
- LOGGER.debug( "Modified invalid link '{}' to '{}'", id, linkAnchor );
-
- return linkAnchor;
- }
-
- return id;
- }
-
- /** {@inheritDoc} */
- @Override
- protected void init()
- {
- super.init();
-
- this.scriptBlock = false;
- this.isLink = false;
- this.isAnchor = false;
- this.orderedListDepth = 0;
- this.sectionLevel = 0;
- this.inVerbatim = false;
- this.inFigure = false;
- }
-
- private void handleAEnd( Sink sink )
- {
- if ( isLink )
- {
- sink.link_();
- isLink = false;
- }
- else if ( isAnchor )
- {
- sink.anchor_();
- isAnchor = false;
- }
- }
-
- private void handleAStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
- String href = parser.getAttributeValue( null, Attribute.HREF.toString() );
-
- if ( href != null )
- {
- int hashIndex = href.indexOf( '#' );
- if ( hashIndex != -1 && !DoxiaUtils.isExternalLink( href ) )
- {
- String hash = href.substring( hashIndex + 1 );
-
- if ( !DoxiaUtils.isValidId( hash ) )
- {
- href = href.substring( 0, hashIndex ) + "#" + DoxiaUtils.encodeId( hash, true );
-
- LOGGER.debug( "Modified invalid link '{}' to '{}'", hash, href );
- }
- }
- sink.link( href, attribs );
- isLink = true;
- }
- else
- {
- String name = parser.getAttributeValue( null, Attribute.NAME.toString() );
-
- if ( name != null )
- {
- sink.anchor( validAnchor( name ), attribs );
- isAnchor = true;
- }
- else
- {
- String id = parser.getAttributeValue( null, Attribute.ID.toString() );
- if ( id != null )
- {
- sink.anchor( validAnchor( id ), attribs );
- isAnchor = true;
- }
- }
- }
- }
-
- private boolean handleDivStart( XmlPullParser parser, SinkEventAttributeSet attribs, Sink sink )
- {
- boolean visited = true;
-
- String divclass = parser.getAttributeValue( null, Attribute.CLASS.toString() );
-
- if ( "figure".equals( divclass ) )
- {
- this.inFigure = true;
- SinkEventAttributeSet atts = new SinkEventAttributeSet( attribs );
- atts.removeAttribute( SinkEventAttributes.CLASS );
- sink.figure( atts );
- }
- else
- {
- visited = false;
- }
-
- return visited;
- }
-
- private void handleFigureCaptionEnd( Sink sink )
- {
- if ( inFigure )
- {
- sink.figureCaption_();
- }
- else
- {
- sink.inline_();
- }
- }
-
- private void handleFigureCaptionStart( Sink sink, SinkEventAttributeSet attribs )
- {
- if ( inFigure )
- {
- sink.figureCaption( attribs );
- }
- else
- {
- sink.inline( SinkEventAttributeSet.Semantics.ITALIC );
- }
- }
-
- private void handleImgStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
- String src = parser.getAttributeValue( null, Attribute.SRC.toString() );
-
- if ( src != null )
- {
- sink.figureGraphics( src, attribs );
- }
- }
-
- private void handleLIStart( Sink sink, SinkEventAttributeSet attribs )
- {
- if ( orderedListDepth == 0 )
- {
- sink.listItem( attribs );
- }
- else
- {
- sink.numberedListItem( attribs );
- }
- }
-
- private void handleListItemEnd( Sink sink )
- {
- if ( orderedListDepth == 0 )
- {
- sink.listItem_();
- }
- else
- {
- sink.numberedListItem_();
- }
- }
-
- private void handleOLStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
- int numbering = Sink.NUMBERING_DECIMAL;
- // this will have to be generalized if we handle styles
- String style = parser.getAttributeValue( null, Attribute.STYLE.toString() );
-
- if ( style != null )
- {
- switch ( style )
- {
- case "list-style-type: upper-alpha":
- numbering = Sink.NUMBERING_UPPER_ALPHA;
- break;
- case "list-style-type: lower-alpha":
- numbering = Sink.NUMBERING_LOWER_ALPHA;
- break;
- case "list-style-type: upper-roman":
- numbering = Sink.NUMBERING_UPPER_ROMAN;
- break;
- case "list-style-type: lower-roman":
- numbering = Sink.NUMBERING_LOWER_ROMAN;
- break;
- case "list-style-type: decimal":
- numbering = Sink.NUMBERING_DECIMAL;
- break;
- default:
- // ignore all other
- }
- }
-
- sink.numberedList( numbering, attribs );
- orderedListDepth++;
- }
-
- private void handlePStart( Sink sink, SinkEventAttributeSet attribs )
- {
- if ( !inFigure )
- {
- sink.paragraph( attribs );
- }
- }
-
- /*
- * The PRE element tells visual user agents that the enclosed text is
- * "preformatted". When handling preformatted text, visual user agents:
- * - May leave white space intact.
- * - May render text with a fixed-pitch font.
- * - May disable automatic word wrap.
- * - Must not disable bidirectional processing.
- * Non-visual user agents are not required to respect extra white space
- * in the content of a PRE element.
- */
- private void handlePreStart( SinkEventAttributeSet attribs, Sink sink )
- {
- verbatim();
- sink.verbatim( attribs );
- }
-
- private void handleSectionStart( Sink sink, int level, SinkEventAttributeSet attribs )
- {
- consecutiveSections( level, sink );
- sink.section( level, attribs );
- sink.sectionTitle( level, attribs );
- }
-
- 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/XhtmlBaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
deleted file mode 100644
index 18e94088..00000000
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
+++ /dev/null
@@ -1,2229 +0,0 @@
-package org.apache.maven.doxia.sink.impl;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-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;
-
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.html.HTML.Attribute;
-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;
-
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract base xhtml sink implementation.
- *
- * @author Jason van Zyl
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public class XhtmlBaseSink
- extends AbstractXmlSink
- implements HtmlMarkup
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlBaseSink.class );
-
- // ----------------------------------------------------------------------
- // Instance fields
- // ----------------------------------------------------------------------
-
- /** The PrintWriter to write the result. */
- private final PrintWriter writer;
-
- /** Used to identify if a class string contains `hidden` */
- private static final Pattern HIDDEN_CLASS_PATTERN = Pattern.compile( "(?:.*\\s|^)hidden(?:\\s.*|$)" );
-
- /** Used to collect text events mainly for the head events. */
- private StringBuffer textBuffer = new StringBuffer();
-
- /** An indication on if we're inside a head. */
- private boolean headFlag;
-
- /** An indication on if we're inside an image caption flag. */
- private boolean figureCaptionFlag;
-
- /** An indication on if we're inside a paragraph flag. */
- private boolean paragraphFlag;
-
- /** 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;
-
- /** The stack of StringWriter to write the table result temporary, so we could play with the output DOXIA-177. */
- private final LinkedList<StringWriter> tableContentWriterStack;
-
- private final LinkedList<StringWriter> tableCaptionWriterStack;
-
- private final LinkedList<PrettyPrintXMLWriter> tableCaptionXMLWriterStack;
-
- /** The stack of table caption */
- private final LinkedList<String> tableCaptionStack;
-
- /** used to store attributes passed to table(). */
- protected MutableAttributeSet tableAttributes;
-
- /** Used to distinguish old-style figure handling. */
- private boolean legacyFigure;
-
- /** Used to distinguish old-style figure handling. */
- private boolean legacyFigureCaption;
-
- /** Indicates that an image is part of a figure. */
- private boolean inFigure;
-
- /** 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;
-
- /** Keep track of the closing tags for inline events. */
- protected Stack<List<Tag>> inlineStack = new Stack<>();
-
- // ----------------------------------------------------------------------
- // Constructor
- // ----------------------------------------------------------------------
-
- /**
- * Constructor, initialize the PrintWriter.
- *
- * @param out The writer to write the result.
- */
- public XhtmlBaseSink( Writer out )
- {
- 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<>();
- this.tableCaptionStack = new LinkedList<>();
-
- init();
- }
-
- // ----------------------------------------------------------------------
- // Accessor methods
- // ----------------------------------------------------------------------
-
- /**
- * To use mainly when playing with the head events.
- *
- * @return the current buffer of text events.
- */
- protected StringBuffer getTextBuffer()
- {
- return this.textBuffer;
- }
-
- /**
- * <p>Setter for the field <code>headFlag</code>.</p>
- *
- * @param headFlag an header flag.
- */
- protected void setHeadFlag( boolean headFlag )
- {
- this.headFlag = headFlag;
- }
-
- /**
- * <p>isHeadFlag.</p>
- *
- * @return the current headFlag.
- */
- protected boolean isHeadFlag()
- {
- return this.headFlag ;
- }
-
- /**
- * <p>Setter for the field <code>verbatimFlag</code>.</p>
- *
- * @param verb a verbatim flag.
- */
- protected void setVerbatimFlag( boolean verb )
- {
- this.verbatimFlag = verb;
- }
-
- /**
- * <p>isVerbatimFlag.</p>
- *
- * @return the current verbatim flag.
- */
- protected boolean isVerbatimFlag()
- {
- 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()
- {
- super.init();
-
- resetTextBuffer();
-
- this.cellJustifStack.clear();
- this.isCellJustifStack.clear();
- this.cellCountStack.clear();
- this.tableContentWriterStack.clear();
- this.tableCaptionWriterStack.clear();
- this.tableCaptionXMLWriterStack.clear();
- this.tableCaptionStack.clear();
-
- this.headFlag = false;
- this.figureCaptionFlag = false;
- this.paragraphFlag = false;
- this.verbatimFlag = false;
-
- this.evenTableRow = true;
- this.tableAttributes = null;
- this.legacyFigure = false;
- this.legacyFigureCaption = false;
- this.inFigure = false;
- this.tableRows = false;
- }
-
- /**
- * Reset the text buffer.
- */
- protected void resetTextBuffer()
- {
- this.textBuffer = new StringBuffer();
- }
-
- // ----------------------------------------------------------------------
- // Sections
- // ----------------------------------------------------------------------
-
- /** {@inheritDoc} */
- @Override
- public void section( int level, SinkEventAttributes attributes )
- {
- onSection( level, attributes );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle( int level, SinkEventAttributes attributes )
- {
- onSectionTitle( level, attributes );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle_( int level )
- {
- onSectionTitle_( level );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section_( int level )
- {
- onSection_( level );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section1()
- {
- onSection( SECTION_LEVEL_1, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle1()
- {
- onSectionTitle( SECTION_LEVEL_1, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle1_()
- {
- onSectionTitle_( SECTION_LEVEL_1 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section1_()
- {
- onSection_( SECTION_LEVEL_1 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section2()
- {
- onSection( SECTION_LEVEL_2, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle2()
- {
- onSectionTitle( SECTION_LEVEL_2, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle2_()
- {
- onSectionTitle_( SECTION_LEVEL_2 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section2_()
- {
- onSection_( SECTION_LEVEL_2 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section3()
- {
- onSection( SECTION_LEVEL_3, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle3()
- {
- onSectionTitle( SECTION_LEVEL_3, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle3_()
- {
- onSectionTitle_( SECTION_LEVEL_3 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section3_()
- {
- onSection_( SECTION_LEVEL_3 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section4()
- {
- onSection( SECTION_LEVEL_4, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle4()
- {
- onSectionTitle( SECTION_LEVEL_4, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle4_()
- {
- onSectionTitle_( SECTION_LEVEL_4 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section4_()
- {
- onSection_( SECTION_LEVEL_4 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section5()
- {
- onSection( SECTION_LEVEL_5, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle5()
- {
- onSectionTitle( SECTION_LEVEL_5, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void sectionTitle5_()
- {
- onSectionTitle_( SECTION_LEVEL_5 );
- }
-
- /** {@inheritDoc} */
- @Override
- public void section5_()
- {
- onSection_( SECTION_LEVEL_5 );
- }
-
- /**
- * Starts a section. The default class style is <code>section</code>.
- *
- * @param depth The level of the section.
- * @param attributes some attributes. May be null.
- * @see javax.swing.text.html.HTML.Tag#DIV
- */
- protected void onSection( int depth, SinkEventAttributes attributes )
- {
- if ( depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_5 )
- {
- MutableAttributeSet att = new SinkEventAttributeSet();
- att.addAttribute( Attribute.CLASS, "section" );
- // NOTE: any class entry in attributes will overwrite the above
- att.addAttributes( SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES ) );
-
- writeStartTag( HtmlMarkup.DIV, att );
- }
- }
-
- /**
- * Ends a section.
- *
- * @param depth The level of the section.
- * @see javax.swing.text.html.HTML.Tag#DIV
- */
- protected void onSection_( int depth )
- {
- if ( depth >= SECTION_LEVEL_1 && depth <= SECTION_LEVEL_5 )
- {
- writeEndTag( HtmlMarkup.DIV );
- }
- }
-
- /**
- * Starts a section title.
- *
- * @param depth The level of the section title.
- * @param attributes some attributes. May be null.
- * @see javax.swing.text.html.HTML.Tag#H1
- * @see javax.swing.text.html.HTML.Tag#H2
- * @see javax.swing.text.html.HTML.Tag#H3
- * @see javax.swing.text.html.HTML.Tag#H4
- * @see javax.swing.text.html.HTML.Tag#H5
- */
- protected void onSectionTitle( int depth, SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- if ( depth == SECTION_LEVEL_1 )
- {
- writeStartTag( HtmlMarkup.H1, atts );
- }
- else if ( depth == SECTION_LEVEL_2 )
- {
- writeStartTag( HtmlMarkup.H2, atts );
- }
- else if ( depth == SECTION_LEVEL_3 )
- {
- writeStartTag( HtmlMarkup.H3, atts );
- }
- else if ( depth == SECTION_LEVEL_4 )
- {
- writeStartTag( HtmlMarkup.H4, atts );
- }
- else if ( depth == SECTION_LEVEL_5 )
- {
- writeStartTag( HtmlMarkup.H5, atts );
- }
- }
-
- /**
- * Ends a section title.
- *
- * @param depth The level of the section title.
- * @see javax.swing.text.html.HTML.Tag#H1
- * @see javax.swing.text.html.HTML.Tag#H2
- * @see javax.swing.text.html.HTML.Tag#H3
- * @see javax.swing.text.html.HTML.Tag#H4
- * @see javax.swing.text.html.HTML.Tag#H5
- */
- protected void onSectionTitle_( int depth )
- {
- if ( depth == SECTION_LEVEL_1 )
- {
- writeEndTag( HtmlMarkup.H1 );
- }
- else if ( depth == SECTION_LEVEL_2 )
- {
- writeEndTag( HtmlMarkup.H2 );
- }
- else if ( depth == SECTION_LEVEL_3 )
- {
- writeEndTag( HtmlMarkup.H3 );
- }
- else if ( depth == SECTION_LEVEL_4 )
- {
- writeEndTag( HtmlMarkup.H4 );
- }
- else if ( depth == SECTION_LEVEL_5 )
- {
- writeEndTag( HtmlMarkup.H5 );
- }
- }
-
- // -----------------------------------------------------------------------
- //
- // -----------------------------------------------------------------------
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#UL
- */
- @Override
- public void list()
- {
- list( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#UL
- */
- @Override
- public void list( SinkEventAttributes attributes )
- {
- if ( paragraphFlag )
- {
- // The content of element type "p" must match
- // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
- // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
- paragraph_();
- }
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.UL, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#UL
- */
- @Override
- public void list_()
- {
- writeEndTag( HtmlMarkup.UL );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void listItem()
- {
- listItem( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void listItem( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.LI, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void listItem_()
- {
- writeEndTag( HtmlMarkup.LI );
- }
-
- /**
- * The default list style depends on the numbering.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#OL
- */
- @Override
- public void numberedList( int numbering )
- {
- numberedList( numbering, null );
- }
-
- /**
- * The default list style depends on the numbering.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#OL
- */
- @Override
- public void numberedList( int numbering, SinkEventAttributes attributes )
- {
- if ( paragraphFlag )
- {
- // The content of element type "p" must match
- // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
- // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
- paragraph_();
- }
-
- String style;
- switch ( numbering )
- {
- case NUMBERING_UPPER_ALPHA:
- style = "upper-alpha";
- break;
- case NUMBERING_LOWER_ALPHA:
- style = "lower-alpha";
- break;
- case NUMBERING_UPPER_ROMAN:
- style = "upper-roman";
- break;
- case NUMBERING_LOWER_ROMAN:
- style = "lower-roman";
- break;
- case NUMBERING_DECIMAL:
- default:
- style = "decimal";
- }
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- if ( atts == null )
- {
- atts = new SinkEventAttributeSet( 1 );
- }
-
- atts.addAttribute( Attribute.STYLE, "list-style-type: " + style );
-
- writeStartTag( HtmlMarkup.OL, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#OL
- */
- @Override
- public void numberedList_()
- {
- writeEndTag( HtmlMarkup.OL );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void numberedListItem()
- {
- numberedListItem( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void numberedListItem( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.LI, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#LI
- */
- @Override
- public void numberedListItem_()
- {
- writeEndTag( HtmlMarkup.LI );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DL
- */
- @Override
- public void definitionList()
- {
- definitionList( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DL
- */
- @Override
- public void definitionList( SinkEventAttributes attributes )
- {
- if ( paragraphFlag )
- {
- // The content of element type "p" must match
- // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
- // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
- paragraph_();
- }
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.DL, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DL
- */
- @Override
- public void definitionList_()
- {
- writeEndTag( HtmlMarkup.DL );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DT
- */
- @Override
- public void definedTerm( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.DT, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DT
- */
- @Override
- public void definedTerm()
- {
- definedTerm( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DT
- */
- @Override
- public void definedTerm_()
- {
- writeEndTag( HtmlMarkup.DT );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DD
- */
- @Override
- public void definition()
- {
- definition( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DD
- */
- @Override
- public void definition( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.DD, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DD
- */
- @Override
- public void definition_()
- {
- writeEndTag( HtmlMarkup.DD );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#IMG
- * @deprecated Use {@link #figure(SinkEventAttributes)}, this method is only kept for
- * backward compatibility. Note that the behavior is different though, as this method
- * writes an img tag, while correctly the img tag should be written by figureGraphics().
- */
- @Override
- public void figure()
- {
- write( String.valueOf( LESS_THAN ) + HtmlMarkup.IMG );
- legacyFigure = true;
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#IMG
- */
- @Override
- public void figure( SinkEventAttributes attributes )
- {
- inFigure = true;
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- if ( atts == null )
- {
- atts = new SinkEventAttributeSet( 1 );
- }
-
- if ( !atts.isDefined( SinkEventAttributes.CLASS ) )
- {
- atts.addAttribute( SinkEventAttributes.CLASS, "figure" );
- }
-
- writeStartTag( HtmlMarkup.DIV, atts );
- }
-
- /** {@inheritDoc} */
- @Override
- public void figure_()
- {
- if ( legacyFigure )
- {
- if ( !figureCaptionFlag )
- {
- // Attribute "alt" is required and must be specified for element type "img".
- write( String.valueOf( SPACE ) + Attribute.ALT + EQUAL + QUOTE + QUOTE );
- }
- write( String.valueOf( SPACE ) + SLASH + GREATER_THAN );
- legacyFigure = false;
- }
- else
- {
- writeEndTag( HtmlMarkup.DIV );
- inFigure = false;
- }
-
- figureCaptionFlag = false;
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #figureGraphics(String,SinkEventAttributes)},
- * this method is only kept for backward compatibility. Note that the behavior is
- * different though, as this method does not write the img tag, only the src attribute.
- */
- @Override
- public void figureGraphics( String name )
- {
- write( String.valueOf( SPACE ) + Attribute.SRC + EQUAL + QUOTE + escapeHTML( name ) + QUOTE );
- }
-
- /** {@inheritDoc} */
- @Override
- public void figureGraphics( String src, SinkEventAttributes attributes )
- {
- if ( inFigure )
- {
- MutableAttributeSet atts = new SinkEventAttributeSet( 1 );
- atts.addAttribute( SinkEventAttributes.ALIGN, "center" );
-
- writeStartTag( HtmlMarkup.P, atts );
- }
-
- MutableAttributeSet filtered = SinkUtils.filterAttributes( attributes, SinkUtils.SINK_IMG_ATTRIBUTES );
- if ( filtered != null )
- {
- filtered.removeAttribute( Attribute.SRC.toString() );
- }
-
- int count = ( attributes == null ? 1 : attributes.getAttributeCount() + 1 );
-
- MutableAttributeSet atts = new SinkEventAttributeSet( count );
-
- atts.addAttribute( Attribute.SRC, HtmlTools.escapeHTML( src, true ) );
- atts.addAttributes( filtered );
-
- if ( atts.getAttribute( Attribute.ALT.toString() ) == null )
- {
- atts.addAttribute( Attribute.ALT.toString(), "" );
- }
-
- writeStartTag( HtmlMarkup.IMG, atts, true );
-
- if ( inFigure )
- {
- writeEndTag( HtmlMarkup.P );
- }
- }
-
- /**
- * {@inheritDoc}
- * @deprecated Use {@link #figureCaption(SinkEventAttributes)},
- * this method is only kept for backward compatibility. Note that the behavior is
- * different though, as this method only writes an alt attribute.
- */
- @Override
- public void figureCaption()
- {
- figureCaptionFlag = true;
- write( String.valueOf( SPACE ) + Attribute.ALT + EQUAL + QUOTE );
- legacyFigureCaption = true;
- }
-
- /** {@inheritDoc} */
- @Override
- public void figureCaption( SinkEventAttributes attributes )
- {
- if ( legacyFigureCaption )
- {
- write( String.valueOf( SPACE ) + Attribute.ALT + EQUAL + QUOTE );
- legacyFigureCaption = false;
- figureCaptionFlag = true;
- }
- else
- {
- SinkEventAttributeSet atts = new SinkEventAttributeSet( 1 );
- atts.addAttribute( SinkEventAttributes.ALIGN, "center" );
- atts.addAttributes( SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES ) );
-
- paragraph( atts );
- inline( SinkEventAttributeSet.Semantics.ITALIC );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void figureCaption_()
- {
- if ( legacyFigureCaption )
- {
- write( String.valueOf( QUOTE ) );
- }
- else
- {
- inline_();
- paragraph_();
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#P
- */
- @Override
- public void paragraph()
- {
- paragraph( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#P
- */
- @Override
- public void paragraph( SinkEventAttributes attributes )
- {
- paragraphFlag = true;
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.P, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#P
- */
- @Override
- public void paragraph_()
- {
- if ( paragraphFlag )
- {
- writeEndTag( HtmlMarkup.P );
- paragraphFlag = false;
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#ADDRESS
- */
- @Override
- public void address()
- {
- address( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#ADDRESS
- */
- @Override
- public void address( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.ADDRESS, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#ADDRESS
- */
- @Override
- public void address_()
- {
- writeEndTag( HtmlMarkup.ADDRESS );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#BLOCKQUOTE
- */
- @Override
- public void blockquote()
- {
- blockquote( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#BLOCKQUOTE
- */
- @Override
- public void blockquote( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.BLOCKQUOTE, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#BLOCKQUOTE
- */
- @Override
- public void blockquote_()
- {
- writeEndTag( HtmlMarkup.BLOCKQUOTE );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DIV
- */
- @Override
- public void division()
- {
- division( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DIV
- */
- @Override
- public void division( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.DIV, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DIV
- */
- @Override
- public void division_()
- {
- writeEndTag( HtmlMarkup.DIV );
- }
-
- /**
- * The default class style for boxed is <code>source</code>.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DIV
- * @see javax.swing.text.html.HTML.Tag#PRE
- */
- @Override
- public void verbatim( SinkEventAttributes attributes )
- {
- if ( paragraphFlag )
- {
- // The content of element type "p" must match
- // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
- // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
- paragraph_();
- }
-
- verbatimFlag = true;
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_VERBATIM_ATTRIBUTES );
-
- if ( atts == null )
- {
- atts = new SinkEventAttributeSet();
- }
-
- boolean boxed = false;
-
- if ( atts.isDefined( SinkEventAttributes.DECORATION ) )
- {
- boxed =
- "boxed".equals( atts.getAttribute( SinkEventAttributes.DECORATION ).toString() );
- }
-
- SinkEventAttributes divAtts = null;
-
- if ( boxed )
- {
- divAtts = new SinkEventAttributeSet( Attribute.CLASS.toString(), "source" );
- }
-
- atts.removeAttribute( SinkEventAttributes.DECORATION );
-
- writeStartTag( HtmlMarkup.DIV, divAtts );
- writeStartTag( HtmlMarkup.PRE, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#DIV
- * @see javax.swing.text.html.HTML.Tag#PRE
- */
- @Override
- public void verbatim_()
- {
- writeEndTag( HtmlMarkup.PRE );
- writeEndTag( HtmlMarkup.DIV );
-
- verbatimFlag = false;
-
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#HR
- */
- @Override
- public void horizontalRule()
- {
- horizontalRule( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#HR
- */
- @Override
- public void horizontalRule( SinkEventAttributes attributes )
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_HR_ATTRIBUTES );
-
- writeSimpleTag( HtmlMarkup.HR, atts );
- }
-
- /** {@inheritDoc} */
- @Override
- public void table()
- {
- // start table with tableRows
- table( null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void table( SinkEventAttributes attributes )
- {
- this.tableContentWriterStack.addLast( new StringWriter() );
- this.tableRows = false;
-
- if ( paragraphFlag )
- {
- // The content of element type "p" must match
- // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
- // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
- paragraph_();
- }
-
- // start table with tableRows
- if ( attributes == null )
- {
- this.tableAttributes = new SinkEventAttributeSet( 0 );
- }
- else
- {
- this.tableAttributes = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_TABLE_ATTRIBUTES );
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#TABLE
- */
- @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" );
- return;
- }
-
- String tableContent = this.tableContentWriterStack.removeLast().toString();
-
- String tableCaption = null;
- if ( !this.tableCaptionStack.isEmpty() && this.tableCaptionStack.getLast() != null )
- {
- tableCaption = this.tableCaptionStack.removeLast();
- }
-
- if ( tableCaption != null )
- {
- // DOXIA-177
- StringBuilder sb = new StringBuilder();
- sb.append( tableContent, 0, tableContent.indexOf( Markup.GREATER_THAN ) + 1 );
- sb.append( tableCaption );
- sb.append( tableContent.substring( tableContent.indexOf( Markup.GREATER_THAN ) + 1 ) );
-
- write( sb.toString() );
- }
- else
- {
- write( tableContent );
- }
- }
-
- /**
- * The default class style is <code>bodyTable</code>.
- * The default align is <code>center</code>.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#TABLE
- */
- @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.addAttributes( this.tableAttributes );
- 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;
- }
-
- /**
- * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#TR
- */
- @Override
- public void tableRow()
- {
- // To be backward compatible
- if ( !this.tableRows )
- {
- tableRows( null, false );
- }
- tableRow( null );
- }
-
- /**
- * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. If the provided attributes
- * specify the <code>hidden</code> class, the next call to tableRow will set the same striping class as this one. A
- * style for <code>hidden</code> or <code>table.bodyTable hidden</code> may need to be provided to actually hide
- * such a row. {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#TR
- */
- @Override
- public void tableRow( SinkEventAttributes attributes )
- {
- MutableAttributeSet attrs = SinkUtils.filterAttributes( attributes, SinkUtils.SINK_TR_ATTRIBUTES );
-
- if ( attrs == null )
- {
- attrs = new SinkEventAttributeSet();
- }
-
- String rowClass = evenTableRow ? "a" : "b";
- boolean hidden = false;
- if ( attrs.isDefined( Attribute.CLASS.toString() ) )
- {
- String givenRowClass = (String) attrs.getAttribute( Attribute.CLASS.toString() );
- if ( HIDDEN_CLASS_PATTERN.matcher( givenRowClass ).matches() )
- {
- hidden = true;
- }
- rowClass = givenRowClass + " " + rowClass;
- }
-
- attrs.addAttribute( Attribute.CLASS, rowClass );
-
- writeStartTag( HtmlMarkup.TR, attrs );
-
- if ( !hidden )
- {
- evenTableRow = !evenTableRow;
- }
-
- if ( !this.cellCountStack.isEmpty() )
- {
- this.cellCountStack.removeLast();
- this.cellCountStack.addLast( 0 );
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#TR
- */
- @Override
- public void tableRow_()
- {
- writeEndTag( HtmlMarkup.TR );
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableCell()
- {
- tableCell( (SinkEventAttributeSet) null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableHeaderCell()
- {
- tableHeaderCell( (SinkEventAttributeSet) null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableCell( SinkEventAttributes attributes )
- {
- tableCell( false, attributes );
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableHeaderCell( SinkEventAttributes attributes )
- {
- tableCell( true, attributes );
- }
-
- /**
- * @param headerRow true if it is an header row
- * @param attributes the cell attributes
- * @see javax.swing.text.html.HTML.Tag#TH
- * @see javax.swing.text.html.HTML.Tag#TD
- */
- private void tableCell( boolean headerRow, MutableAttributeSet attributes )
- {
- 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 );
- }
- else
- {
- writeStartTag( t,
- SinkUtils.filterAttributes( attributes, SinkUtils.SINK_TD_ATTRIBUTES ) );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableCell_()
- {
- tableCell_( false );
- }
-
- /** {@inheritDoc} */
- @Override
- public void tableHeaderCell_()
- {
- tableCell_( true );
- }
-
- /**
- * Ends a table cell.
- *
- * @param headerRow true if it is an header row
- * @see javax.swing.text.html.HTML.Tag#TH
- * @see javax.swing.text.html.HTML.Tag#TD
- */
- private void tableCell_( boolean headerRow )
- {
- 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 );
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#CAPTION
- */
- @Override
- public void tableCaption()
- {
- tableCaption( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#CAPTION
- */
- @Override
- public void tableCaption( SinkEventAttributes attributes )
- {
- StringWriter sw = new StringWriter();
- this.tableCaptionWriterStack.addLast( sw );
- this.tableCaptionXMLWriterStack.addLast( new PrettyPrintXMLWriter( sw ) );
-
- // TODO: tableCaption should be written before tableRows (DOXIA-177)
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_SECTION_ATTRIBUTES );
-
- writeStartTag( HtmlMarkup.CAPTION, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#CAPTION
- */
- @Override
- public void tableCaption_()
- {
- writeEndTag( HtmlMarkup.CAPTION );
-
- if ( !this.tableCaptionXMLWriterStack.isEmpty() && this.tableCaptionXMLWriterStack.getLast() != null )
- {
- this.tableCaptionStack.addLast( this.tableCaptionWriterStack.removeLast().toString() );
- this.tableCaptionXMLWriterStack.removeLast();
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- */
- @Override
- public void anchor( String name )
- {
- anchor( name, null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- */
- @Override
- public void anchor( String name, SinkEventAttributes attributes )
- {
- Objects.requireNonNull( name, "name cannot be null" );
-
- if ( headFlag )
- {
- return;
- }
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BASE_ATTRIBUTES );
-
- String id = name;
-
- if ( !DoxiaUtils.isValidId( id ) )
- {
- id = DoxiaUtils.encodeId( name, true );
-
- LOGGER.debug( "Modified invalid anchor name '{}' to '{}'", name, id );
- }
-
- MutableAttributeSet att = new SinkEventAttributeSet();
- att.addAttribute( Attribute.NAME, id );
- att.addAttributes( atts );
-
- writeStartTag( HtmlMarkup.A, att );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- */
- @Override
- public void anchor_()
- {
- if ( !headFlag )
- {
- writeEndTag( HtmlMarkup.A );
- }
- }
-
- /**
- * The default style class for external link is <code>externalLink</code>.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- **/
- @Override
- public void link( String name )
- {
- link( name, null );
- }
-
- /**
- * The default style class for external link is <code>externalLink</code>.
- *
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- **/
- @Override
- public void link( String name, SinkEventAttributes attributes )
- {
- Objects.requireNonNull( name, "name cannot be null" );
-
- if ( headFlag )
- {
- return;
- }
-
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_LINK_ATTRIBUTES );
-
- if ( atts == null )
- {
- atts = new SinkEventAttributeSet();
- }
-
- if ( DoxiaUtils.isExternalLink( name ) )
- {
- String linkClass = "externalLink";
- if ( atts.isDefined( Attribute.CLASS.toString() ) )
- {
- String givenLinkClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
- linkClass = givenLinkClass + " " + linkClass;
- }
-
- atts.addAttribute( Attribute.CLASS, linkClass );
- }
-
- atts.addAttribute( Attribute.HREF, HtmlTools.escapeHTML( name ) );
-
- writeStartTag( HtmlMarkup.A, atts );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#A
- */
- @Override
- public void link_()
- {
- if ( !headFlag )
- {
- writeEndTag( HtmlMarkup.A );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void inline()
- {
- inline( null );
- }
-
- private void inlineSemantics( SinkEventAttributes attributes, String semantic,
- List<Tag> tags, Tag tag )
- {
- if ( attributes.containsAttribute( SinkEventAttributes.SEMANTICS, semantic ) )
- {
- SinkEventAttributes attributesNoSemantics = ( SinkEventAttributes ) attributes.copyAttributes();
- attributesNoSemantics.removeAttribute( SinkEventAttributes.SEMANTICS );
- writeStartTag( tag, attributesNoSemantics );
- tags.add( 0, tag );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void inline( SinkEventAttributes attributes )
- {
- if ( !headFlag )
- {
- List<Tag> tags = new ArrayList<>();
-
- if ( attributes != null )
- {
- inlineSemantics( attributes, "emphasis", tags, HtmlMarkup.EM );
- inlineSemantics( attributes, "strong", tags, HtmlMarkup.STRONG );
- inlineSemantics( attributes, "small", tags, HtmlMarkup.SMALL );
- inlineSemantics( attributes, "line-through", tags, HtmlMarkup.S );
- inlineSemantics( attributes, "citation", tags, HtmlMarkup.CITE );
- inlineSemantics( attributes, "quote", tags, HtmlMarkup.Q );
- inlineSemantics( attributes, "definition", tags, HtmlMarkup.DFN );
- inlineSemantics( attributes, "abbreviation", tags, HtmlMarkup.ABBR );
- inlineSemantics( attributes, "italic", tags, HtmlMarkup.I );
- inlineSemantics( attributes, "bold", tags, HtmlMarkup.B );
- inlineSemantics( attributes, "monospaced", tags, HtmlMarkup.TT );
- inlineSemantics( attributes, "code", tags, HtmlMarkup.CODE );
- inlineSemantics( attributes, "variable", tags, HtmlMarkup.VAR );
- inlineSemantics( attributes, "sample", tags, HtmlMarkup.SAMP );
- inlineSemantics( attributes, "keyboard", tags, HtmlMarkup.KBD );
- inlineSemantics( attributes, "superscript", tags, HtmlMarkup.SUP );
- inlineSemantics( attributes, "subscript", tags, HtmlMarkup.SUB );
- inlineSemantics( attributes, "annotation", tags, HtmlMarkup.U );
- inlineSemantics( attributes, "bidirectionalOverride", tags, HtmlMarkup.BDO );
- inlineSemantics( attributes, "phrase", tags, HtmlMarkup.SPAN );
- inlineSemantics( attributes, "insert", tags, HtmlMarkup.INS );
- inlineSemantics( attributes, "delete", tags, HtmlMarkup.DEL );
- }
-
- inlineStack.push( tags );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void inline_()
- {
- if ( !headFlag )
- {
- for ( Tag tag: inlineStack.pop() )
- {
- writeEndTag( tag );
- }
- }
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#I
- */
- @Override
- public void italic()
- {
- inline( SinkEventAttributeSet.Semantics.ITALIC );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#I
- */
- @Override
- public void italic_()
- {
- inline_();
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#B
- */
- @Override
- public void bold()
- {
- inline( SinkEventAttributeSet.Semantics.BOLD );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#B
- */
- @Override
- public void bold_()
- {
- inline_();
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#TT
- */
- @Override
- public void monospaced()
- {
- inline( SinkEventAttributeSet.Semantics.MONOSPACED );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#TT
- */
- @Override
- public void monospaced_()
- {
- inline_();
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#BR
- */
- @Override
- public void lineBreak()
- {
- lineBreak( null );
- }
-
- /**
- * {@inheritDoc}
- * @see javax.swing.text.html.HTML.Tag#BR
- */
- @Override
- public void lineBreak( SinkEventAttributes attributes )
- {
- if ( headFlag || isVerbatimFlag() )
- {
- getTextBuffer().append( EOL );
- }
- else
- {
- MutableAttributeSet atts = SinkUtils.filterAttributes(
- attributes, SinkUtils.SINK_BR_ATTRIBUTES );
-
- writeSimpleTag( HtmlMarkup.BR, atts );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void pageBreak()
- {
- comment( " PB " );
- }
-
- /** {@inheritDoc} */
- @Override
- public void nonBreakingSpace()
- {
- if ( headFlag )
- {
- getTextBuffer().append( ' ' );
- }
- else
- {
- write( " " );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void text( String text )
- {
- if ( headFlag )
- {
- getTextBuffer().append( text );
- }
- else if ( verbatimFlag )
- {
- verbatimContent( text );
- }
- else
- {
- content( text );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void text( String text, SinkEventAttributes attributes )
- {
- text( text );
- }
-
- /** {@inheritDoc} */
- @Override
- public void rawText( String text )
- {
- if ( headFlag )
- {
- getTextBuffer().append( text );
- }
- else
- {
- write( text );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void comment( String comment )
- {
- if ( comment != null )
- {
- final String originalComment = comment;
-
- // http://www.w3.org/TR/2000/REC-xml-20001006#sec-comments
- while ( comment.contains( "--" ) )
- {
- comment = comment.replace( "--", "- -" );
- }
-
- if ( comment.endsWith( "-" ) )
- {
- comment += " ";
- }
-
- if ( !originalComment.equals( comment ) )
- {
- LOGGER.warn( "Modified invalid comment '{}' to '{}'", originalComment, comment );
- }
-
- final StringBuilder buffer = new StringBuilder( comment.length() + 7 );
-
- buffer.append( LESS_THAN ).append( BANG ).append( MINUS ).append( MINUS );
- buffer.append( comment );
- buffer.append( MINUS ).append( MINUS ).append( GREATER_THAN );
-
- write( buffer.toString() );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * Add an unknown event.
- * This can be used to generate html tags for which no corresponding sink event exists.
- *
- * <p>
- * If {@link org.apache.maven.doxia.util.HtmlTools#getHtmlTag(String) HtmlTools.getHtmlTag( name )}
- * does not return null, the corresponding tag will be written.
- * </p>
- *
- * <p>For example, the div block</p>
- *
- * <pre>
- * <div class="detail" style="display:inline">text</div>
- * </pre>
- *
- * <p>can be generated via the following event sequence:</p>
- *
- * <pre>
- * SinkEventAttributeSet atts = new SinkEventAttributeSet();
- * atts.addAttribute( SinkEventAttributes.CLASS, "detail" );
- * atts.addAttribute( SinkEventAttributes.STYLE, "display:inline" );
- * sink.unknown( "div", new Object[]{new Integer( HtmlMarkup.TAG_TYPE_START )}, atts );
- * sink.text( "text" );
- * sink.unknown( "div", new Object[]{new Integer( HtmlMarkup.TAG_TYPE_END )}, null );
- * </pre>
- *
- * @param name the name of the event. If this is not a valid xhtml tag name
- * as defined in {@link org.apache.maven.doxia.markup.HtmlMarkup} then the event is ignored.
- * @param requiredParams If this is null or the first argument is not an Integer then the event is ignored.
- * The first argument should indicate the type of the unknown event, its integer value should be one of
- * {@link org.apache.maven.doxia.markup.HtmlMarkup#TAG_TYPE_START TAG_TYPE_START},
- * {@link org.apache.maven.doxia.markup.HtmlMarkup#TAG_TYPE_END TAG_TYPE_END},
- * {@link org.apache.maven.doxia.markup.HtmlMarkup#TAG_TYPE_SIMPLE TAG_TYPE_SIMPLE},
- * {@link org.apache.maven.doxia.markup.HtmlMarkup#ENTITY_TYPE ENTITY_TYPE}, or
- * {@link org.apache.maven.doxia.markup.HtmlMarkup#CDATA_TYPE CDATA_TYPE},
- * otherwise the event will be ignored.
- * @param attributes a set of attributes for the event. May be null.
- * The attributes will always be written, no validity check is performed.
- */
- @Override
- public void unknown( String name, Object[] requiredParams, SinkEventAttributes attributes )
- {
- if ( requiredParams == null || !( requiredParams[0] instanceof Integer ) )
- {
- LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
-
- return;
- }
-
- int tagType = (Integer) requiredParams[0];
-
- if ( tagType == ENTITY_TYPE )
- {
- rawText( name );
-
- return;
- }
-
- if ( tagType == CDATA_TYPE )
- {
- rawText( EOL + "//<![CDATA[" + requiredParams[1] + "]]>" + EOL );
-
- return;
- }
-
- Tag tag = HtmlTools.getHtmlTag( name );
-
- if ( tag == null )
- {
- LOGGER.warn( "No HTML tag found for unknown event '{}', ignoring!", name );
- }
- else
- {
- if ( tagType == TAG_TYPE_SIMPLE )
- {
- writeSimpleTag( tag, escapeAttributeValues( attributes ) );
- }
- else if ( tagType == TAG_TYPE_START )
- {
- writeStartTag( tag, escapeAttributeValues( attributes ) );
- }
- else if ( tagType == TAG_TYPE_END )
- {
- writeEndTag( tag );
- }
- else
- {
- LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
- }
- }
- }
-
- private SinkEventAttributes escapeAttributeValues( SinkEventAttributes attributes )
- {
- SinkEventAttributeSet set = new SinkEventAttributeSet( attributes.getAttributeCount() );
-
- Enumeration<?> names = attributes.getAttributeNames();
-
- while ( names.hasMoreElements() )
- {
- Object name = names.nextElement();
-
- set.addAttribute( name, escapeHTML( attributes.getAttribute( name ).toString() ) );
- }
-
- return set;
- }
-
- /** {@inheritDoc} */
- @Override
- public void flush()
- {
- writer.flush();
- }
-
- /** {@inheritDoc} */
- @Override
- public void close()
- {
- writer.close();
-
- init();
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- /**
- * Write HTML escaped text to output.
- *
- * @param text The text to write.
- */
- protected void content( String text )
- {
- // small hack due to DOXIA-314
- String txt = escapeHTML( text );
- txt = StringUtils.replace( txt, "&#", "&#" );
- write( txt );
- }
-
- /**
- * Write HTML escaped text to output.
- *
- * @param text The text to write.
- */
- protected void verbatimContent( String text )
- {
- write( escapeHTML( text ) );
- }
-
- /**
- * Forward to HtmlTools.escapeHTML( text ).
- *
- * @param text the String to escape, may be null
- * @return the text escaped, "" if null String input
- * @see org.apache.maven.doxia.util.HtmlTools#escapeHTML(String)
- */
- protected static String escapeHTML( String text )
- {
- return HtmlTools.escapeHTML( text, false );
- }
-
- /**
- * Forward to HtmlTools.encodeURL( text ).
- *
- * @param text the String to encode, may be null.
- * @return the text encoded, null if null String input.
- * @see org.apache.maven.doxia.util.HtmlTools#encodeURL(String)
- */
- protected static String encodeURL( String text )
- {
- return HtmlTools.encodeURL( text );
- }
-
- /** {@inheritDoc} */
- protected void write( String text )
- {
- if ( !this.tableCaptionXMLWriterStack.isEmpty() && this.tableCaptionXMLWriterStack.getLast() != null )
- {
- this.tableCaptionXMLWriterStack.getLast().writeMarkup( unifyEOLs( text ) );
- }
- else if ( !this.tableContentWriterStack.isEmpty() && this.tableContentWriterStack.getLast() != null )
- {
- this.tableContentWriterStack.getLast().write( unifyEOLs( text ) );
- }
- else
- {
- writer.write( unifyEOLs( text ) );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void writeStartTag( Tag t, MutableAttributeSet att, boolean isSimpleTag )
- {
- if ( this.tableCaptionXMLWriterStack.isEmpty() )
- {
- super.writeStartTag ( t, att, isSimpleTag );
- }
- else
- {
- String tag = ( getNameSpace() != null ? getNameSpace() + ":" : "" ) + t.toString();
- this.tableCaptionXMLWriterStack.getLast().startElement( tag );
-
- if ( att != null )
- {
- Enumeration<?> names = att.getAttributeNames();
- while ( names.hasMoreElements() )
- {
- Object key = names.nextElement();
- Object value = att.getAttribute( key );
-
- this.tableCaptionXMLWriterStack.getLast().addAttribute( key.toString(), value.toString() );
- }
- }
-
- if ( isSimpleTag )
- {
- this.tableCaptionXMLWriterStack.getLast().endElement();
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void writeEndTag( Tag t )
- {
- if ( this.tableCaptionXMLWriterStack.isEmpty() )
- {
- super.writeEndTag( t );
- }
- else
- {
- this.tableCaptionXMLWriterStack.getLast().endElement();
- }
- }
-}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
deleted file mode 100644
index d2f7d138..00000000
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
+++ /dev/null
@@ -1,772 +0,0 @@
-package org.apache.maven.doxia.parser;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Iterator;
-
-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.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * Test for XhtmlBaseParser.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public class XhtmlBaseParserTest
- extends AbstractParserTest
-{
- private XhtmlBaseParser parser;
- private final SinkEventTestingSink sink = new SinkEventTestingSink();
-
-
- @Override
- protected Parser createParser()
- {
- parser = new XhtmlBaseParser();
- return parser;
- }
-
- @Override
- protected String outputExtension()
- {
- return "xhtml";
- }
-
- @BeforeEach
- protected void setUp() throws Exception
- {
- parser = new XhtmlBaseParser();
- sink.reset();
- }
-
- /** @throws Exception */
- @Test
- public void testHeadingEventsList()
- throws Exception
- {
- String text = "<p><h1></h1><h2></h2><h3></h3><h4></h4><h5></h5><h1></h1></p>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "section1", it.next().getName() );
- assertEquals( "sectionTitle1", it.next().getName() );
- assertEquals( "sectionTitle1_", it.next().getName() );
- assertEquals( "section2", it.next().getName() );
- assertEquals( "sectionTitle2", it.next().getName() );
- assertEquals( "sectionTitle2_", it.next().getName() );
- assertEquals( "section3", it.next().getName() );
- assertEquals( "sectionTitle3", it.next().getName() );
- assertEquals( "sectionTitle3_", it.next().getName() );
- assertEquals( "section4", it.next().getName() );
- assertEquals( "sectionTitle4", it.next().getName() );
- assertEquals( "sectionTitle4_", it.next().getName() );
- assertEquals( "section5", it.next().getName() );
- assertEquals( "sectionTitle5", it.next().getName() );
- assertEquals( "sectionTitle5_", it.next().getName() );
- assertEquals( "section5_", it.next().getName() );
- assertEquals( "section4_", it.next().getName() );
- assertEquals( "section3_", it.next().getName() );
- assertEquals( "section2_", it.next().getName() );
- assertEquals( "section1_", it.next().getName() );
- assertEquals( "section1", it.next().getName() );
- assertEquals( "sectionTitle1", it.next().getName() );
- assertEquals( "sectionTitle1_", it.next().getName() );
- // this one is missing because we enclose everything in <p> which is not valid xhtml,
- // needs to be tested in overriding parser, eg XhtmlParser, XdocParser.
- //assertEquals( "section1_", it.next().getName() );
- assertEquals( "paragraph_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testNestedHeadingEventsList()
- throws Exception
- {
- // DOXIA-241
- String text = "<p><h1></h1><h5></h5><h2></h2></p>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "section1", it.next().getName() );
- assertEquals( "sectionTitle1", it.next().getName() );
- assertEquals( "sectionTitle1_", it.next().getName() );
-
- assertEquals( "section2", it.next().getName() );
- assertEquals( "section3", it.next().getName() );
- assertEquals( "section4", it.next().getName() );
-
- assertEquals( "section5", it.next().getName() );
- assertEquals( "sectionTitle5", it.next().getName() );
- assertEquals( "sectionTitle5_", it.next().getName() );
- assertEquals( "section5_", it.next().getName() );
-
- assertEquals( "section4_", it.next().getName() );
- assertEquals( "section3_", it.next().getName() );
- assertEquals( "section2_", it.next().getName() );
-
- assertEquals( "section2", it.next().getName() );
- assertEquals( "sectionTitle2", it.next().getName() );
- assertEquals( "sectionTitle2_", it.next().getName() );
- // these two are missing because we enclose everything in <p> which is not valid xhtml,
- // needs to be tested in overriding parser, eg XhtmlParser, XdocParser.
- //assertEquals( "section2_", it.next().getName() );
- //assertEquals( "section1_", it.next().getName() );
- assertEquals( "paragraph_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testFigureEventsList()
- throws Exception
- {
- String text = "<img src=\"source\" title=\"caption\" />";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "figureGraphics", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testTableEventsList()
- throws Exception
- {
- // TODO: table caption, see DOXIA-177
-
- String text = "<table align=\"center\"><tr><th>Header</th></tr><tr><td>cell</td></tr></table>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "table", it.next().getName() );
- assertEquals( "tableRows", it.next().getName() );
- assertEquals( "tableRow", it.next().getName() );
- assertEquals( "tableHeaderCell", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "tableHeaderCell_", it.next().getName() );
- assertEquals( "tableRow_", it.next().getName() );
- assertEquals( "tableRow", it.next().getName() );
- assertEquals( "tableCell", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "tableCell_", it.next().getName() );
- assertEquals( "tableRow_", it.next().getName() );
- assertEquals( "tableRows_", it.next().getName() );
- assertEquals( "table_", it.next().getName() );
-
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testSignificantWhiteSpace()
- throws Exception
- {
- // NOTE significant white space
- String text = "<p><b>word</b> <i>word</i></p>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "inline", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
-
- SinkEventElement el = it.next();
- assertEquals( "text", el.getName() );
- assertEquals( " ", (String) el.getArgs()[0] );
-
- assertEquals( "inline", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "paragraph_", it.next().getName() );
- assertFalse( it.hasNext() );
-
-
- // same test with EOL
- String eol = System.getProperty( "line.separator" );
- text = "<p><b>word</b>" + eol + "<i>word</i></p>";
-
- sink.reset();
- parser.parse( text, sink );
- it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "inline", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
-
- el = it.next();
- assertEquals( "text", el.getName() );
- // according to section 2.11 of the XML spec, parsers must normalize line breaks to "\n"
- assertEquals( "\n", (String) el.getArgs()[0] );
-
- assertEquals( "inline", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "paragraph_", it.next().getName() );
- assertFalse( it.hasNext() );
-
-
- // DOXIA-189: there should be no EOL after closing tag
- text = "<p>There should be no space after the last <i>word</i>.</p>";
-
- sink.reset();
- parser.parse( text, sink );
- it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
-
- el = it.next();
- assertEquals( "text", el.getName() );
- assertEquals( ".", (String) el.getArgs()[0] );
-
- assertEquals( "paragraph_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testPreFormattedText()
- throws Exception
- {
- String text = "<pre><a href=\"what.html\">what</a></pre>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
- assertEquals( "verbatim", it.next().getName() );
- assertEquals( "link", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link_", it.next().getName() );
- assertEquals( "verbatim_", it.next().getName() );
- assertFalse( it.hasNext() );
-
- text = "<pre><![CDATA[<a href=\"what.html\">what</a>]]></pre>";
- sink.reset();
- parser.parse( text, sink );
-
- it = sink.getEventList().iterator();
- assertEquals( "verbatim", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "verbatim_", it.next().getName() );
- assertFalse( it.hasNext() );
-
- text = "<pre><![CDATA[<pre>what</pre>]]></pre>";
- sink.reset();
- parser.parse( text, sink );
-
- it = sink.getEventList().iterator();
- assertEquals( "verbatim", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "verbatim_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testPreEOL()
- 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
- + "<a href=\"what.html\">what</a></pre>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "verbatim", it.next().getName() );
- assertEquals( "link", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link_", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link_", it.next().getName() );
- assertEquals( "verbatim_", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testDoxia250()
- 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( "<b>&foo;&foo1;&foo2;&tritPos;</b>" );
-
- parser.setValidate( false );
- parser.parse( sb.toString(), sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- SinkEventElement event = it.next();
- assertEquals( "inline", event.getName() );
-
- event = it.next();
- assertEquals( "text", event.getName() );
- assertEquals( "\u0159", (String) event.getArgs()[0] );
-
- event = it.next();
- assertEquals( "text", event.getName() );
- assertEquals( "\u00A0", (String) event.getArgs()[0] );
-
- event = it.next();
- assertEquals( "text", event.getName() );
- assertEquals( "\u0161", (String) event.getArgs()[0] );
-
- event = it.next();
- assertEquals( "text", event.getName() );
- assertEquals( "\uD835\uDFED", (String) event.getArgs()[0] );
-
- event = it.next();
- assertEquals( "inline_", event.getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testEntities()
- throws Exception
- {
- final String text = "<!DOCTYPE test [<!ENTITY flo \"ř\"><!ENTITY tritPos \"𝟭\"><!ENTITY fo \"A\"><!ENTITY myCustom \"&fo;\">]>"
- + "<body><h1>&&flo;ř&tritPos;𝟭</h1><p>&&flo;ř&tritPos;𝟭&myCustom;</p></body>";
-
- parser.setValidate( false );
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "section1", it.next().getName() );
- assertEquals( "sectionTitle1", it.next().getName() );
-
- SinkEventElement textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "&", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u0159", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u0159", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\uD835\uDFED", (String) textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\uD835\uDFED", textEvt.getArgs()[0] );
-
- assertEquals( "sectionTitle1_", it.next().getName() );
- assertEquals( "paragraph", it.next().getName() );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "&", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u0159", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u0159", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\uD835\uDFED", (String) textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\uD835\uDFED", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "A", textEvt.getArgs()[0] );
-
- assertEquals( "paragraph_", it.next().getName() );
-
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testXhtmlEntities()
- throws Exception
- {
- final String text = "<body><h1>«®</h1><p>“’Φ←</p></body>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "section1", it.next().getName() );
- assertEquals( "sectionTitle1", it.next().getName() );
-
- // Couple symbols from Latin-1:
- // http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Latin-1_characters
-
- SinkEventElement textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u00AB", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u00AE", textEvt.getArgs()[0] );
-
- assertEquals( "sectionTitle1_", it.next().getName() );
- assertEquals( "paragraph", it.next().getName() );
-
- // Couple symbols from Special characters:
- // http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u201C", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u2019", textEvt.getArgs()[0] );
-
- // Couple symbols from Symbols:
- // http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Symbols
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u03A6", textEvt.getArgs()[0] );
-
- textEvt = it.next();
- assertEquals( "text", textEvt.getName() );
- assertEquals( "\u2190", textEvt.getArgs()[0] );
-
- assertEquals( "paragraph_", it.next().getName() );
-
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testLists()
- throws Exception
- {
- String text = "<div><ul><li></li></ul><ol><li></li></ol><dl><dt></dt><dd></dd></dl></div>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "list", it.next().getName() );
- assertEquals( "listItem", it.next().getName() );
- assertEquals( "listItem_", it.next().getName() );
- assertEquals( "list_", it.next().getName() );
-
- assertEquals( "numberedList", it.next().getName() );
- assertEquals( "numberedListItem", it.next().getName() );
- assertEquals( "numberedListItem_", it.next().getName() );
- assertEquals( "numberedList_", it.next().getName() );
-
- assertEquals( "definitionList", it.next().getName() );
- assertEquals( "definitionListItem", it.next().getName() );
- assertEquals( "definedTerm", it.next().getName() );
- assertEquals( "definedTerm_", it.next().getName() );
- assertEquals( "definition", it.next().getName() );
- assertEquals( "definition_", it.next().getName() );
- assertEquals( "definitionListItem_", it.next().getName() );
- assertEquals( "definitionList_", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testSimpleTags()
- throws Exception
- {
- String text = "<div><br/><hr/><img src=\"img.src\"/></div>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "lineBreak", it.next().getName() );
- assertEquals( "horizontalRule", it.next().getName() );
- assertEquals( "figureGraphics", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testSemanticTags()
- throws Exception
- {
- String text = "<s><i><b><code><samp><sup><sub><u>a text & Æ</u></sub></sup></samp></code></b></i></s>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- SinkEventElement event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=line-through", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=italic", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=bold", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=code", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=code", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=superscript", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=subscript", event.getArgs()[0].toString().trim() );
-
- event = it.next();
- assertEquals( "inline", event.getName() );
- assertEquals( "semantics=annotation", event.getArgs()[0].toString().trim() );
-
- assertEquals( "text", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "text", it.next().getName() );
-
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
- assertEquals( "inline_", it.next().getName() );
-
- }
-
- /** @throws Exception */
- @Test
- public void testSpecial()
- throws Exception
- {
- String text = "<p><!-- a pagebreak: --><!-- PB -->  <unknown /></p>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "paragraph", it.next().getName() );
- assertEquals( "comment", it.next().getName() );
- assertEquals( "pageBreak", it.next().getName() );
- assertEquals( "nonBreakingSpace", it.next().getName() );
- assertEquals( "nonBreakingSpace", it.next().getName() );
- // unknown events are not reported by the base parser
- assertEquals( "paragraph_", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testTable()
- throws Exception
- {
- String text = "<table><caption></caption><tr><th></th></tr><tr><td></td></tr></table>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "table", it.next().getName() );
-
- // DOXIA-374
- SinkEventElement el = it.next();
- assertEquals( "tableRows", el.getName() );
- assertFalse( (Boolean) el.getArgs()[1] );
-
- assertEquals( "tableCaption", it.next().getName() );
- assertEquals( "tableCaption_", it.next().getName() );
- assertEquals( "tableRow", it.next().getName() );
- assertEquals( "tableHeaderCell", it.next().getName() );
- assertEquals( "tableHeaderCell_", it.next().getName() );
- assertEquals( "tableRow_", it.next().getName() );
- assertEquals( "tableRow", it.next().getName() );
- assertEquals( "tableCell", it.next().getName() );
- assertEquals( "tableCell_", it.next().getName() );
- assertEquals( "tableRow_", it.next().getName() );
- assertEquals( "tableRows_", it.next().getName() );
- assertEquals( "table_", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testFigure()
- throws Exception
- {
- String text = "<div class=\"figure\"><p><img src=\"src.jpg\"/></p><p><i></i></p></div>";
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "figure", it.next().getName() );
- assertEquals( "figureGraphics", it.next().getName() );
- assertEquals( "figureCaption", it.next().getName() );
- assertEquals( "figureCaption_", it.next().getName() );
- assertEquals( "figure_", it.next().getName() );
- }
-
- /** @throws Exception */
- @Test
- public void testAnchorLink()
- throws Exception
- {
- String text = "<div><a href=\"\"></a>" +
- "<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=\"1invalid\"></a></div>";
-
- parser.parse( text, sink );
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- SinkEventElement element = it.next();
- assertEquals( "link", element.getName() );
- assertEquals( "", element.getArgs()[0] );
- assertEquals( "link_", it.next().getName() );
-
- element = it.next();
- assertEquals( "link", element.getName() );
- assertEquals( "valid", element.getArgs()[0] );
- assertEquals( "link_", it.next().getName() );
-
- element = it.next();
- assertEquals( "link", element.getName() );
- assertEquals( "#a1invalid", element.getArgs()[0] );
- assertEquals( "link_", it.next().getName() );
-
- element = it.next();
- assertEquals( "link", element.getName() );
- assertEquals( "http://www.fo.com/index.html#1invalid", element.getArgs()[0] );
- assertEquals( "link_", it.next().getName() );
-
- element = it.next();
- assertEquals( "anchor", element.getName() );
- assertEquals( "valid", element.getArgs()[0] );
- assertEquals( "anchor_", it.next().getName() );
-
- element = it.next();
- assertEquals( "anchor", element.getName() );
- assertEquals( "a1invalid", element.getArgs()[0] );
- assertEquals( "anchor_", it.next().getName() );
-
- element = it.next();
- assertEquals( "anchor", element.getName() );
- assertEquals( "a1invalid", element.getArgs()[0] );
- assertEquals( "anchor_", it.next().getName() );
- }
-
- /**
- * Test entities in attributes.
- *
- * @throws java.lang.Exception if any.
- */
- @Test
- public void testAttributeEntities()
- throws Exception
- {
- String text = "<script type=\"text/javascript\" src=\"http://ex.com/ex.js?v=l&l=e\"></script>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- SinkEventElement event = it.next();
-
- assertEquals( "unknown", event.getName() );
- assertEquals( "script", event.getArgs()[0] );
- SinkEventAttributeSet attribs = (SinkEventAttributeSet) event.getArgs()[2];
- // ampersand should be un-escaped
- assertEquals( "http://ex.com/ex.js?v=l&l=e", attribs.getAttribute( "src" ) );
- assertEquals( "unknown", it.next().getName() );
- assertFalse( it.hasNext() );
-
- sink.reset();
- text = "<img src=\"http://ex.com/ex.jpg?v=l&l=e\" alt=\"image\"/>";
- parser.parse( text, sink );
-
- it = sink.getEventList().iterator();
- event = it.next();
- assertEquals( "figureGraphics", event.getName() );
- attribs = (SinkEventAttributeSet) event.getArgs()[1];
- // ampersand should be un-escaped
- assertEquals( "http://ex.com/ex.jpg?v=l&l=e", attribs.getAttribute( "src" ) );
- }
-
- @Test
- public void testUnbalancedDefinitionListItem() throws Exception
- {
- String text = "<body><dl><dt>key</dt><dd>value</dd></dl>" +
- "<dl><dd>value</dd></dl>" +
- "<dl><dt>key</dt></dl>" +
- "<dl></dl>" +
- "<dl><dd>value</dd><dt>key</dt></dl></body>";
-
- parser.parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
- assertSinkStartsWith( it, "definitionList", "definitionListItem", "definedTerm", "text", "definedTerm_",
- "definition", "text", "definition_", "definitionListItem_", "definitionList_" );
- assertSinkStartsWith( it, "definitionList", "definitionListItem", "definition", "text", "definition_",
- "definitionListItem_", "definitionList_" );
- assertSinkStartsWith( it, "definitionList", "definitionListItem", "definedTerm", "text", "definedTerm_",
- "definitionListItem_", "definitionList_" );
- assertSinkStartsWith( it, "definitionList", "definitionList_" );
- assertSinkEquals( it, "definitionList", "definitionListItem", "definition", "text", "definition_",
- "definitionListItem_", "definitionListItem", "definedTerm", "text", "definedTerm_",
- "definitionListItem_", "definitionList_" );
- }
-}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
deleted file mode 100644
index ece60a56..00000000
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
+++ /dev/null
@@ -1,1181 +0,0 @@
-package org.apache.maven.doxia.sink.impl;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-import javax.swing.text.html.HTML.Attribute;
-
-import org.apache.maven.doxia.markup.Markup;
-import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.sink.SinkEventAttributes;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * Test for XhtmlBaseSink.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public class XhtmlBaseSinkTest
-{
- protected static final String LS = Markup.EOL;
- private final SinkEventAttributes attributes = SinkEventAttributeSet.BOLD;
- private XhtmlBaseSink sink;
- private Writer writer;
-
- String EOL = System.lineSeparator();
-
- @BeforeEach
- public void setUp()
- {
- writer = new StringWriter();
- }
-
- @Test
- public void testSpaceAfterClosingTag()
- {
- // DOXIA-189
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.paragraph();
- sink.text( "There should be no space before the " );
- sink.inline( SinkEventAttributeSet.Semantics.ITALIC );
- sink.text( "period" );
- sink.inline_();
- sink.text( "." );
- sink.paragraph_();
- }
- finally
- {
- if ( sink != null )
- {
- sink.close();
- }
- }
-
- String actual = writer.toString();
- String expected = "<p>There should be no space before the <i>period</i>.</p>";
-
- assertEquals( expected, actual );
- }
-
- /**
- */
- @Test
- public void testNestedTables()
- {
- // DOXIA-177
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.table();
- sink.tableRows( new int[] { Sink.JUSTIFY_CENTER, Sink.JUSTIFY_LEFT }, false );
- sink.tableRow();
- sink.tableCell();
- sink.text( "cell11" );
- sink.tableCell_();
- sink.tableCell();
- sink.text( "cell12" );
- sink.tableCell_();
- sink.tableRow_();
-
- sink.tableRow();
- sink.tableCell();
- sink.table( SinkEventAttributeSet.LEFT );
- sink.tableRows( new int[] { Sink.JUSTIFY_LEFT, Sink.JUSTIFY_RIGHT }, false );
- sink.tableRow();
- sink.tableCell();
- sink.text( "nestedTable1Cell11" );
- sink.tableCell_();
- sink.tableCell();
- sink.text( "nestedTable1Cell12" );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRow();
- sink.tableCell();
-
- sink.table( SinkEventAttributeSet.RIGHT );
- sink.tableRows( new int[] { Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_CENTER }, false );
- sink.tableRow();
- sink.tableCell();
- sink.text( "nestedTable2Cell11" );
- sink.tableCell_();
- sink.tableCell();
- sink.text( "nestedTable2Cell12" );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRow();
- sink.tableCell();
- sink.text( "nestedTable2Cell21" );
- sink.tableCell_();
- sink.tableCell();
- sink.text( "nestedTable2Cell22" );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRows_();
- sink.tableCaption();
- sink.text( "caption3" );
- sink.tableCaption_();
- sink.table_();
-
- sink.tableCell_();
- sink.tableCell();
- sink.text( "nestedTable1Cell22" );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRows_();
- sink.tableCaption();
- sink.text( "caption2" );
- sink.tableCaption_();
- sink.table_();
-
- sink.tableCell_();
- sink.tableCell();
- sink.text( "cell22" );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRows_();
- sink.tableCaption();
- sink.text( "caption&1" );
- sink.tableCaption_();
- sink.table_();
- }
- finally
- {
- sink.close();
- }
-
- String actual = writer.toString();
- assertTrue(
- actual.contains( "<table border=\"0\" class=\"bodyTable\">" + "<caption>caption&1</caption>" ) );
- assertTrue( actual.contains(
- "<table border=\"0\" class=\"bodyTable\" align=\"left\">" + "<caption>caption2</caption>" ) );
- assertTrue( actual.contains(
- "<table border=\"0\" class=\"bodyTable\" align=\"right\">" + "<caption>caption3</caption>" ) );
-
- assertTrue( actual.contains( "<td align=\"center\">cell11</td>" ) );
- assertTrue( actual.contains( "<td align=\"right\">nestedTable2Cell11</td>" ) );
- assertTrue( actual.contains( "<td align=\"right\">nestedTable1Cell22</td>" ) );
- assertTrue( actual.contains( "<td align=\"left\">cell22</td>" ) );
- }
-
- /**
- * Test of section method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection()
- {
- final int level = XhtmlBaseSink.SECTION_LEVEL_1;
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section( level, attributes );
- sink.sectionTitle( level, attributes );
- sink.sectionTitle_( level );
- sink.section_( level );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\" style=\"bold\">" + LS + "<h1 style=\"bold\"></h1></div>",
- writer.toString() );
- }
-
- /**
- * Test of section method, of class XhtmlBaseSink.
- */
- @Test
- public void testSectionAttributes()
- {
- final int level = XhtmlBaseSink.SECTION_LEVEL_1;
- final SinkEventAttributeSet set = new SinkEventAttributeSet( "name", "section name", "class", "foo", "id",
- "bar" );
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section( level, set );
- sink.sectionTitle( level, null );
- sink.sectionTitle_( level );
- sink.section_( level );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"foo\" id=\"bar\">" + LS + "<h1></h1></div>", writer.toString() );
- }
-
- /**
- * Test of section1 method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection1()
- {
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section1();
- sink.sectionTitle1();
- sink.sectionTitle1_();
- sink.section1_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">" + LS + "<h1></h1></div>", writer.toString() );
- }
-
- /**
- * Test of section2 method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection2()
- {
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section2();
- sink.sectionTitle2();
- sink.sectionTitle2_();
- sink.section2_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">" + LS + "<h2></h2></div>", writer.toString() );
- }
-
- /**
- * Test of section3 method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection3()
- {
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section3();
- sink.sectionTitle3();
- sink.sectionTitle3_();
- sink.section3_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">" + LS + "<h3></h3></div>", writer.toString() );
- }
-
- /**
- * Test of section4 method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection4()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section4();
- sink.sectionTitle4();
- sink.sectionTitle4_();
- sink.section4_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">" + LS + "<h4></h4></div>", writer.toString() );
- }
-
- /**
- * Test of section5 method, of class XhtmlBaseSink.
- */
- @Test
- public void testSection5()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.section5();
- sink.sectionTitle5();
- sink.sectionTitle5_();
- sink.section5_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">" + LS + "<h5></h5></div>", writer.toString() );
- }
-
- /**
- * Test of list method, of class XhtmlBaseSink.
- */
- @Test
- public void testList()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.list();
- sink.listItem();
- sink.listItem_();
- sink.list_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<ul>" + LS + "<li></li></ul>", writer.toString() );
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.list( attributes );
- sink.listItem( attributes );
- sink.listItem_();
- sink.list_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<ul style=\"bold\">" + LS + "<li style=\"bold\"></li></ul>", writer.toString() );
- }
-
- /**
- * Test of numberedList method, of class XhtmlBaseSink.
- */
- @Test
- public void testNumberedList()
- {
- final int numbering = XhtmlBaseSink.NUMBERING_DECIMAL;
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.numberedList( numbering );
- sink.numberedListItem();
- sink.numberedListItem_();
- sink.numberedList_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<ol style=\"list-style-type: decimal\">" + LS + "<li></li></ol>", writer.toString() );
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.numberedList( numbering, attributes );
- sink.numberedListItem( attributes );
- sink.numberedListItem_();
- sink.numberedList_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<ol style=\"list-style-type: decimal\">" + LS + "<li style=\"bold\"></li></ol>",
- writer.toString() );
- }
-
- /**
- * Test of definitionList method, of class XhtmlBaseSink.
- */
- @Test
- public void testDefinitionList()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.definitionList();
- sink.definedTerm();
- sink.definedTerm_();
- sink.definition();
- sink.definition_();
- sink.definitionList_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<dl>" + LS + "<dt></dt>" + LS + "<dd></dd></dl>", writer.toString() );
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.definitionList( attributes );
- sink.definedTerm( attributes );
- sink.definedTerm_();
- sink.definition( attributes );
- sink.definition_();
- sink.definitionList_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals(
- "<dl style=\"bold\">" + LS + "<dt style=\"bold\"></dt>" + LS + "<dd style=\"bold\"></dd></dl>",
- writer.toString() );
- }
-
- /**
- * Test of figure method, of class XhtmlBaseSink.
- */
- @Test
- public void testFigure()
- {
- final String src = "src.jpg";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.figure( attributes );
- sink.figureGraphics( src, attributes );
- sink.figureCaption( attributes );
- sink.figureCaption_();
- sink.figure_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals(
- "<div style=\"bold\" class=\"figure\">" + "" + LS + "<p align=\"center\"><img src=\"src.jpg\" style=\"bold\" alt=\"\" /></p>" + "" + LS + "<p align=\"center\" style=\"bold\"><i></i></p></div>",
- writer.toString() );
- }
-
- /**
- * Test of figureGraphics method, of class XhtmlBaseSink.
- */
- @Test
- public void testFigureGraphics()
- {
- String src = "source.png";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.figureGraphics( src, attributes );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<img src=\"source.png\" style=\"bold\" alt=\"\" />", writer.toString() );
- }
-
- /**
- * Test of paragraph method, of class XhtmlBaseSink.
- */
- @Test
- public void testParagraph()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.paragraph();
- sink.paragraph_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<p></p>", writer.toString() );
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.paragraph( attributes );
- sink.paragraph_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<p style=\"bold\"></p>", writer.toString() );
- }
-
- /**
- * Test of verbatim method, of class XhtmlBaseSink.
- */
- @Test
- public void testVerbatim()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.verbatim( SinkEventAttributeSet.BOXED );
- sink.verbatim_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"source\">" + LS + "<pre></pre></div>", writer.toString() );
-
- checkVerbatimAttributes( attributes, "<div>" + LS + "<pre style=\"bold\"></pre></div>" );
-
- final SinkEventAttributes att =
- new SinkEventAttributeSet( SinkEventAttributes.ID, "id" );
- checkVerbatimAttributes( att, "<div>" + LS + "<pre id=\"id\"></pre></div>" );
-
- att.addAttribute( Attribute.CLASS, "class" );
- checkVerbatimAttributes( att, "<div>" + LS + "<pre id=\"id\" class=\"class\"></pre></div>" );
-
- att.addAttribute( SinkEventAttributes.DECORATION, "boxed" );
- checkVerbatimAttributes( att, "<div class=\"source\">" + LS + "<pre id=\"id\" class=\"class\"></pre></div>" );
-
- att.removeAttribute( Attribute.CLASS.toString() );
- checkVerbatimAttributes( att, "<div class=\"source\">" + LS + "<pre id=\"id\"></pre></div>" );
- }
-
- private void checkVerbatimAttributes( final SinkEventAttributes att, final String expected )
- {
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.verbatim( att );
- sink.verbatim_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( expected, writer.toString() );
- }
-
- /**
- * Test of horizontalRule method, of class XhtmlBaseSink.
- */
- @Test
- public void testHorizontalRule()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.horizontalRule();
- sink.horizontalRule( attributes );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<hr /><hr style=\"bold\" />", writer.toString() );
- }
-
- /**
- * Test of table method, of class XhtmlBaseSink.
- */
- @Test
- public void testTable()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.table( attributes );
- sink.table_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "</table>", writer.toString() );
- }
-
- /**
- * Test of tableRows method, of class XhtmlBaseSink.
- */
- @Test
- public void testTableRows()
- {
- final int[] justification = null;
- final boolean grid = false;
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.tableRows( justification, grid );
- sink.tableRows_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<table border=\"0\" class=\"bodyTable\">", writer.toString() );
- }
-
- /**
- * Test of tableRow method, of class XhtmlBaseSink.
- */
- @Test
- public void testTableRow()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.tableRows( null, false );
- sink.tableRow( attributes );
- sink.tableRow_();
- sink.tableRow();
- sink.tableRow_();
- sink.tableRows_();
- sink.table_();
- }
- finally
- {
- sink.close();
- }
-
- String xmlExpected = "<table border=\"0\" class=\"bodyTable\">" + EOL + "<tr style=\"bold\" class=\"a\"></tr>"
- + EOL + "<tr class=\"b\"></tr></table>";
-
- assertEquals( xmlExpected, writer.toString() );
- }
-
- /**
- * Test striping for hidden rows in tableRow method.
- */
- @Test
- public void testHiddenTableRowStriping()
- {
- try
- {
- SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
- SinkEventAttributeSet attributes3 = new SinkEventAttributeSet();
- attributes3.addAttributes( attributes );
- sink = new XhtmlBaseSink( writer );
-
- sink.tableRow();
- sink.tableRow_();
- sink.tableRow( attributes );
- sink.tableRow_();
- attributes2.addAttribute( SinkEventAttributes.CLASS, "hidden xyz abc" );
- sink.tableRow( attributes2 );
- sink.tableRow_();
- attributes2.addAttribute( SinkEventAttributes.CLASS, "abc hidden xyz" );
- sink.tableRow( attributes2 );
- sink.tableRow_();
- sink.tableRow();
- sink.tableRow_();
- attributes2.addAttribute( SinkEventAttributes.CLASS, "not-hidden xyz" );
- sink.tableRow( attributes2 );
- sink.tableRow_();
- attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz not-hidden" );
- sink.tableRow( attributes2 );
- sink.tableRow_();
- attributes3.addAttribute( SinkEventAttributes.CLASS, "xyz abc hidden" );
- sink.tableRow( attributes3 );
- sink.tableRow_();
- attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz hidden-not" );
- sink.tableRow( attributes2 );
- sink.tableRow_();
- sink.tableRow();
- sink.tableRow_();
- }
- finally
- {
- sink.close();
- }
-
- StringBuilder sbExpeted = new StringBuilder( "<table border=\"0\" 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 );
- sbExpeted.append( "<tr class=\"abc hidden xyz a\"></tr>" ).append( EOL );
- sbExpeted.append( "<tr class=\"a\"></tr>" ).append( EOL );
- sbExpeted.append( "<tr class=\"not-hidden xyz b\"></tr>" ).append( EOL );
- 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>" );
-
- String xmlExpected = sbExpeted.toString();
- assertEquals( xmlExpected, writer.toString() );
- }
-
- /**
- * Test of tableCell method, of class XhtmlBaseSink.
- */
- @Test
- public void testTableCell()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.tableCell( attributes );
- sink.tableCell_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<td style=\"bold\"></td>", writer.toString() );
- }
-
- /**
- * Test of tableHeaderCell method, of class XhtmlBaseSink.
- */
- @Test
- public void testTableHeaderCell()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.tableHeaderCell( attributes );
- sink.tableHeaderCell_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<th style=\"bold\"></th>", writer.toString() );
- }
-
- /**
- * Test of tableCaption method, of class XhtmlBaseSink.
- */
- @Test
- public void testTableCaption()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.table();
- sink.tableRows( null, false );
- sink.tableCaption( attributes );
- sink.text( "caption" );
- sink.tableCaption_();
- sink.tableRows_();
- sink.table_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals(
- "<table border=\"0\" class=\"bodyTable\">" + "<caption style=\"bold\">caption</caption></table>",
- writer.toString() );
- }
-
- /**
- * Test of anchor method, of class XhtmlBaseSink.
- */
- @Test
- public void testAnchor()
- {
- String name = "anchor";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.anchor( name, attributes );
- sink.anchor_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<a name=\"anchor\" style=\"bold\"></a>", writer.toString() );
- }
-
- /**
- * Test of link method, of class XhtmlBaseSink.
- */
- @Test
- public void testLink()
- {
- final String name = "link.html";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.link( name, attributes );
- sink.link_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<a style=\"bold\" href=\"link.html\"></a>", writer.toString() );
- }
-
- /**
- * Test of link method for an external link.
- */
- @Test
- public void testLinkExternal()
- {
- final String name = "https://www.apache.org";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.link( name, attributes );
- sink.link_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<a style=\"bold\" class=\"externalLink\" href=\"https://www.apache.org\"></a>",
- writer.toString() );
- }
-
- /**
- * Test of link method for an external link when a css class is provided.
- */
- @Test
- public void testLinkExternalClassExtend()
- {
- final String name = "https://www.apache.org";
- SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
- attributes2.addAttributes( attributes );
- attributes2.addAttribute( SinkEventAttributes.CLASS, "cs1 cs2" );
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.link( name, attributes2 );
- sink.link_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<a style=\"bold\" class=\"cs1 cs2 externalLink\" href=\"https://www.apache.org\"></a>",
- writer.toString() );
- }
-
- /**
- * Test of italic/bold/monospaced method, of class XhtmlBaseSink.
- */
- @Test
- public void testItalic()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.inline( SinkEventAttributeSet.Semantics.ITALIC );
- sink.inline_();
- sink.inline( SinkEventAttributeSet.Semantics.BOLD );
- sink.inline_();
- sink.inline( SinkEventAttributeSet.Semantics.MONOSPACED );
- sink.inline_();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<i></i><b></b><tt></tt>", writer.toString() );
- }
-
- /**
- * Test of lineBreak/pageBreak/nonBreakingSpace method, of class XhtmlBaseSink.
- */
- @Test
- public void testLineBreak()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.lineBreak( attributes );
- sink.pageBreak();
- sink.nonBreakingSpace();
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<br style=\"bold\" /><!-- PB --> ", writer.toString() );
- }
-
- /**
- * Test of text method, of class XhtmlBaseSink.
- */
- @Test
- public void testText()
- {
- String text = "a text & \u00c6";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.text( text );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "a text & Æ", writer.toString() );
-
- writer = new StringWriter();
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.text( text, attributes );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "a text & Æ", writer.toString() );
- }
-
- /**
- * Test of rawText method, of class XhtmlBaseSink.
- */
- @Test
- public void testRawText()
- {
- String text = "raw text";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.rawText( text );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "raw text", writer.toString() );
- }
-
- /**
- * Test of comment method, of class XhtmlBaseSink.
- */
- @Test
- public void testComment()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.comment( "a comment" );
- sink.comment( " a comment" );
- sink.comment( "a comment " );
- sink.comment( " a comment " );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<!--a comment--><!-- a comment--><!--a comment --><!-- a comment -->",
- writer.toString() );
- }
-
- /**
- * Test of unknown method, of class XhtmlBaseSink.
- */
- @Test
- public void testUnknown()
- {
- final String name = "unknown";
- final Object[] requiredParams = null;
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.unknown( name, requiredParams, attributes );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "", writer.toString() );
- }
-
- /**
- * Test entities in attribute values.
- */
- @Test
- public void testAttributeEntities()
- {
- final Object[] startTag = new Object[] { XhtmlBaseSink.TAG_TYPE_START };
- final Object[] endTag = new Object[] { XhtmlBaseSink.TAG_TYPE_END };
- final String script = XhtmlBaseSink.SCRIPT.toString();
- final SinkEventAttributes src = new SinkEventAttributeSet( SinkEventAttributes.SRC,
- "http://ex.com/ex.js?v=l&l=e" );
-
- try
- {
- sink = new XhtmlBaseSink( writer );
-
- sink.unknown( script, startTag, src );
- sink.unknown( script, endTag, null );
-
- sink.figureGraphics( "http://ex.com/ex.jpg?v=l&l=e", src );
- }
- finally
- {
- sink.close();
- }
-
- String result = writer.toString();
-
- assertTrue( result.contains( "ex.js?v=l&l=e" ) );
- assertTrue( result.contains( "ex.jpg?v=l&l=e" ) );
- }
-
- /**
- * Test of entity.
- */
- @Test
- public void testEntity()
- {
- // DOXIA-314
- String text = "a text '𝟭'";
-
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.text( text );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "a text '𝟭'", writer.toString() );
- }
-
- /**
- * Test unicode chracters in tables. DOXIA-433.
- */
- @Test
- public void testSpecialCharacters()
- {
- try
- {
- sink = new XhtmlBaseSink( writer );
- sink.table( null );
- sink.tableRows( null, true );
- sink.tableRow( null );
- sink.tableCell();
- sink.text( "\u2713", null );
- sink.tableCell_();
- sink.tableRow_();
- sink.tableRows_();
- sink.table_();
- }
- finally
- {
- sink.close();
- }
-
- final String result = writer.toString();
-
- assertTrue( result.contains( "✓" ) );
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/pom.xml b/doxia-modules/doxia-module-xhtml/pom.xml
deleted file mode 100644
index 4bb9be60..00000000
--- a/doxia-modules/doxia-module-xhtml/pom.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>doxia-modules</artifactId>
- <groupId>org.apache.maven.doxia</groupId>
- <version>2.0.0-M4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>doxia-module-xhtml</artifactId>
-
- <name>Doxia :: XHTML Module</name>
- <description>
- A Doxia module for Xhtml source documents.
- Xhtml format is supported both as source and target formats.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <classifier>no_aop</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.xmlunit</groupId>
- <artifactId>xmlunit-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.xmlunit</groupId>
- <artifactId>xmlunit-matchers</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-testing</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <scm>
- <tag>doxia-2.0.0-M3</tag>
- </scm>
-</project>
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/AbstractXhtmlSink.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/AbstractXhtmlSink.java
deleted file mode 100644
index 6649327b..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/AbstractXhtmlSink.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.doxia.sink.impl.SinkAdapter;
-
-/**
- * <p>Abstract AbstractXhtmlSink class.</p>
- *
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @since 1.0
- */
-@Deprecated
-public abstract class AbstractXhtmlSink
- extends SinkAdapter
-{
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlMarkup.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlMarkup.java
deleted file mode 100644
index 55553cf0..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlMarkup.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.doxia.markup.HtmlMarkup;
-
-/**
- * List of <code>Xhtml</code> markups.
- * <br>
- * Xhtml uses all {@link javax.swing.text.html.HTML.Tag} and {@link javax.swing.text.html.HTML.Attribute}
- * as markups.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.0
- */
-@SuppressWarnings( "checkstyle:interfaceistype" )
-@Deprecated
-public interface XhtmlMarkup
- extends HtmlMarkup
-{
- /** XHTML namespace: "http://www.w3.org/1999/xhtml" */
- String XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
-
- /** XHTML 1.0 transitional public id: "-//W3C//DTD XHTML 1.0 Transitional//EN" */
- String XHTML_TRANSITIONAL_PUBLIC_ID = "-//W3C//DTD XHTML 1.0 Transitional//EN";
-
- /** XHTML 1.0 transitional system id: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" */
- String XHTML_TRANSITIONAL_SYSTEM_ID = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
deleted file mode 100644
index 92bc8dd8..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import javax.swing.text.html.HTML.Attribute;
-
-import org.apache.maven.doxia.macro.MacroExecutionException;
-import org.apache.maven.doxia.macro.manager.MacroNotFoundException;
-import org.apache.maven.doxia.macro.MacroRequest;
-import org.apache.maven.doxia.parser.ParseException;
-import org.apache.maven.doxia.parser.XhtmlBaseParser;
-import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParser;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Parse an xhtml model and emit events into a Doxia Sink.
- *
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @since 1.0
- */
-@Singleton
-@Named( "xhtml4" )
-@Deprecated
-public class XhtmlParser
- extends XhtmlBaseParser
- implements XhtmlMarkup
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlParser.class );
-
- /** For boxed verbatim. */
- protected boolean boxed;
-
- /** Empty elements don't write a closing tag. */
- private boolean isEmptyElement;
-
- /**
- * The source content of the input reader. Used to pass into macros.
- */
- private String sourceContent;
-
- /** {@inheritDoc} */
- protected void handleStartTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException
- {
- isEmptyElement = parser.isEmptyElementTag();
-
- SinkEventAttributeSet attribs = getAttributesFromParser( parser );
-
- if ( parser.getName().equals( HTML.toString() ) )
- {
- //Do nothing
- return;
- }
- else if ( parser.getName().equals( HEAD.toString() ) )
- {
- sink.head( attribs );
- }
- else if ( parser.getName().equals( TITLE.toString() ) )
- {
- sink.title( attribs );
- }
- else if ( parser.getName().equals( META.toString() ) )
- {
- String name = parser.getAttributeValue( null, Attribute.NAME.toString() );
- String content = parser.getAttributeValue( null, Attribute.CONTENT.toString() );
-
- if ( "author".equals( name ) )
- {
- sink.author( null );
-
- sink.text( content );
-
- sink.author_();
- }
- else if ( "date".equals( name ) )
- {
- sink.date( null );
-
- sink.text( content );
-
- sink.date_();
- }
- else
- {
- sink.unknown( "meta", new Object[] { TAG_TYPE_SIMPLE }, attribs );
- }
- }
- /*
- * The ADDRESS element may be used by authors to supply contact information
- * for a model or a major part of a model such as a form. This element
- * often appears at the beginning or end of a model.
- */
- else if ( parser.getName().equals( ADDRESS.toString() ) )
- {
- sink.address( attribs );
- }
- else if ( parser.getName().equals( BODY.toString() ) )
- {
- sink.body( attribs );
- }
- else if ( parser.getName().equals( DIV.toString() ) )
- {
- String divclass = parser.getAttributeValue( null, Attribute.CLASS.toString() );
-
- if ( "source".equals( divclass ) )
- {
- this.boxed = true;
- }
-
- baseStartTag( parser, sink ); // pick up other divs
- }
- /*
- * The PRE element tells visual user agents that the enclosed text is
- * "preformatted". When handling preformatted text, visual user agents:
- * - May leave white space intact.
- * - May render text with a fixed-pitch font.
- * - May disable automatic word wrap.
- * - Must not disable bidirectional processing.
- * Non-visual user agents are not required to respect extra white space
- * in the content of a PRE element.
- */
- else if ( parser.getName().equals( PRE.toString() ) )
- {
- if ( boxed )
- {
- attribs.addAttributes( SinkEventAttributeSet.BOXED );
- }
-
- verbatim();
-
- sink.verbatim( attribs );
- }
- else if ( !baseStartTag( parser, sink ) )
- {
- if ( isEmptyElement )
- {
- handleUnknown( parser, sink, TAG_TYPE_SIMPLE );
- }
- else
- {
- handleUnknown( parser, sink, TAG_TYPE_START );
- }
-
- LOGGER.warn( "Unrecognized xhtml tag <{}> at [{}:{}]", parser.getName(),
- parser.getLineNumber(), parser.getColumnNumber() );
- }
- }
-
- /** {@inheritDoc} */
- protected void handleEndTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException
- {
- if ( parser.getName().equals( HTML.toString() ) )
- {
- //Do nothing
- return;
- }
- else if ( parser.getName().equals( HEAD.toString() ) )
- {
- sink.head_();
- }
- else if ( parser.getName().equals( TITLE.toString() ) )
- {
- sink.title_();
- }
- else if ( parser.getName().equals( BODY.toString() ) )
- {
- consecutiveSections( 0, sink );
-
- sink.body_();
- }
- else if ( parser.getName().equals( ADDRESS.toString() ) )
- {
- sink.address_();
- }
- else if ( parser.getName().equals( DIV.toString() ) )
- {
- this.boxed = false;
- baseEndTag( parser, sink );
- }
- else if ( !baseEndTag( parser, sink ) )
- {
- if ( !isEmptyElement )
- {
- handleUnknown( parser, sink, TAG_TYPE_END );
- }
- }
-
- isEmptyElement = false;
- }
-
- /** {@inheritDoc} */
- @Override
- protected void handleComment( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser ).trim();
-
- if ( text.startsWith( "MACRO" ) && !isSecondParsing() )
- {
- processMacro( parser, text, sink );
- }
- else
- {
- super.handleComment( parser, sink );
- }
- }
-
- /** process macro embedded in XHTML commment */
- private void processMacro( XmlPullParser parser, String text, Sink sink )
- throws XmlPullParserException
- {
- String s = text.substring( text.indexOf( '{' ) + 1, text.indexOf( '}' ) );
- s = escapeForMacro( s );
- String[] params = StringUtils.split( s, "|" );
- String macroName = params[0];
-
- Map<String, Object> parameters = new HashMap<>();
- for ( int i = 1; i < params.length; i++ )
- {
- String[] param = StringUtils.split( params[i], "=" );
- if ( param.length == 1 )
- {
- throw new XmlPullParserException( "Invalid 'key=value' pair for macro " + macroName + " parameter: "
- + params[i], parser, null );
- }
-
- String key = unescapeForMacro( param[0] );
- String value = unescapeForMacro( param[1] );
- parameters.put( key, value );
- }
-
- MacroRequest request = new MacroRequest( sourceContent, new XhtmlParser(), parameters, getBasedir() );
-
- try
- {
- executeMacro( macroName, request, sink );
- }
- catch ( MacroExecutionException e )
- {
- throw new XmlPullParserException( "Unable to execute macro in the document: " + macroName, parser, e );
- }
- catch ( MacroNotFoundException me )
- {
- throw new XmlPullParserException( "Macro not found: " + macroName, parser, null );
- }
- }
-
- /**
- * escapeForMacro
- *
- * @param s String
- * @return String
- */
- private String escapeForMacro( String s )
- {
- if ( s == null || s.length() < 1 )
- {
- return s;
- }
-
- String result = s;
-
- // use some outrageously out-of-place chars for text
- // (these are device control one/two in unicode)
- result = StringUtils.replace( result, "\\=", "\u0011" );
- result = StringUtils.replace( result, "\\|", "\u0012" );
-
- return result;
- }
-
- /**
- * unescapeForMacro
- *
- * @param s String
- * @return String
- */
- private String unescapeForMacro( String s )
- {
- if ( s == null || s.length() < 1 )
- {
- return s;
- }
-
- String result = s;
-
- result = StringUtils.replace( result, "\u0011", "=" );
- result = StringUtils.replace( result, "\u0012", "|" );
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void init()
- {
- super.init();
-
- this.boxed = false;
- this.isEmptyElement = false;
- }
-
- /** {@inheritDoc} */
- public void parse( Reader source, Sink sink, String reference )
- throws ParseException
- {
- this.sourceContent = null;
-
- try
- {
- StringWriter contentWriter = new StringWriter();
- IOUtil.copy( source, contentWriter );
- sourceContent = contentWriter.toString();
- }
- catch ( IOException ex )
- {
- throw new ParseException( "Error reading the input source", ex );
- }
- finally
- {
- IOUtil.close( source );
- }
-
- try
- {
- super.parse( new StringReader( sourceContent ), sink, reference );
- }
- finally
- {
- this.sourceContent = null;
- }
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParserModule.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParserModule.java
deleted file mode 100644
index 92922b0a..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParserModule.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.apache.maven.doxia.parser.module.AbstractParserModule;
-
-/**
- * <p>XhtmlParserModule class.</p>
- *
- * @since 1.6
- */
-@Singleton
-@Named( "xhtml4" )
-@Deprecated
-public class XhtmlParserModule
- extends AbstractParserModule
-{
- /**
- * Default constructor.
- */
- public XhtmlParserModule()
- {
- super( "xhtml4" );
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
deleted file mode 100644
index 4580b74a..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Writer;
-
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.html.HTML.Attribute;
-
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
-import org.apache.maven.doxia.util.HtmlTools;
-
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * <a href="http://www.w3.org/TR/xhtml1/">Xhtml 1.0 Transitional</a> sink implementation.
- * <br>
- * It uses the DTD/xhtml1-transitional <a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- * http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>.
- *
- * @author Jason van Zyl
- * @author ltheussl
- * @since 1.0
- */
-@Deprecated
-public class XhtmlSink
- extends XhtmlBaseSink
- implements XhtmlMarkup
-{
- // ----------------------------------------------------------------------
- // Instance fields
- // ----------------------------------------------------------------------
-
- private String encoding;
-
- private String languageId;
-
- /** An indication on if we're inside a head title. */
- private boolean headTitleFlag;
-
- // ----------------------------------------------------------------------
- // Constructors
- // ----------------------------------------------------------------------
-
- /**
- * Constructor, initialize the Writer.
- *
- * @param writer not null writer to write the result.
- */
- protected XhtmlSink( Writer writer )
- {
- super( writer );
- }
-
- /**
- * Constructor, initialize the Writer and tells which encoding is used.
- *
- * @param writer not null writer to write the result.
- * @param encoding the encoding used, that should be written to the generated HTML content
- * if not <code>null</code>.
- */
- protected XhtmlSink( Writer writer, String encoding )
- {
- super( writer );
-
- this.encoding = encoding;
- }
-
- /**
- * Constructor, initialize the Writer and tells which encoding and languageId are used.
- *
- * @param writer not null writer to write the result.
- * @param encoding the encoding used, that should be written to the generated HTML content
- * if not <code>null</code>.
- * @param languageId language identifier for the root element as defined by
- * <a href="ftp://ftp.isi.edu/in-notes/bcp/bcp47.txt">IETF BCP 47</a>, Tags for the Identification of Languages;
- * in addition, the empty string may be specified.
- */
- protected XhtmlSink( Writer writer, String encoding, String languageId )
- {
- this( writer, encoding );
-
- this.languageId = languageId;
- }
-
- /**
- * {@inheritDoc}
- */
- public void head()
- {
- init();
-
- setHeadFlag( true );
-
- write( "<!DOCTYPE html PUBLIC \"" + XHTML_TRANSITIONAL_PUBLIC_ID + "\" \"" + XHTML_TRANSITIONAL_SYSTEM_ID
- + "\">" );
-
- MutableAttributeSet atts = new SinkEventAttributeSet();
- atts.addAttribute( "xmlns", XHTML_NAMESPACE );
-
- if ( languageId != null )
- {
- atts.addAttribute( Attribute.LANG.toString(), languageId );
- atts.addAttribute( "xml:lang", languageId );
- }
-
- writeStartTag( HTML, atts );
-
- writeStartTag( HEAD );
- }
-
- /**
- * {@inheritDoc}
- */
- public void head_()
- {
- if ( !isHeadTitleFlag() )
- {
- // The content of element type "head" must match
- // "((script|style|meta|link|object|isindex)*,
- // ((title,(script|style|meta|link|object|isindex)*,
- // (base,(script|style|meta|link|object|isindex)*)?)|(base,(script|style|meta|link|object|isindex)*,
- // (title,(script|style|meta|link|object|isindex)*))))"
- writeStartTag( TITLE );
- writeEndTag( TITLE );
- }
-
- setHeadFlag( false );
- setHeadTitleFlag( false );
-
- if ( encoding != null )
- {
- write( "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + encoding + "\"/>" );
- }
-
- writeEndTag( HEAD );
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#TITLE
- */
- public void title()
- {
- setHeadTitleFlag( true );
-
- writeStartTag( TITLE );
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#TITLE
- */
- public void title_()
- {
- content( getTextBuffer().toString() );
-
- writeEndTag( TITLE );
-
- resetTextBuffer();
-
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#META
- */
- public void author_()
- {
- if ( getTextBuffer().length() > 0 )
- {
- MutableAttributeSet att = new SinkEventAttributeSet();
- att.addAttribute( Attribute.NAME, "author" );
- String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
- // hack: un-escape numerical entities that have been escaped above
- // note that numerical entities should really be added as one unicode character in the first place
- text = StringUtils.replace( text, "&#", "&#" );
- att.addAttribute( Attribute.CONTENT, text );
-
- writeSimpleTag( META, att );
-
- resetTextBuffer();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#META
- */
- public void date_()
- {
- if ( getTextBuffer().length() > 0 )
- {
- MutableAttributeSet att = new SinkEventAttributeSet();
- att.addAttribute( Attribute.NAME, "date" );
- att.addAttribute( Attribute.CONTENT, getTextBuffer().toString() );
-
- writeSimpleTag( META, att );
-
- resetTextBuffer();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#BODY
- */
- public void body()
- {
- writeStartTag( BODY );
- }
-
- /**
- * {@inheritDoc}
- *
- * @see javax.swing.text.html.HTML.Tag#BODY
- * @see javax.swing.text.html.HTML.Tag#HTML
- */
- public void body_()
- {
- writeEndTag( BODY );
-
- writeEndTag( HTML );
-
- flush();
-
- init();
- }
-
- // ----------------------------------------------------------------------
- // Public protected methods
- // ----------------------------------------------------------------------
-
- /**
- * <p>Setter for the field <code>headTitleFlag</code>.</p>
- *
- * @param headTitleFlag an header title flag.
- * @since 1.1
- */
- protected void setHeadTitleFlag( boolean headTitleFlag )
- {
- this.headTitleFlag = headTitleFlag;
- }
-
- /**
- * <p>isHeadTitleFlag.</p>
- *
- * @return the current headTitleFlag.
- * @since 1.1
- */
- protected boolean isHeadTitleFlag()
- {
- return this.headTitleFlag ;
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkFactory.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkFactory.java
deleted file mode 100644
index 31dbd709..00000000
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import java.io.Writer;
-
-import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.sink.impl.AbstractXmlSinkFactory;
-
-/**
- * Xhtml implementation of the Sink factory.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.0
- */
-@Singleton
-@Named( "xhtml4" )
-@Deprecated
-public class XhtmlSinkFactory
- extends AbstractXmlSinkFactory
-{
- /** {@inheritDoc} */
- protected Sink createSink( Writer writer, String encoding )
- {
- return new XhtmlSink( writer, encoding );
- }
-
- /** {@inheritDoc} */
- protected Sink createSink( Writer writer, String encoding, String languageId )
- {
- return new XhtmlSink( writer, encoding, languageId );
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/site/site.xml b/doxia-modules/doxia-module-xhtml/src/site/site.xml
deleted file mode 100644
index 54cb754e..00000000
--- a/doxia-modules/doxia-module-xhtml/src/site/site.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- -->
-
-<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="Xhtml4">
-
- <body>
-
- <menu ref="parent"/>
-
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="reports"/>
-
- </body>
-
-</project>
diff --git a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java
deleted file mode 100644
index 9ac0e28f..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Writer;
-
-import org.apache.maven.doxia.module.AbstractIdentityTest;
-import org.apache.maven.doxia.parser.Parser;
-import org.apache.maven.doxia.sink.Sink;
-import org.codehaus.plexus.util.StringUtils;
-import org.junit.jupiter.api.BeforeEach;
-
-/**
- * Check that piping a full model through an XhtmlParser and an XhtmlSink
- * leaves the model unchanged.
- */
-@Deprecated
-public class XhtmlIdentityTest
- extends AbstractIdentityTest
-{
- /** {@inheritDoc} */
- @BeforeEach
- protected void setUp()
- throws Exception
- {
- assertIdentity( true );
- }
-
- /** {@inheritDoc} */
- protected Sink createSink( Writer writer )
- {
- XhtmlSink sink = new XhtmlSink( writer );
- sink.setInsertNewline( false );
- return sink;
- }
-
- /** {@inheritDoc} */
- protected Parser createParser()
- {
- return new XhtmlParser();
- }
-
- /** {@inheritDoc} */
- protected String getExpected()
- {
- // DOXIA-177
- String expected = super.getExpected();
-
- String startCaption = "begin:tableCaption";
- String endCaption = "end:tableCaption";
-
- int iStartCaption = expected.indexOf( startCaption );
- int iEndCaption = expected.indexOf( endCaption ) + endCaption.length();
-
- String captionTag = expected.substring( iStartCaption, iEndCaption ) + EOL + EOL + EOL;
- expected = StringUtils.replace( expected, captionTag, "" );
-
- int iStartTableRows =
- expected.substring( 0, iStartCaption ).lastIndexOf( "begin:tableRows" ) + "begin:tableRows".length();
-
- StringBuilder text = new StringBuilder();
- text.append( expected, 0, iStartTableRows );
- text.append( EOL ).append( EOL ).append( EOL );
- text.append( captionTag.subSequence( 0, captionTag.indexOf( "end:tableCaption" )
- + "end:tableCaption".length() ) );
- text.append( expected.substring( iStartTableRows ) );
-
- return text.toString();
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java
deleted file mode 100644
index 77c6bba5..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Iterator;
-import java.util.regex.Pattern;
-
-import org.apache.maven.doxia.parser.AbstractParserTest;
-import org.apache.maven.doxia.parser.Parser;
-import org.apache.maven.doxia.sink.impl.SinkEventElement;
-import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-
-/**
- * @author <a href="mailto:lars@trieloff.net">Lars Trieloff</a>
- */
-@Deprecated
-public class XhtmlParserTest
- extends AbstractParserTest
-{
- @Inject
- private XhtmlParser parser;
-
- /** {@inheritDoc} */
- @BeforeEach
- protected void setUp()
- throws Exception
- {
- // AbstractXmlParser.CachedFileEntityResolver downloads DTD/XSD files in ${java.io.tmpdir}
- // Be sure to delete them
- String tmpDir = System.getProperty( "java.io.tmpdir" );
-
- // Using FileFilter, because is it is much faster then FileUtils.listFiles
- File[] tmpFiles = new File( tmpDir ).listFiles( new FileFilter()
- {
- Pattern xsdPatterns = Pattern.compile( "(xhtml-lat1.ent|xhtml1-transitional.dtd|xhtml-special.ent|xhtml-symbol.ent)" );
-
- @Override
- public boolean accept( File pathname )
- {
- return xsdPatterns.matcher( pathname.getName() ).matches();
- }
- } );
-
- for ( File tmpFile : tmpFiles )
- {
- tmpFile.delete();
- }
-
- }
-
- /** {@inheritDoc} */
- protected Parser createParser()
- {
- return parser;
- }
-
- /** {@inheritDoc} */
- protected String outputExtension()
- {
- return "xhtml4";
- }
-
- /** @throws Exception */
- @Test
- public void testDocumentBodyEventsList()
- throws Exception
- {
- String text = "<html><body></body></html>";
-
- SinkEventTestingSink sink = new SinkEventTestingSink();
-
- ( (XhtmlParser) createParser() ).parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "body", it.next().getName() );
- assertEquals( "body_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testHeadEventsList()
- throws Exception
- {
- String text = "<head><title>Title</title><meta name=\"author\" content=\"Author\" />"
- + "<meta name=\"date\" content=\"Date\" /><meta name=\"security\" content=\"low\"/></head>";
-
- SinkEventTestingSink sink = new SinkEventTestingSink();
-
- ( (XhtmlParser) createParser() ).parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "head", it.next().getName() );
- assertEquals( "title", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "title_", it.next().getName() );
- assertEquals( "author", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "author_", it.next().getName() );
- assertEquals( "date", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "date_", it.next().getName() );
- assertEquals( "unknown", it.next().getName() );
- assertEquals( "head_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testPreEventsList()
- throws Exception
- {
- String text = "<pre></pre>";
-
- SinkEventTestingSink sink = new SinkEventTestingSink();
-
- ( (XhtmlParser) createParser() ).parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "verbatim", it.next().getName() );
- assertEquals( "verbatim_", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /**
- * Test unknown tags.
- *
- * @throws java.lang.Exception if any.
- */
- @Test
- public void testUnknown()
- throws Exception
- {
- String text = "<applet><param name=\"name\" value=\"value\"/><unknown/></applet>";
-
- SinkEventTestingSink sink = new SinkEventTestingSink();
-
- ( (XhtmlParser) createParser() ).parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
- assertEquals( "unknown", it.next().getName() );
- assertEquals( "unknown", it.next().getName() );
- assertEquals( "unknown", it.next().getName() );
- assertEquals( "unknown", it.next().getName() );
- assertFalse( it.hasNext() );
- }
-
- /** @throws Exception */
- @Test
- public void testTocMacro()
- throws Exception
- {
- String text = "<html><body>" +
- "<!-- MACRO{toc|fromDepth=1|toDepth=2} -->" +
- "<h1>heading 1</h1><h2>heading 2</h2><h3>heading 3</h3>" +
- "</body></html>";
-
- SinkEventTestingSink sink = new SinkEventTestingSink();
-
- ( (XhtmlParser) createParser() ).parse( text, sink );
-
- Iterator<SinkEventElement> it = sink.getEventList().iterator();
-
- assertEquals( "body", it.next().getName() );
- assertEquals( "list", it.next().getName() );
- assertEquals( "listItem", it.next().getName() );
- assertEquals( "link", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link_", it.next().getName() );
- assertEquals( "list", it.next().getName() );
- assertEquals( "listItem", it.next().getName() );
- assertEquals( "link", it.next().getName() );
- assertEquals( "text", it.next().getName() );
- assertEquals( "link_", it.next().getName() );
- assertEquals( "listItem_", it.next().getName() );
- assertEquals( "list_", it.next().getName() );
- assertEquals( "listItem_", it.next().getName() );
- assertEquals( "list_", it.next().getName() );
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
deleted file mode 100644
index 4fac9974..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.apache.maven.doxia.markup.HtmlMarkup;
-import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.sink.impl.AbstractSinkTest;
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.maven.doxia.util.HtmlTools.escapeHTML;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * @author Jason van Zyl
- * @since 1.0
- */
-@Deprecated
-public class XhtmlSinkTest
- extends AbstractSinkTest
-{
- /** {@inheritDoc} */
- protected String outputExtension()
- {
- return "xhtml4";
- }
-
- /** {@inheritDoc} */
- protected Sink createSink( Writer writer )
- {
- return new XhtmlSink( writer, "UTF-8" );
- }
-
- /** {@inheritDoc} */
- protected boolean isXmlSink()
- {
- return true;
- }
-
- /**
- * Test link generation.
- *
- */
- @Test
- public void testLinks()
- {
- XhtmlSink sink = null;
- Writer writer = new StringWriter();
- try
- {
- sink = (XhtmlSink) createSink( writer );
- sink.link( "http:/www.xdoc.com" );
- sink.link_();
- sink.link( "./index.html#anchor" );
- sink.link_();
- sink.link( "../index.html#anchor" );
- sink.link_();
- sink.link( "index.html" );
- sink.link_();
- }
- finally
- {
- if ( sink != null )
- {
- sink.close();
- }
- }
-
- String actual = writer.toString();
- assertTrue( actual.contains( "<a class=\"externalLink\" href=\"http:/www.xdoc.com\"></a>" ) );
- assertTrue( actual.contains( "<a href=\"./index.html#anchor\"></a>" ) );
- assertTrue( actual.contains( "<a href=\"../index.html#anchor\"></a>" ) );
- assertTrue( actual.contains( "<a href=\"index.html\"></a>" ) );
- }
-
- /** {@inheritDoc} */
- protected String getTitleBlock( String title )
- {
- return "<title>" + title + "</title>";
- }
-
- /** {@inheritDoc} */
- protected String getAuthorBlock( String author )
- {
- return author;
- }
-
- /** {@inheritDoc} */
- protected String getDateBlock( String date )
- {
- return date;
- }
-
- /** {@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\">" +
- "<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>";
- }
-
- /** {@inheritDoc} */
- protected String getBodyBlock()
- {
- return "<body></body></html>";
- }
-
- /** {@inheritDoc} */
- protected String getArticleBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getNavigationBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getSidebarBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getSectionTitleBlock( String title )
- {
- return title;
- }
-
- /** {@inheritDoc} */
- protected String getSection1Block( String title )
- {
- return "<div class=\"section\">\n<h1>" + title + "</h1></div>";
- }
-
- /** {@inheritDoc} */
- protected String getSection2Block( String title )
- {
- return "<div class=\"section\">\n<h2>" + title + "</h2></div>";
- }
-
- /** {@inheritDoc} */
- protected String getSection3Block( String title )
- {
- return "<div class=\"section\">\n<h3>" + title + "</h3></div>";
- }
-
- /** {@inheritDoc} */
- protected String getSection4Block( String title )
- {
- return "<div class=\"section\">\n<h4>" + title + "</h4></div>";
- }
-
- /** {@inheritDoc} */
- protected String getSection5Block( String title )
- {
- return "<div class=\"section\">\n<h5>" + title + "</h5></div>";
- }
-
- /** {@inheritDoc} */
- protected String getHeaderBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getContentBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getFooterBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getListBlock( String item )
- {
- return "<ul>\n<li>" + item + "</li></ul>";
- }
-
- /** {@inheritDoc} */
- protected String getNumberedListBlock( String item )
- {
- return "<ol style=\"list-style-type: lower-roman\">\n<li>" + item + "</li></ol>";
- }
-
- /** {@inheritDoc} */
- protected String getDefinitionListBlock( String definum, String definition )
- {
- return "<dl>\n<dt>" + definum + "</dt>\n<dd>" + definition + "</dd></dl>";
- }
-
- /** {@inheritDoc} */
- protected String getFigureBlock( String source, String caption )
- {
- String figureBlock = "<img src=\"" + escapeHTML( source, true ) + "\"";
- if( caption != null )
- {
- figureBlock += " alt=\"" + caption + "\"";
- }
- else //@todo fix DOXIA-361
- {
- figureBlock += " alt=\"\"";
- }
- figureBlock += " />";
- return figureBlock;
- }
-
- /** {@inheritDoc} */
- protected String getTableBlock( String cell, String caption )
- {
- return "<table border=\"0\" class=\"bodyTable\">"
- + "<caption>Table caption</caption><tr class=\"a\">\n<td>cell</td></tr>"
- + "</table>";
- }
-
- // Disable testTable until the order of attributes issue is clarified
- // TODO: remove
- /** {@inheritDoc} */
- @Test
- public void testTable()
- {
- assertEquals( "", "", "Dummy!" );
- }
-
- /** {@inheritDoc} */
- protected String getParagraphBlock( String text )
- {
- return "<p>" + text + "</p>";
- }
-
- /** {@inheritDoc} */
- protected String getDataBlock( String value, String text )
- {
- return text;
- }
-
- /** {@inheritDoc} */
- protected String getTimeBlock( String datetime, String text )
- {
- return text;
- }
-
- /** {@inheritDoc} */
- protected String getAddressBlock( String text )
- {
- return "<address>" + text + "</address>";
- }
-
- /** {@inheritDoc} */
- protected String getBlockquoteBlock( String text )
- {
- return "<blockquote>" + text + "</blockquote>";
- }
-
- /** {@inheritDoc} */
- protected String getDivisionBlock( String text )
- {
- return "<div>" + text + "</div>";
- }
-
- /** {@inheritDoc} */
- protected String getVerbatimBlock( String text )
- {
- return "<div class=\"source\">\n<pre>" + text + "</pre></div>";
- }
-
- /** {@inheritDoc} */
- protected String getHorizontalRuleBlock()
- {
- return "<hr />";
- }
-
- /** {@inheritDoc} */
- protected String getPageBreakBlock()
- {
- return "<!-- PB -->";
- }
-
- /** {@inheritDoc} */
- protected String getAnchorBlock( String anchor )
- {
- return "<a name=\"" + anchor + "\">" + anchor + "</a>";
- }
-
- /** {@inheritDoc} */
- protected String getLinkBlock( String link, String text )
- {
- return "<a href=\"" + link + "\">" + text + "</a>";
- }
-
- /** {@inheritDoc} */
- protected String getInlineBlock( String text )
- {
- return text;
- }
-
- /** {@inheritDoc} */
- protected String getInlineItalicBlock( String text )
- {
- return "<i>" + text + "</i>";
- }
-
- /** {@inheritDoc} */
- protected String getInlineBoldBlock( String text )
- {
- return "<b>" + text + "</b>";
- }
-
- /** {@inheritDoc} */
- protected String getInlineCodeBlock( String text )
- {
- return "<code>" + text + "</code>";
- }
-
- /** {@inheritDoc} */
- protected String getItalicBlock( String text )
- {
- return "<i>" + text + "</i>";
- }
-
- /** {@inheritDoc} */
- protected String getBoldBlock( String text )
- {
- return "<b>" + text + "</b>";
- }
-
- /** {@inheritDoc} */
- protected String getMonospacedBlock( String text )
- {
- return "<tt>" + text + "</tt>";
- }
-
- /** {@inheritDoc} */
- protected String getLineBreakBlock()
- {
- return "<br />";
- }
-
- /** {@inheritDoc} */
- protected String getLineBreakOpportunityBlock()
- {
- return "";
- }
-
- /** {@inheritDoc} */
- protected String getNonBreakingSpaceBlock()
- {
- return " ";
- }
-
- /** {@inheritDoc} */
- protected String getTextBlock( String text )
- {
- // TODO: need to be able to retreive those from outside the sink
- return "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\";
- }
-
- /** {@inheritDoc} */
- protected String getRawTextBlock( String text )
- {
- return text;
- }
-
- /**
- * Test entities is section titles and paragraphs.
- */
- @Test
- public void testEntities()
- {
- XhtmlSink sink = null;
- Writer writer = new StringWriter();
-
- try
- {
- sink = new XhtmlSink( writer );
- sink.section( Sink.SECTION_LEVEL_1, null );
- sink.sectionTitle( Sink.SECTION_LEVEL_1, null );
- sink.text( "&", null );
- sink.sectionTitle_( Sink.SECTION_LEVEL_1 );
- sink.paragraph( null );
- sink.text( "&", null );
- sink.paragraph_();
- sink.section_( Sink.SECTION_LEVEL_1 );
- }
- finally
- {
- sink.close();
- }
-
- assertEquals( "<div class=\"section\">\n<h1>&</h1>\n<p>&</p></div>", writer.toString() );
- }
-
- /**
- * Test head events.
- */
- @Test
- public void testHead()
- {
- XhtmlSink sink = null;
- Writer writer = new StringWriter();
-
- try
- {
- sink = new XhtmlSink( writer );
- sink.head();
- sink.title();
- sink.text( "Title" );
- sink.title_();
- sink.comment( "A comment" );
- sink.author();
- // note: this is really illegal, there should be no un-resolved entities emitted into text()
- sink.text( "ģ&" );
- sink.author_();
- SinkEventAttributeSet atts = new SinkEventAttributeSet( 1 );
- atts.addAttribute( "href", "http://maven.apache.org/" );
- sink.unknown( "base", new Object[] { HtmlMarkup.TAG_TYPE_SIMPLE }, atts );
- sink.head_();
- }
- finally
- {
- sink.close();
- }
-
- String expected =
- "<head>\n<title>Title</title><!--A comment--><meta name=\"author\" content=\"ģ&\" />"
- + "<base href=\"http://maven.apache.org/\" /></head>";
- String actual = writer.toString();
- assertTrue( actual.contains( expected ), actual );
- }
-
- /** {@inheritDoc} */
- protected String getCommentBlock( String text )
- {
- return "<!--" + toXmlComment( text ) + "-->";
- }
-}
diff --git a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkWithLanguageIdTest.java b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkWithLanguageIdTest.java
deleted file mode 100644
index 13c32454..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkWithLanguageIdTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.doxia.module.xhtml;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Writer;
-import java.util.Locale;
-
-import org.apache.maven.doxia.sink.Sink;
-
-/**
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- */
-@Deprecated
-public class XhtmlSinkWithLanguageIdTest
- extends XhtmlSinkTest
-{
- /** {@inheritDoc} */
- protected Sink createSink( Writer writer )
- {
- return new XhtmlSink( writer, "UTF-8", Locale.US.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\">"
- + "<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-xhtml/src/test/resources/download.apt.vm b/doxia-modules/doxia-module-xhtml/src/test/resources/download.apt.vm
deleted file mode 100644
index 6e09992b..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/download.apt.vm
+++ /dev/null
@@ -1,79 +0,0 @@
- ------
-Download Maven ${currentVersion}
- ------
-Brett Porter
-Jason van Zyl
- ------
-4 October 2005
- ------
-
-Download Maven ${currentVersion}
-
- Maven is distributed in several formats for your convenience.
-
- You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24
- hours to reach all mirrors.
-
- Maven ${currentVersion} is distributed under the {{{http://maven.apache.org/license.html} Apache License, version 2.0}}.
-
- We <<strongly>> encourage our users to configure a Maven repository mirror closer to their location, please read {{{guides/mini/guide-mirror-settings.html} How to Use Mirrors for Repositories}}.
-
-*-------------------------+---------+----------+-----------+
-| | Mirrors | Checksum | Signature |
-*-------------------------+---------+----------+-----------+
-| Maven ${currentVersion} (tar.bz2) | {{{http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-${currentVersion}-bin.tar.bz2} maven-${currentVersion}-bin.tar.bz2}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.tar.bz2.md5} maven-${currentVersion}-bin.tar.bz2.md5}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.tar.bz2.asc} maven-${currentVersion}-bin.tar.bz2.asc}} |
-*-------------------------+---------+----------+-----------+
-| Maven ${currentVersion} (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-${currentVersion}-bin.tar.gz} maven-${currentVersion}-bin.tar.gz}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.tar.gz.md5} maven-${currentVersion}-bin.tar.gz.md5}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.tar.gz.asc} maven-${currentVersion}-bin.tar.gz.asc}} |
-*-------------------------+---------+----------+-----------+
-| Maven ${currentVersion} (zip) | {{{http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-${currentVersion}-bin.zip} maven-${currentVersion}-bin.zip}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.zip.md5} maven-${currentVersion}-bin.zip.md5}} | {{{http://www.apache.org/dist/maven/binaries/maven-${currentVersion}-bin.zip.asc} maven-${currentVersion}-bin.zip.asc}} |
-*-------------------------+---------+----------+-----------+
-| Maven Ant Tasks 2.0.7 | {{{http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-ant-tasks-2.0.7.jar} maven-ant-tasks-2.0.7.jar}} | {{{http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.7.jar.md5} maven-ant-tasks-2.0.7.jar.md5}} | {{{http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.7.jar.asc} maven-ant-tasks-2.0.7.jar.asc}} |
-*-------------------------+---------+----------+-----------+
-
-* Previous Releases
-
- All previous releases of Maven can be found in the {{{http://archive.apache.org/dist/maven/binaries/}archives}}.
-
-* System {Requirements}
-
-*----------------------+---------------------------------------------------------------------------------------------+
-| <<JDK>> | 1.4 or above (this is to execute Maven - it still allows you to build against 1.3 and prior JDK's)
-*----------------------+---------------------------------------------------------------------------------------------+
-| <<Memory>> | No minimum requirement
-*----------------------+---------------------------------------------------------------------------------------------+
-| <<Disk>> | No minimum requirement. Approximately 100MB will be used for your local repository, however this will vary depending on usage and can be removed and redownloaded at any time.
-*----------------------+---------------------------------------------------------------------------------------------+
-| <<Operating System>> | No minimum requirement. On Windows, Windows NT and above or Cygwin is required for the startup scripts. Tested on Windows XP, Fedora Core and Mac OS X.
-*----------------------+---------------------------------------------------------------------------------------------+
-
-* {Installation} Instructions
-
-** Windows 2000/XP
-
- [[1]] Unzip <<<maven-${currentVersion}-bin.zip>>> to the directory you wish to install Maven ${currentVersion}. These instructions
- assume you chose <<<C:\Program Files\Apache Software Foundation\maven-${currentVersion}>>>
-
- [[2]] Add the <<<bin>>> directory to your path, by opening up the system properties (WinKey + Pause),
- selecting the "Advanced" tab, and the "Environment Variables" button, then editing the <<<PATH>>>
- variable in the user variables. eg.
- <<<"C:\Program Files\Apache Software Foundation\maven-${currentVersion}\bin";%PATH%>>>
-
- [[3]] In the same dialog, make sure that <<<JAVA_HOME>>> is set to the location of your JDK,
- eg. <<<C:\Program Files\Java\jdk1.5.0_02>>>
-
- [[4]] Run <<<mvn --version>>> to verify that it is correctly installed.
-
-** Unix-based Operating Systems (Linux, Solaris and Mac OS X)
-
- [[1]] Extract the distribution archive to the directory you wish to install Maven ${currentVersion}. These instructions
- assume you chose <<</usr/local/maven-${currentVersion}>>>. The directory <<<maven-${currentVersion}>>> will be created from
- the archive.
-
- [[2]] Add the <<<bin>>> directory to your path, eg. <<<export
-PATH=/usr/local/maven-${currentVersion}/bin:$PATH>>>
-
- [[3]] Make sure that <<<JAVA_HOME>>> is set to the location of your JDK, eg.
- <<<export JAVA_HOME=/usr/java/jdk1.5.0_02>>>
-
- [[4]] Run <<<mvn --version>>> to verify that it is correctly installed.
-
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/file.with.dot.in.name.xml b/doxia-modules/doxia-module-xhtml/src/test/resources/file.with.dot.in.name.xml
deleted file mode 100644
index 8a0bb342..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/file.with.dot.in.name.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<nothing/>
\ No newline at end of file
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html b/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html
deleted file mode 100644
index 3f8b39a1..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html>
- <head>
- <title>This is fun!</title>
- </head>
- <body>
- <h1>This is the first first-level section</h1>
- <p>
- This paragraph belongs to section one.
- </p>
- <h2>This is the first second-level section</h2>
- <p>
- <a name="para1" />This paragraph belongs to subsection one.
- </p>
- <h2>This is the second second-level section</h2>
- <p>
- This paragraph belongs to subsection two.
- </p>
- <h3>This is the first third-level section</h3>
- <p>
- To make the <em>task</em> <i>even</i> harder,
- the <tt>h3</tt>-heading was dropped, but we
- expect the parser to recognize this section
- as level 3, not level 4.
- </p>
- <h2>This is the third second-level section</h2>
- <p>
- This paragraph belongs to subsection three.
- </p>
- <h1>This is the second first-level section</h1>
- <p>
- This paragraph belongs to section two.
- </p>
- <pre>
- //what is source code?
- </pre>
- <p>
- This is <em>also</em> a <strong>paragraph</strong>. Take a look
- at the <a href="#para1">other paragraph</a>.
- </p>
- <p>
- Just introduce some <img src="http://maven.apache.org/images/logos/maven-feather.png"/>
- images. <img src="http://maven.apache.org/images/logos/maven-feather.png" alt="maven feather"/>
- <img src="http://maven.apache.org/images/logos/maven-feather.png" alt="maven feather"
- title="built by: maven"/>
- </p>
- </body>
-</html>
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm b/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm
deleted file mode 100644
index f6c942b4..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm
+++ /dev/null
@@ -1,231 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<document>
- <properties>
- <title>Welcome to Maven</title>
- <author email="brett@apache.org">Brett Porter</author>
- <author email="jason@sonatype.com">Jason van Zyl</author>
- </properties>
- <body>
-
- <!-- TODO: news? -->
- <div id="downloadbox">
- <h4>Search Maven Sites</h4>
-<!-- Google CSE Search Box Begins -->
-<form action="http://www.google.com/cse" id="searchbox_006660305041243700248:hyqtfwsewpm">
- <input type="hidden" name="cx" value="006660305041243700248:hyqtfwsewpm" />
- <input type="text" name="q" size="25" />
- <input type="submit" name="sa" value="Search" />
-</form>
-<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_006660305041243700248%3Ahyqtfwsewpm"></script>
-<!-- Google CSE Search Box Ends -->
-
- <h4>Get Maven ${currentVersion}</h4>
- <span style="display: block; text-align: right; font-size: smaller">Released: 20 June 2007</span>
- <p>
- <a href="download.html">
- <img src="images/folder-open.gif" border="0" alt="" title="Download Maven ${currentVersion}"/>
- Maven ${currentVersion}
- </a>
- <small>(1.3Mb)</small>
- <span style="font-size: smaller">
- <br/>
- <a href="download.html#Requirements">System Requirements</a>,
- <a href="download.html#Installation">Installation Instructions</a>,
- <a href="release-notes.html">Release Notes</a>
- </span>
- </p>
- <p>
- <a href="download.html">
- <img src="images/folder-open.gif" border="0" alt="" title="Download Maven Tasks for Ant 2.0.7"/>
- Maven Tasks for Ant 2.0.7
- </a>
- <small>(938k)</small>
- <span style="font-size: smaller">
- <br/>
- <a href="ant-tasks.html">Documentation</a>,
- <a href="ant-tasks-release-notes.html">Release Notes</a>
- </span>
- </p>
- <!-- TODO: what about downloads for Continuum, etc.? Would be good to have one big download page -->
-
- <h4>Other Maven Projects</h4>
- <p>
- <a href="/continuum/">
- <img src="images/continuum.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Continuum" />
- Continuum
- </a>
- continuous integration server
- </p>
- <!--
-
- You can't be promoting Archiva when it's never been released, it's completely alpha and this is misleading.
- When it's released I think it can rightfully be put here.
-
- <p>
- <a href="archiva">
- <img src="images/archiva.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Archiva" />
- Archiva
- </a>
- repository and artifact management server
- </p>
- -->
- <p>
- <a href="/maven-1.x/">
- <img src="images/maven-1.x.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Maven 1.x" />
- Maven 1.x
- </a>
- All stories start at the beginning...
- </p>
-
- <!-- TODO: we should use the SSI instead, but two things prevent it: a) the SSI's aren't working on apache.org yet so I can't test it; b) SSI's get eliminated from xdoc. For some reason even inside CDATA they are escaped. -->
- <iframe src="http://www.apache.org/ads/bannerbar.html"
-style="margin-left: -10px; padding: 0;" frameborder="0" scrolling="no"
-width="244" height="68"></iframe>
- <div>
- <a href="http://www.ossummit.com"><img src="http://www.ossummit.com/ads/ossummit_button_2.jpg" alt="OS Summit Asia" border="0" width="234" height="60" /></a>
- </div>
- </div>
- <section name="Welcome to Maven">
-
- <!-- TODO: I reckon it's time for a new description -->
- <p>
- Maven is a software project management and comprehension tool. Based on the concept of a project object model
- (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
- </p>
- <p>
- If you think that Maven could help your project, you can find out more information about in the "About Maven"
- section of the navigation. This includes an in-depth description of <a href="what-is-maven.html">what Maven is</a>,
- a <a href="maven-features.html">list of some of its main features</a>, and a set of <a href="general.html">frequently
- asked questions about what Maven is</a>.
- </p>
- <h2>Learning about Maven</h2>
- <p>
- <!-- TODO: this could be the big button type thing instead of a list of links -->
- This site is separated into the following sections, depending on how you'd like to use Maven:
- </p>
- <!-- TODO: use CSS -->
- <ul>
- <li>
- <span style="white-space:nowrap; font-weight: bold; font-size: 1.25em">
- <a href="run-maven/index.html">Run Maven</a>
- </span>
- <span style="display: block; margin-bottom: 0.5em">
- Information for those needing to build a project that uses Maven
- </span>
- </li>
- <li>
- <span style="white-space:nowrap; font-weight: bold; font-size: 1.25em">
- <a href="users/index.html">Use Maven</a>
- </span>
- <span style="display: block; margin-bottom: 0.5em">
- Information for those wanting to use Maven to build their project, including a "10 minute test" that gives a
- practical overview of Maven's main features in just 10 minutes
- </span>
- </li>
- <li>
- <span style="white-space:nowrap; font-weight: bold; font-size: 1.25em">
- <a href="plugin-developers/index.html">Write Maven Plugins</a>
- </span>
- <span style="display: block; margin-bottom: 0.5em">
- Information for those who may or may not be using Maven, but want to provide a plugin for shared
- functionality or to accompany their own product or toolset
- </span>
- </li>
- <li>
- <span style="white-space:nowrap; font-weight: bold; font-size: 1.25em">
- <a href="repository/index.html">Improve the Maven Repository</a>
- </span>
- <span style="display: block; margin-bottom: 0.5em">
- Information for those who may or may not use, but are interested in getting project metadata into the
- repository
- </span>
- </li>
- <li>
- <span style="white-space:nowrap; font-weight: bold; font-size: 1.25em">
- <a href="developers/index.html">Develop Maven</a>
- </span>
- <span style="display: block; margin-bottom: 0.5em">
- Information for those who are currently developers, or interested in becoming developers of the Maven
- project itself
- </span>
- </li>
- </ul>
- <p>
- Each guide is divided into a number of trails to get you started on a particular topic, and includes a
- reference area and a "cookbook" of common examples.
- </p>
- <p>
- You can access the guides at any time from the left navigation.
- </p>
- <h2>Documentation Index</h2>
- <p>
- If you are looking for a quick reference, you can use the <a href="guides/index.html">documentation index.</a>
-<!-- TODO
- If you are looking for a quick reference, you can use the documentation index. It is available in both
- <a href="todo.html">alphabetical</a> and <a href="todo.html">categorical</a> listing formats.
--->
- </p>
- <h2>Plugins</h2>
-<!-- TODO
- <p>
- Maven functionality is provided by plugins. For an explanation of how plugins work, and basic information on how
- to use a plugin, see the <a href="todo.html">introduction to plugins</a> in the Users Centre.
- </p>
--->
- <p>
- For detailed information on just some of the plugins available for Maven, see the
- <a href="plugins/index.html">plugin list</a>.
- </p>
-<!-- TODO: Should these be here, or just in the user centre?
- <h2>Converting from a different Build System</h2>
- <p>
- If you are currently using a different build system, there are options for converting from that to Maven 2
- either partially or completely. These guides also give an overview of the differences between Maven and the
- other build system. The following guides are available in the Users Centre:
- </p>
- <ul>
- <li><a href="todo.html">Converting from Ant to Maven 2</a></li>
- <li><a href="todo.html">Converting from Maven 1.x to Maven 2</a></li>
- <li><a href="todo.html">Adding Maven 2 to an IDE based build</a></li>
- </ul>
--->
- <h2>How to Get Support</h2>
- <p>
- Support for Maven is available in a variety of different forms.
- </p>
- <p>
- To get started, search the documentation, the <a href="http://docs.codehaus.org/display/MAVENUSER">wiki</a>,
- <a href="issue-tracking.html">issue tracker</a>, or the <a href="mail-lists.html">mailing list archives</a> to
- see if the problem has been solved or reported before.
- </p>
- <p>
- If the problem has not been reported before, the recommended way to get help is to
- subscribe to the <a href="mail-lists.html">Maven Users Mailing list</a>. Many other users and Maven developers
- will answer your questions there, and the answer will be archived for others in the future.
- </p>
- <p>
- You can also reach the Maven developers on <a href="community.html">IRC</a>.
- </p>
- </section>
- </body>
-</document>
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml4 b/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml4
deleted file mode 100644
index fd94454c..00000000
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml4
+++ /dev/null
@@ -1,152 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title>Title</title>
- <meta name="author" content="Author" />
- <meta name="date" content="Date" />
-</head>
-
-<body>
-
-<!-- MACRO{toc|fromDepth=0|toDepth=3} -->
-
-<p>Paragraph 1, line 1. Paragraph 1, line 2.</p>
-<p>Paragraph 2, line 1. Paragraph 2, line 2.</p>
-
-<div class="section"><h1>Section title</h1>
-<div class="section"><h2>Sub-section title</h2>
-<div class="section"><h3>Sub-sub-section title</h3>
-<div class="section"><h4>Sub-sub-sub-section title</h4>
-<div class="section"><h5>Sub-sub-sub-sub-section title</h5>
-
-<ul>
- <li>List item 1.</li>
- <li>List item 2.<p>Paragraph contained in list item 2.</p>
- <ul>
- <li>Sub-list item 1.</li>
- <li>Sub-list item 2.</li>
- </ul>
- </li>
- <li>List item 3. Force end of list:</li>
-</ul>
-
-<div class="source"><pre>Verbatim text not contained in list item 3</pre></div>
-
-<ol type="1">
- <li>Numbered item 1.
- <ol type="A">
- <li>Numbered item A.</li>
- <li>Numbered item B.</li>
- </ol>
- </li>
- <li>Numbered item 2.</li>
-</ol>
-
-<p>List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].</p>
-
-<dl>
- <dt>Defined term 1</dt>
- <dd>of definition list.</dd>
- <dt>Defined term 2</dt>
- <dd>of definition list.<div class="source"><pre>Verbatim text
- in a box </pre></div></dd>
-</dl>
-
-<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>
-</div>
-
-<table align="center" border="1" 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>
- </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>
- </tr>
-</table>
-
-<p>No grid, no caption:</p>
-
-<table align="center" border="0" class="bodyTable">
- <tr class="a">
- <td align="center">cell</td>
- <td align="center">cell</td>
- </tr>
- <tr class="b">
- <td align="center">cell</td>
- <td align="center">cell</td>
- </tr>
-</table>
-
-<p>Horizontal line:</p><hr />
-
-<!-- PB -->
-<p>New page.</p>
-
-<p><i>Italic</i> font. <b>Bold</b> font. <tt>Monospaced</tt> font.</p>
-
-<p>
- <a name="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>.
- Link to <a href="http://www.pixware.fr" class="externalLink">Pixware home page</a>.
-</p>
-
-<p>Force line<br />break.</p>
-
-<p>Non breaking space.</p>
-
-<p>Escaped special characters:<br />
- ~<br />
- =<br />
- -<br />
- +<br />
- *<br />
- [<br />
- ]<br />
- <<br />
- ><br />
- {<br />
- }<br />
- \
-</p>
-
-<p>Copyright symbol: ©, ©, ©.</p>
-
-<!-- A comment! -->
-
-</div></div></div></div></div>
-
-</body>
-
-</html>
diff --git a/doxia-modules/pom.xml b/doxia-modules/pom.xml
index f01742c8..58cb3030 100644
--- a/doxia-modules/pom.xml
+++ b/doxia-modules/pom.xml
@@ -37,7 +37,6 @@ under the License.
<module>doxia-module-apt</module>
<module>doxia-module-fml</module>
<module>doxia-module-xdoc</module>
- <module>doxia-module-xhtml</module>
<module>doxia-module-xhtml5</module>
<module>doxia-module-markdown</module>
</modules>
diff --git a/pom.xml b/pom.xml
index f67bfb4a..52e2e3d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,11 +134,6 @@ under the License.
<artifactId>doxia-module-xdoc</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xhtml</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-xhtml5</artifactId>
@@ -384,7 +379,7 @@ under the License.
<dependencies>
<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/src/site/resources/images/doxia-deps.png b/src/site/resources/images/doxia-deps.png
index 05d52f9d..f729e1ba 100644
Binary files a/src/site/resources/images/doxia-deps.png and b/src/site/resources/images/doxia-deps.png differ
diff --git a/src/site/xdoc/doxia-deps.odg b/src/site/xdoc/doxia-deps.odg
index 3e9875fa..68979a2a 100644
Binary files a/src/site/xdoc/doxia-deps.odg and b/src/site/xdoc/doxia-deps.odg differ
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 0f2a25de..22430b00 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -47,8 +47,7 @@
<area shape="rect" coords="165,180,286,209" href="./doxia-core/" />
<area shape="rect" coords="41,25,118,88" href="./doxia-modules/doxia-module-apt/" />
<area shape="rect" coords="212,75,289,107" href="./doxia-modules/doxia-module-xdoc/" />
- <area shape="rect" coords="230,25,313,88" href="./doxia-modules/doxia-module-xhtml/" />
- <area shape="rect" coords="325,25,407,88" href="./doxia-modules/doxia-module-xhtml5/" />
+ <area shape="rect" coords="230,25,313,88" href="./doxia-modules/doxia-module-xhtml5/" />
<area shape="rect" coords="135,25,213,88" href="./doxia-modules/doxia-module-fml/" />
<area shape="rect" coords="304,75,421,107" href="./doxia-modules/doxia-module-markdown/" />
<area shape="rect" coords="21,1,432,151" href="./doxia-modules/" />