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 2023/01/09 21:11:02 UTC
[maven-doxia] branch master updated: [DOXIA-686] Upgrade to Maven Parent 39
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
The following commit(s) were added to refs/heads/master by this push:
new 6a60ee45 [DOXIA-686] Upgrade to Maven Parent 39
6a60ee45 is described below
commit 6a60ee4530175f915150961742b5aa91c14bc15a
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Jan 9 22:09:31 2023 +0100
[DOXIA-686] Upgrade to Maven Parent 39
---
doxia-core/pom.xml | 3 -
.../java/org/apache/maven/doxia/DefaultDoxia.java | 47 +-
.../main/java/org/apache/maven/doxia/Doxia.java | 35 +-
.../org/apache/maven/doxia/index/IndexEntry.java | 151 +-
.../org/apache/maven/doxia/index/IndexingSink.java | 152 +-
.../apache/maven/doxia/macro/AbstractMacro.java | 38 +-
.../org/apache/maven/doxia/macro/EchoMacro.java | 39 +-
.../java/org/apache/maven/doxia/macro/Macro.java | 26 +-
.../maven/doxia/macro/MacroExecutionException.java | 37 +-
.../org/apache/maven/doxia/macro/MacroRequest.java | 62 +-
.../doxia/macro/manager/DefaultMacroManager.java | 41 +-
.../maven/doxia/macro/manager/MacroManager.java | 25 +-
.../macro/manager/MacroNotFoundException.java | 37 +-
.../maven/doxia/macro/snippet/SnippetMacro.java | 239 ++-
.../maven/doxia/macro/snippet/SnippetReader.java | 147 +-
.../org/apache/maven/doxia/macro/toc/TocMacro.java | 132 +-
.../org/apache/maven/doxia/markup/HtmlMarkup.java | 366 ++---
.../java/org/apache/maven/doxia/markup/Markup.java | 25 +-
.../org/apache/maven/doxia/markup/TextMarkup.java | 24 +-
.../org/apache/maven/doxia/markup/XmlMarkup.java | 25 +-
.../apache/maven/doxia/parser/AbstractParser.java | 128 +-
.../maven/doxia/parser/AbstractTextParser.java | 26 +-
.../maven/doxia/parser/AbstractXmlParser.java | 489 +++---
.../apache/maven/doxia/parser/ParseException.java | 71 +-
.../java/org/apache/maven/doxia/parser/Parser.java | 33 +-
.../maven/doxia/parser/Xhtml5BaseParser.java | 1210 +++++---------
.../doxia/parser/manager/DefaultParserManager.java | 41 +-
.../maven/doxia/parser/manager/ParserManager.java | 24 +-
.../parser/manager/ParserNotFoundException.java | 37 +-
.../doxia/parser/module/AbstractParserModule.java | 49 +-
.../parser/module/DefaultParserModuleManager.java | 46 +-
.../maven/doxia/parser/module/ParserModule.java | 21 +-
.../doxia/parser/module/ParserModuleManager.java | 24 +-
.../module/ParserModuleNotFoundException.java | 37 +-
.../apache/maven/doxia/sink/impl/AbstractSink.java | 88 +-
.../maven/doxia/sink/impl/AbstractTextSink.java | 24 +-
.../doxia/sink/impl/AbstractTextSinkFactory.java | 64 +-
.../maven/doxia/sink/impl/AbstractXmlSink.java | 115 +-
.../doxia/sink/impl/AbstractXmlSinkFactory.java | 24 +-
.../apache/maven/doxia/sink/impl/PipelineSink.java | 49 +-
.../maven/doxia/sink/impl/RandomAccessSink.java | 692 +++-----
.../apache/maven/doxia/sink/impl/SinkAdapter.java | 589 +++----
.../doxia/sink/impl/SinkEventAttributeSet.java | 304 ++--
.../apache/maven/doxia/sink/impl/SinkUtils.java | 188 +--
.../maven/doxia/sink/impl/Xhtml5BaseSink.java | 1551 +++++++-----------
.../maven/doxia/util/ByLineReaderSource.java | 83 +-
.../org/apache/maven/doxia/util/ByLineSource.java | 25 +-
.../org/apache/maven/doxia/util/DoxiaUtils.java | 210 ++-
.../org/apache/maven/doxia/util/HtmlTools.java | 415 ++---
.../org/apache/maven/doxia/util/LineBreaker.java | 128 +-
.../org/apache/maven/doxia/util/XmlValidator.java | 158 +-
.../org/apache/maven/doxia/AbstractModuleTest.java | 120 +-
.../org/apache/maven/doxia/DefaultDoxiaTest.java | 36 +-
.../apache/maven/doxia/index/IndexEntryTest.java | 59 +-
.../apache/maven/doxia/index/IndexingSinkTest.java | 32 +-
.../apache/maven/doxia/macro/EchoMacroTest.java | 48 +-
.../doxia/macro/manager/MacroManagerTest.java | 34 +-
.../doxia/macro/snippet/SnippetMacroTest.java | 142 +-
.../doxia/macro/snippet/SnippetReaderTest.java | 107 +-
.../apache/maven/doxia/macro/toc/TocMacroTest.java | 172 +-
.../maven/doxia/module/AbstractIdentityTest.java | 77 +-
.../maven/doxia/parser/AbstractParserTest.java | 110 +-
.../maven/doxia/parser/AbstractParserTestCase.java | 39 +-
.../maven/doxia/parser/Xhtml5BaseParserTest.java | 967 +++++------
.../maven/doxia/sink/impl/AbstractSinkTest.java | 597 ++++---
.../doxia/sink/impl/AbstractSinkTestCase.java | 58 +-
.../maven/doxia/sink/impl/AbstractXmlSinkTest.java | 132 +-
.../doxia/sink/impl/RandomAccessSinkTest.java | 224 +--
.../maven/doxia/sink/impl/SinkAdapterTest.java | 368 ++---
.../doxia/sink/impl/SinkEventAttributeSetTest.java | 261 ++-
.../maven/doxia/sink/impl/SinkEventElement.java | 43 +-
.../doxia/sink/impl/SinkEventTestingSink.java | 843 ++++------
.../maven/doxia/sink/impl/SinkTestDocument.java | 338 ++--
.../maven/doxia/sink/impl/SinkUtilsTest.java | 72 +-
.../maven/doxia/sink/impl/TestAbstractSink.java | 111 +-
.../org/apache/maven/doxia/sink/impl/TextSink.java | 803 ++++-----
.../sink/impl/WellformednessCheckingSink.java | 755 ++++-----
.../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java | 1277 ++++++---------
.../maven/doxia/util/ByLineReaderSourceTest.java | 50 +-
.../apache/maven/doxia/util/DoxiaUtilsTest.java | 217 +--
.../org/apache/maven/doxia/util/HtmlToolsTest.java | 192 +--
.../apache/maven/doxia/util/XmlValidatorTest.java | 29 +-
.../maven/doxia/xsd/AbstractXmlValidator.java | 297 ++--
.../maven/doxia/xsd/AbstractXmlValidatorTest.java | 135 +-
doxia-modules/doxia-module-apt/pom.xml | 24 +-
.../apache/maven/doxia/module/apt/AptMarkup.java | 76 +-
.../maven/doxia/module/apt/AptParseException.java | 47 +-
.../apache/maven/doxia/module/apt/AptParser.java | 1697 ++++++++------------
.../maven/doxia/module/apt/AptParserModule.java | 29 +-
.../maven/doxia/module/apt/AptReaderSource.java | 66 +-
.../org/apache/maven/doxia/module/apt/AptSink.java | 771 ++++-----
.../maven/doxia/module/apt/AptSinkFactory.java | 29 +-
.../apache/maven/doxia/module/apt/AptSource.java | 25 +-
.../apache/maven/doxia/module/apt/AptUtils.java | 69 +-
.../maven/doxia/module/apt/AptIdentityTest.java | 30 +-
.../maven/doxia/module/apt/AptParserTest.java | 532 +++---
.../apache/maven/doxia/module/apt/AptSinkTest.java | 376 +++--
.../maven/doxia/module/apt/AptUtilsTest.java | 85 +-
doxia-modules/doxia-module-fml/pom.xml | 54 +-
.../maven/doxia/module/fml/FmlContentParser.java | 93 +-
.../apache/maven/doxia/module/fml/FmlMarkup.java | 66 +-
.../apache/maven/doxia/module/fml/FmlParser.java | 557 +++----
.../maven/doxia/module/fml/FmlParserModule.java | 29 +-
.../maven/doxia/module/fml/FmlParserTest.java | 330 ++--
.../maven/doxia/module/fml/FmlValidatorTest.java | 54 +-
doxia-modules/doxia-module-markdown/pom.xml | 28 +-
.../module/markdown/FlexmarkDoxiaLinkResolver.java | 70 +-
.../doxia/module/markdown/MarkdownMarkup.java | 42 +-
.../doxia/module/markdown/MarkdownParser.java | 240 ++-
.../module/markdown/MarkdownParserModule.java | 29 +-
.../maven/doxia/module/markdown/MarkdownSink.java | 676 ++++----
.../doxia/module/markdown/MarkdownSinkFactory.java | 29 +-
.../markdown/FlexmarkDoxiaLinkResolverTest.java | 159 +-
.../module/markdown/MarkdownParserModuleTest.java | 26 +-
.../doxia/module/markdown/MarkdownParserTest.java | 725 ++++++---
.../doxia/module/markdown/MarkdownSinkTest.java | 356 ++--
doxia-modules/doxia-module-xdoc/pom.xml | 52 +-
.../apache/maven/doxia/module/xdoc/XdocMarkup.java | 72 +-
.../apache/maven/doxia/module/xdoc/XdocParser.java | 460 ++----
.../maven/doxia/module/xdoc/XdocParserModule.java | 29 +-
.../apache/maven/doxia/module/xdoc/XdocSink.java | 320 ++--
.../maven/doxia/module/xdoc/XdocSinkFactory.java | 34 +-
.../maven/doxia/module/xdoc/XdocIdentityTest.java | 60 +-
.../maven/doxia/module/xdoc/XdocParserTest.java | 394 +++--
.../maven/doxia/module/xdoc/XdocSinkTest.java | 262 ++-
.../module/xdoc/XdocSinkWithLanguageIdTest.java | 38 +-
.../maven/doxia/module/xdoc/XdocValidatorTest.java | 54 +-
doxia-modules/doxia-module-xhtml5/pom.xml | 18 +-
.../doxia/module/xhtml5/AbstractXhtml5Sink.java | 23 +-
.../maven/doxia/module/xhtml5/Xhtml5Markup.java | 24 +-
.../maven/doxia/module/xhtml5/Xhtml5Parser.java | 306 ++--
.../doxia/module/xhtml5/Xhtml5ParserModule.java | 29 +-
.../maven/doxia/module/xhtml5/Xhtml5Sink.java | 146 +-
.../doxia/module/xhtml5/Xhtml5SinkFactory.java | 34 +-
.../doxia/module/xhtml5/Xhtml5IdentityTest.java | 61 +-
.../doxia/module/xhtml5/Xhtml5ParserTest.java | 166 +-
.../maven/doxia/module/xhtml5/Xhtml5SinkTest.java | 287 ++--
.../xhtml5/Xhtml5SinkWithLanguageIdTest.java | 37 +-
doxia-modules/pom.xml | 7 +-
doxia-sink-api/pom.xml | 4 +-
.../java/org/apache/maven/doxia/sink/Sink.java | 133 +-
.../maven/doxia/sink/SinkEventAttributes.java | 26 +-
.../org/apache/maven/doxia/sink/SinkFactory.java | 33 +-
doxia-test-docs/pom.xml | 2 -
pom.xml | 77 +-
145 files changed, 12926 insertions(+), 15020 deletions(-)
diff --git a/doxia-core/pom.xml b/doxia-core/pom.xml
index c73ad8ea..5dc25781 100644
--- a/doxia-core/pom.xml
+++ b/doxia-core/pom.xml
@@ -1,5 +1,4 @@
<?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
@@ -18,7 +17,6 @@ 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>
@@ -75,7 +73,6 @@ under the License.
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
- <version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java b/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
index aaf071a9..a3e68d06 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia;
/*
@@ -23,14 +41,14 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
+import java.io.Reader;
+
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.parser.manager.ParserManager;
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.apache.maven.doxia.sink.Sink;
-import java.io.Reader;
-
/**
* Simple implementation of the Doxia interface:
* uses a ParserManager to lookup a parser.
@@ -40,9 +58,7 @@ import java.io.Reader;
*/
@Singleton
@Named
-public class DefaultDoxia
- implements Doxia
-{
+public class DefaultDoxia implements Doxia {
@Inject
private ParserManager parserManager;
@@ -53,26 +69,21 @@ public class DefaultDoxia
// ----------------------------------------------------------------------
/** {@inheritDoc} */
- public void parse( Reader source, String parserId, Sink sink )
- throws ParserNotFoundException, ParseException
- {
- this.parse( source, parserId, sink, null );
+ public void parse(Reader source, String parserId, Sink sink) throws ParserNotFoundException, ParseException {
+ this.parse(source, parserId, sink, null);
}
/** {@inheritDoc} */
@Override
- public void parse( Reader source, String parserId, Sink sink, String reference )
- throws ParserNotFoundException, ParseException
- {
- Parser parser = parserManager.getParser( parserId );
+ public void parse(Reader source, String parserId, Sink sink, String reference)
+ throws ParserNotFoundException, ParseException {
+ Parser parser = parserManager.getParser(parserId);
- parser.parse( source, sink, reference );
+ parser.parse(source, sink, reference);
}
/** {@inheritDoc} */
- public Parser getParser( String parserId )
- throws ParserNotFoundException
- {
- return parserManager.getParser( parserId );
+ public Parser getParser(String parserId) throws ParserNotFoundException {
+ return parserManager.getParser(parserId);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/Doxia.java b/doxia-core/src/main/java/org/apache/maven/doxia/Doxia.java
index 01c7ee5a..75c2933f 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/Doxia.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/Doxia.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia;
/*
@@ -19,21 +37,20 @@ package org.apache.maven.doxia;
* under the License.
*/
+import java.io.Reader;
+
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.apache.maven.doxia.sink.Sink;
-import java.io.Reader;
-
/**
* Basic interface of the Doxia framework.
*
* @author Jason van Zyl
* @since 1.0
*/
-public interface Doxia
-{
+public interface Doxia {
/**
* Parses the given source model using a parser with given id,
@@ -45,8 +62,7 @@ public interface Doxia
* @throws ParserNotFoundException if no parser could be found for the given id
* @throws ParseException if the model could not be parsed
*/
- void parse( Reader source, String parserId, Sink sink )
- throws ParserNotFoundException, ParseException;
+ void parse(Reader source, String parserId, Sink sink) throws ParserNotFoundException, ParseException;
/**
* Parses the given source model using a parser with given id,
@@ -59,8 +75,8 @@ public interface Doxia
* @throws ParserNotFoundException if no parser could be found for the given id
* @throws ParseException if the model could not be parsed
*/
- void parse( Reader source, String parserId, Sink sink, String reference )
- throws ParserNotFoundException, ParseException;
+ void parse(Reader source, String parserId, Sink sink, String reference)
+ throws ParserNotFoundException, ParseException;
/**
* Return a parser for the given <code>parserId</code>.
@@ -69,6 +85,5 @@ public interface Doxia
* @return the parser identified by parserId
* @throws ParserNotFoundException if no parser could be found for the given id
*/
- Parser getParser( String parserId )
- throws ParserNotFoundException;
+ Parser getParser(String parserId) throws ParserNotFoundException;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java
index 43536131..57a90566 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexEntry.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.index;
/*
@@ -19,9 +37,9 @@ package org.apache.maven.doxia.index;
* under the License.
*/
-import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import org.codehaus.plexus.util.StringUtils;
@@ -30,8 +48,7 @@ import org.codehaus.plexus.util.StringUtils;
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
*/
-public class IndexEntry
-{
+public class IndexEntry {
/**
* The parent entry.
*/
@@ -55,16 +72,15 @@ public class IndexEntry
/**
* System-dependent EOL.
*/
- private static final String EOL = System.getProperty( "line.separator" );
+ private static final String EOL = System.getProperty("line.separator");
/**
* Constructor.
*
* @param newId The id. May be null.
*/
- public IndexEntry( String newId )
- {
- this( null, newId );
+ public IndexEntry(String newId) {
+ this(null, newId);
}
/**
@@ -73,14 +89,12 @@ public class IndexEntry
* @param newParent The parent. May be null.
* @param newId The id. May be null.
*/
- public IndexEntry( IndexEntry newParent, String newId )
- {
+ public IndexEntry(IndexEntry newParent, String newId) {
this.parent = newParent;
this.id = newId;
- if ( parent != null )
- {
- parent.childEntries.add( this );
+ if (parent != null) {
+ parent.childEntries.add(this);
}
}
@@ -89,8 +103,7 @@ public class IndexEntry
*
* @return the parent entry.
*/
- public IndexEntry getParent()
- {
+ public IndexEntry getParent() {
return parent;
}
@@ -99,8 +112,7 @@ public class IndexEntry
*
* @return the id.
*/
- public String getId()
- {
+ public String getId() {
return id;
}
@@ -110,8 +122,7 @@ public class IndexEntry
* @param id the id
* @since 1.1.2
*/
- protected void setId( String id )
- {
+ protected void setId(String id) {
this.id = id;
}
@@ -120,8 +131,7 @@ public class IndexEntry
*
* @return the title.
*/
- public String getTitle()
- {
+ public String getTitle() {
return title;
}
@@ -130,8 +140,7 @@ public class IndexEntry
*
* @param newTitle the title.
*/
- public void setTitle( String newTitle )
- {
+ public void setTitle(String newTitle) {
this.title = newTitle;
}
@@ -140,9 +149,8 @@ public class IndexEntry
*
* @return child entries.
*/
- public List<IndexEntry> getChildEntries()
- {
- return Collections.unmodifiableList( childEntries );
+ public List<IndexEntry> getChildEntries() {
+ return Collections.unmodifiableList(childEntries);
}
/**
@@ -150,10 +158,8 @@ public class IndexEntry
*
* @param entries the entries.
*/
- public void setChildEntries( List<IndexEntry> entries )
- {
- if ( entries == null )
- {
+ public void setChildEntries(List<IndexEntry> entries) {
+ if (entries == null) {
childEntries = new ArrayList<>();
}
@@ -169,23 +175,20 @@ public class IndexEntry
*
* @return the next entry, or null if there is none.
*/
- public IndexEntry getNextEntry()
- {
- if ( parent == null )
- {
+ public IndexEntry getNextEntry() {
+ if (parent == null) {
return null;
}
List<IndexEntry> entries = parent.getChildEntries();
- int index = entries.indexOf( this );
+ int index = entries.indexOf(this);
- if ( index + 1 >= entries.size() )
- {
+ if (index + 1 >= entries.size()) {
return null;
}
- return entries.get( index + 1 );
+ return entries.get(index + 1);
}
/**
@@ -193,23 +196,20 @@ public class IndexEntry
*
* @return the previous entry, or null if there is none.
*/
- public IndexEntry getPrevEntry()
- {
- if ( parent == null )
- {
+ public IndexEntry getPrevEntry() {
+ if (parent == null) {
return null;
}
List<IndexEntry> entries = parent.getChildEntries();
- int index = entries.indexOf( this );
+ int index = entries.indexOf(this);
- if ( index == 0 )
- {
+ if (index == 0) {
return null;
}
- return entries.get( index - 1 );
+ return entries.get(index - 1);
}
/**
@@ -217,16 +217,14 @@ public class IndexEntry
*
* @return the first entry, or null if there is none.
*/
- public IndexEntry getFirstEntry()
- {
+ public IndexEntry getFirstEntry() {
List<IndexEntry> entries = getChildEntries();
- if ( entries.size() == 0 )
- {
+ if (entries.size() == 0) {
return null;
}
- return entries.get( 0 );
+ return entries.get(0);
}
/**
@@ -234,16 +232,14 @@ public class IndexEntry
*
* @return the last entry, or null if there is none.
*/
- public IndexEntry getLastEntry()
- {
+ public IndexEntry getLastEntry() {
List<IndexEntry> entries = getChildEntries();
- if ( entries.size() == 0 )
- {
+ if (entries.size() == 0) {
return null;
}
- return entries.get( entries.size() - 1 );
+ return entries.get(entries.size() - 1);
}
/**
@@ -251,21 +247,15 @@ public class IndexEntry
*
* @return the root entry, or null if there is none.
*/
- public IndexEntry getRootEntry()
- {
+ public IndexEntry getRootEntry() {
List<IndexEntry> entries = getChildEntries();
- if ( entries.size() == 0 )
- {
+ if (entries.size() == 0) {
return null;
- }
- else if ( entries.size() > 1 )
- {
- throw new IllegalStateException( "This index has more than one root entry" );
- }
- else
- {
- return entries.get( 0 );
+ } else if (entries.size() > 1) {
+ throw new IllegalStateException("This index has more than one root entry");
+ } else {
+ return entries.get(0);
}
}
@@ -278,9 +268,8 @@ public class IndexEntry
*
* @return Returns a string representation of all objects
*/
- public String toString()
- {
- return toString( 0 );
+ public String toString() {
+ return toString(0);
}
/**
@@ -289,29 +278,25 @@ public class IndexEntry
* @param depth The depth to descent to.
* @return A string.
*/
- public String toString( int depth )
- {
+ public String toString(int depth) {
StringBuilder message = new StringBuilder();
- message.append( "Id: " ).append( id );
+ message.append("Id: ").append(id);
- if ( StringUtils.isNotEmpty( title ) )
- {
- message.append( ", title: " ).append( title );
+ if (StringUtils.isNotEmpty(title)) {
+ message.append(", title: ").append(title);
}
- message.append( EOL );
+ message.append(EOL);
StringBuilder indent = new StringBuilder();
- for ( int i = 0; i < depth; i++ )
- {
- indent.append( " " );
+ for (int i = 0; i < depth; i++) {
+ indent.append(" ");
}
- for ( IndexEntry entry : getChildEntries() )
- {
- message.append( indent ).append( entry.toString( depth + 1 ) );
+ for (IndexEntry entry : getChildEntries()) {
+ message.append(indent).append(entry.toString(depth + 1));
}
return message.toString();
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
index b5b33f28..ad1f94f8 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.index;
/*
@@ -33,9 +51,7 @@ import org.apache.maven.doxia.util.HtmlTools;
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
*/
-public class IndexingSink
- extends SinkAdapter
-{
+public class IndexingSink extends SinkAdapter {
/** Section 1. */
private static final int TYPE_SECTION_1 = 1;
@@ -83,12 +99,11 @@ public class IndexingSink
*
* @param sectionEntry The first index entry.
*/
- public IndexingSink( IndexEntry sectionEntry )
- {
+ public IndexingSink(IndexEntry sectionEntry) {
stack = new Stack<>();
- stack.push( sectionEntry );
+ stack.push(sectionEntry);
usedIds = new HashMap<>();
- usedIds.put( sectionEntry.getId(), new AtomicInteger() );
+ usedIds.put(sectionEntry.getId(), new AtomicInteger());
init();
}
@@ -97,8 +112,7 @@ public class IndexingSink
*
* @return the title
*/
- public String getTitle()
- {
+ public String getTitle() {
return title;
}
@@ -109,176 +123,154 @@ public class IndexingSink
/**
* {@inheritDoc}
*/
- public void title()
- {
+ public void title() {
this.type = TITLE;
}
/**
* {@inheritDoc}
*/
- public void section1()
- {
+ public void section1() {
pushNewEntry();
}
/**
* {@inheritDoc}
*/
- public void sectionTitle1()
- {
+ public void sectionTitle1() {
this.type = TYPE_SECTION_1;
}
/**
* {@inheritDoc}
*/
- public void title_()
- {
+ public void title_() {
this.type = 0;
}
/**
* <p>sectionTitle1_.</p>
*/
- public void sectionTitle1_()
- {
+ public void sectionTitle1_() {
this.type = 0;
}
/**
* {@inheritDoc}
*/
- public void section1_()
- {
+ public void section1_() {
pop();
}
/**
* {@inheritDoc}
*/
- public void section2()
- {
+ public void section2() {
pushNewEntry();
}
/**
* {@inheritDoc}
*/
- public void sectionTitle2()
- {
+ public void sectionTitle2() {
this.type = TYPE_SECTION_2;
}
/**
* <p>sectionTitle2_.</p>
*/
- public void sectionTitle2_()
- {
+ public void sectionTitle2_() {
this.type = 0;
}
/**
* {@inheritDoc}
*/
- public void section2_()
- {
+ public void section2_() {
pop();
}
/**
* {@inheritDoc}
*/
- public void section3()
- {
+ public void section3() {
pushNewEntry();
}
/**
* {@inheritDoc}
*/
- public void sectionTitle3()
- {
+ public void sectionTitle3() {
this.type = TYPE_SECTION_3;
}
/**
* <p>sectionTitle3_.</p>
*/
- public void sectionTitle3_()
- {
+ public void sectionTitle3_() {
this.type = 0;
}
/**
* {@inheritDoc}
*/
- public void section3_()
- {
+ public void section3_() {
pop();
}
/**
* {@inheritDoc}
*/
- public void section4()
- {
+ public void section4() {
pushNewEntry();
}
/**
* {@inheritDoc}
*/
- public void sectionTitle4()
- {
+ public void sectionTitle4() {
this.type = TYPE_SECTION_4;
}
/**
* <p>sectionTitle4_.</p>
*/
- public void sectionTitle4_()
- {
+ public void sectionTitle4_() {
this.type = 0;
}
/**
* {@inheritDoc}
*/
- public void section4_()
- {
+ public void section4_() {
pop();
}
/**
* {@inheritDoc}
*/
- public void section5()
- {
+ public void section5() {
pushNewEntry();
}
/**
* {@inheritDoc}
*/
- public void sectionTitle5()
- {
+ public void sectionTitle5() {
this.type = TYPE_SECTION_5;
}
/**
* <p>sectionTitle5_.</p>
*/
- public void sectionTitle5_()
- {
+ public void sectionTitle5_() {
this.type = 0;
}
/**
* {@inheritDoc}
*/
- public void section5_()
- {
+ public void section5_() {
pop();
}
@@ -298,10 +290,8 @@ public class IndexingSink
// }
/** {@inheritDoc} */
- public void text( String text )
- {
- switch ( this.type )
- {
+ public void text(String text) {
+ switch (this.type) {
case TITLE:
this.title = text;
break;
@@ -318,13 +308,13 @@ public class IndexingSink
IndexEntry entry = stack.lastElement();
String title = entry.getTitle() + text;
- title = title.replaceAll( "[\\r\\n]+", "" );
- entry.setTitle( title );
+ title = title.replaceAll("[\\r\\n]+", "");
+ entry.setTitle(title);
- entry.setId( getUniqueId ( HtmlTools.encodeId( title ) ) );
+ entry.setId(getUniqueId(HtmlTools.encodeId(title)));
break;
- // Dunno how to handle these yet
+ // Dunno how to handle these yet
case TYPE_DEFINED_TERM:
case TYPE_FIGURE:
case TYPE_TABLE:
@@ -339,17 +329,13 @@ public class IndexingSink
* @param id
* @return the unique id
*/
- String getUniqueId( String id )
- {
+ String getUniqueId(String id) {
final String uniqueId;
- if ( usedIds.containsKey( id ) )
- {
- uniqueId = id + "_" + usedIds.get( id ).incrementAndGet();
- }
- else
- {
- usedIds.put( id, new AtomicInteger() );
+ if (usedIds.containsKey(id)) {
+ uniqueId = id + "_" + usedIds.get(id).incrementAndGet();
+ } else {
+ usedIds.put(id, new AtomicInteger());
uniqueId = id;
}
return uniqueId;
@@ -358,13 +344,12 @@ public class IndexingSink
/**
* Creates and pushes a new IndexEntry onto the top of this stack.
*/
- public void pushNewEntry()
- {
- IndexEntry entry = new IndexEntry( peek(), "" );
+ public void pushNewEntry() {
+ IndexEntry entry = new IndexEntry(peek(), "");
- entry.setTitle( "" );
+ entry.setTitle("");
- stack.push( entry );
+ stack.push(entry);
}
/**
@@ -372,16 +357,14 @@ public class IndexingSink
*
* @param entry to put.
*/
- public void push( IndexEntry entry )
- {
- stack.push( entry );
+ public void push(IndexEntry entry) {
+ stack.push(entry);
}
/**
* Removes the IndexEntry at the top of this stack.
*/
- public void pop()
- {
+ public void pop() {
stack.pop();
}
@@ -390,16 +373,14 @@ public class IndexingSink
*
* @return Looks at the IndexEntry at the top of this stack.
*/
- public IndexEntry peek()
- {
+ public IndexEntry peek() {
return stack.peek();
}
/**
* {@inheritDoc}
*/
- public void close()
- {
+ public void close() {
super.close();
init();
@@ -408,8 +389,7 @@ public class IndexingSink
/**
* {@inheritDoc}
*/
- protected void init()
- {
+ protected void init() {
this.type = 0;
this.title = null;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
index 22d7a5e1..87e42c37 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro;
/*
@@ -30,9 +48,7 @@ import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public abstract class AbstractMacro
- implements Macro
-{
+public abstract class AbstractMacro implements Macro {
/**
* Convert the Map of macro parameters to an AttributeSet.
* No check of validity is done, all parameters are added.
@@ -42,25 +58,21 @@ public abstract class AbstractMacro
* or null if parameters is null.
* @since 1.1.1.
*/
- protected static SinkEventAttributes getAttributesFromMap( Map<?, ?> parameters )
- {
- if ( parameters == null )
- {
+ protected static SinkEventAttributes getAttributesFromMap(Map<?, ?> parameters) {
+ if (parameters == null) {
return null;
}
final int count = parameters.size();
- if ( count <= 0 )
- {
+ if (count <= 0) {
return null;
}
- final SinkEventAttributeSet atts = new SinkEventAttributeSet( count );
+ final SinkEventAttributeSet atts = new SinkEventAttributeSet(count);
- for ( Map.Entry<?, ?> entry : parameters.entrySet() )
- {
- atts.addAttribute( entry.getKey(), entry.getValue() );
+ for (Map.Entry<?, ?> entry : parameters.entrySet()) {
+ atts.addAttribute(entry.getKey(), entry.getValue());
}
return atts;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java
index 0cacafbf..f276b961 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/EchoMacro.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro;
/*
@@ -29,26 +47,21 @@ import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
* A simple macro that prints out the key and value of some supplied parameters.
*/
@Singleton
-@Named( "echo" )
-public class EchoMacro
- extends AbstractMacro
-{
+@Named("echo")
+public class EchoMacro extends AbstractMacro {
/** {@inheritDoc} */
- public void execute( Sink sink, MacroRequest request )
- {
- sink.verbatim( SinkEventAttributeSet.BOXED );
+ public void execute(Sink sink, MacroRequest request) {
+ sink.verbatim(SinkEventAttributeSet.BOXED);
- sink.text( "echo" + EOL );
+ sink.text("echo" + EOL);
- for ( String key : request.getParameters().keySet() )
- {
+ for (String key : request.getParameters().keySet()) {
// TODO: DOXIA-242: separate or define internal params
- if ( "parser".equals( key ) || "sourceContent".equals( key ) )
- {
+ if ("parser".equals(key) || "sourceContent".equals(key)) {
continue;
}
- sink.text( key + " ---> " + request.getParameter( key ) + EOL );
+ sink.text(key + " ---> " + request.getParameter(key) + EOL);
}
sink.verbatim_();
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
index 2ae82096..ff060e18 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro;
/*
@@ -27,11 +45,10 @@ import org.apache.maven.doxia.sink.Sink;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public interface Macro
-{
+public interface Macro {
/** The vm line separator */
- String EOL = System.getProperty( "line.separator" );
+ String EOL = System.getProperty("line.separator");
/**
* Execute the current macro using the given MacroRequest,
@@ -41,6 +58,5 @@ public interface Macro
* @param request The corresponding MacroRequest.
* @throws org.apache.maven.doxia.macro.MacroExecutionException if an error occurred during execution.
*/
- void execute( Sink sink, MacroRequest request )
- throws MacroExecutionException;
+ void execute(Sink sink, MacroRequest request) throws MacroExecutionException;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroExecutionException.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroExecutionException.java
index 429ef718..4135005c 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroExecutionException.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroExecutionException.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro;
/*
@@ -25,9 +43,7 @@ package org.apache.maven.doxia.macro;
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @since 1.0
*/
-public class MacroExecutionException
- extends Exception
-{
+public class MacroExecutionException extends Exception {
/** serialVersionUID */
static final long serialVersionUID = -6314856898570018814L;
@@ -38,9 +54,8 @@ public class MacroExecutionException
* <code>Throwable.getCause()</code> method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public MacroExecutionException( Throwable cause )
- {
- super( cause );
+ public MacroExecutionException(Throwable cause) {
+ super(cause);
}
/**
@@ -49,9 +64,8 @@ public class MacroExecutionException
* @param message The detailed message.
* This can later be retrieved by the <code>Throwable.getMessage()</code> method.
*/
- public MacroExecutionException( String message )
- {
- super( message );
+ public MacroExecutionException(String message) {
+ super(message);
}
/**
@@ -64,8 +78,7 @@ public class MacroExecutionException
* <code>Throwable.getCause()</code> method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public MacroExecutionException( String message, Throwable cause )
- {
- super( message, cause );
+ public MacroExecutionException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroRequest.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroRequest.java
index 53255ad0..4c759fc9 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroRequest.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/MacroRequest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro;
/*
@@ -19,21 +37,19 @@ package org.apache.maven.doxia.macro;
* under the License.
*/
+import java.io.File;
import java.util.Map;
import org.apache.maven.doxia.parser.AbstractParser;
import org.apache.maven.doxia.parser.Parser;
-import java.io.File;
-
/**
* <p>MacroRequest class.</p>
*
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public class MacroRequest
-{
+public class MacroRequest {
private static final String PARAM_SOURCE_CONTENT = "sourceContent";
private static final String PARAM_PARSER = "parser";
@@ -51,13 +67,12 @@ public class MacroRequest
* @param param a {@link java.util.Map} object.
* @param basedir a {@link java.io.File} object.
*/
- public MacroRequest( String sourceContent, AbstractParser parser, Map<String, Object> param, File basedir )
- {
+ public MacroRequest(String sourceContent, AbstractParser parser, Map<String, Object> param, File basedir) {
this.parameters = param;
this.basedir = basedir;
- param.put( PARAM_SOURCE_CONTENT, sourceContent );
- parser.setSecondParsing( true );
- param.put( PARAM_PARSER, parser );
+ param.put(PARAM_SOURCE_CONTENT, sourceContent);
+ parser.setSecondParsing(true);
+ param.put(PARAM_PARSER, parser);
}
/**
@@ -65,8 +80,7 @@ public class MacroRequest
*
* @return The base dir.
*/
- public File getBasedir()
- {
+ public File getBasedir() {
return basedir;
}
@@ -75,8 +89,7 @@ public class MacroRequest
*
* @param base The current base directory.
*/
- public void setBasedir( File base )
- {
+ public void setBasedir(File base) {
this.basedir = base;
}
@@ -85,8 +98,7 @@ public class MacroRequest
*
* @return The map of parameters.
*/
- public Map<String, Object> getParameters()
- {
+ public Map<String, Object> getParameters() {
return parameters;
}
@@ -97,9 +109,8 @@ public class MacroRequest
* @param key The key to lookup the object.
* @return The value object.
*/
- public Object getParameter( String key )
- {
- return parameters.get( key );
+ public Object getParameter(String key) {
+ return parameters.get(key);
}
/**
@@ -107,9 +118,8 @@ public class MacroRequest
*
* @return a {@link java.lang.String} object.
*/
- public String getSourceContent()
- {
- return (String) getParameter( PARAM_SOURCE_CONTENT );
+ public String getSourceContent() {
+ return (String) getParameter(PARAM_SOURCE_CONTENT);
}
/**
@@ -117,9 +127,8 @@ public class MacroRequest
*
* @return a {@link org.apache.maven.doxia.parser.Parser} object.
*/
- public Parser getParser()
- {
- return (Parser) getParameter( PARAM_PARSER );
+ public Parser getParser() {
+ return (Parser) getParameter(PARAM_PARSER);
}
/**
@@ -128,8 +137,7 @@ public class MacroRequest
* @param name a {@link java.lang.String} object.
* @return a boolean.
*/
- public static boolean isInternalParameter( String name )
- {
- return PARAM_PARSER.equals( name ) || PARAM_SOURCE_CONTENT.equals( name );
+ public static boolean isInternalParameter(String name) {
+ return PARAM_PARSER.equals(name) || PARAM_SOURCE_CONTENT.equals(name);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
index 1e0b7e74..31ecfe63 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.manager;
/*
@@ -23,10 +41,10 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.apache.maven.doxia.macro.Macro;
-
import java.util.Map;
+import org.apache.maven.doxia.macro.Macro;
+
/**
* Default implementation of <code>MacroManager</code>
*
@@ -35,22 +53,17 @@ import java.util.Map;
*/
@Singleton
@Named
-public class DefaultMacroManager
- implements MacroManager
-{
- @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
+public class DefaultMacroManager implements MacroManager {
+ @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@Inject
private Map<String, Macro> macros;
/** {@inheritDoc} */
- public Macro getMacro( String id )
- throws MacroNotFoundException
- {
- Macro macro = macros.get( id );
-
- if ( macro == null )
- {
- throw new MacroNotFoundException( "Cannot find macro with id = " + id );
+ public Macro getMacro(String id) throws MacroNotFoundException {
+ Macro macro = macros.get(id);
+
+ if (macro == null) {
+ throw new MacroNotFoundException("Cannot find macro with id = " + id);
}
return macro;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroManager.java
index fe5b2466..e8ec27b8 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.manager;
/*
@@ -27,8 +45,7 @@ import org.apache.maven.doxia.macro.Macro;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public interface MacroManager
-{
+public interface MacroManager {
/**
* Returns the MacroManager that corresponds to the given id.
@@ -38,7 +55,5 @@ public interface MacroManager
* @throws org.apache.maven.doxia.macro.manager.MacroNotFoundException if no MacroManager could be found
* for the given id.
*/
- Macro getMacro( String id )
- throws MacroNotFoundException;
-
+ Macro getMacro(String id) throws MacroNotFoundException;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroNotFoundException.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroNotFoundException.java
index 7c7337a8..c769674f 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroNotFoundException.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/MacroNotFoundException.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.manager;
/*
@@ -26,9 +44,7 @@ package org.apache.maven.doxia.macro.manager;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public class MacroNotFoundException
- extends Exception
-{
+public class MacroNotFoundException extends Exception {
/** serialVersionUID */
static final long serialVersionUID = 295967936746221567L;
@@ -38,9 +54,8 @@ public class MacroNotFoundException
* @param message The detailed message.
* This can later be retrieved by the Throwable.getMessage() method.
*/
- public MacroNotFoundException( String message )
- {
- super( message );
+ public MacroNotFoundException(String message) {
+ super(message);
}
/**
@@ -51,9 +66,8 @@ public class MacroNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public MacroNotFoundException( Throwable cause )
- {
- super( cause );
+ public MacroNotFoundException(Throwable cause) {
+ super(cause);
}
/**
@@ -66,8 +80,7 @@ public class MacroNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public MacroNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
+ public MacroNotFoundException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
index 01a718b2..b5e4b231 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.snippet;
/*
@@ -22,6 +40,13 @@ package org.apache.maven.doxia.macro.snippet;
import javax.inject.Named;
import javax.inject.Singleton;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.maven.doxia.macro.AbstractMacro;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
@@ -31,22 +56,13 @@ import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* A macro that prints out the content of a file or a URL.
*/
@Singleton
-@Named( "snippet" )
-public class SnippetMacro
- extends AbstractMacro
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( SnippetMacro.class );
+@Named("snippet")
+public class SnippetMacro extends AbstractMacro {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SnippetMacro.class);
/**
* Holds the cache.
@@ -76,98 +92,75 @@ public class SnippetMacro
private boolean ignoreDownloadError = true;
/** {@inheritDoc} */
- public void execute( Sink sink, MacroRequest request )
- throws MacroExecutionException
- {
- String id = (String) request.getParameter( "id" );
+ public void execute(Sink sink, MacroRequest request) throws MacroExecutionException {
+ String id = (String) request.getParameter("id");
- String urlParam = (String) request.getParameter( "url" );
+ String urlParam = (String) request.getParameter("url");
- String fileParam = (String) request.getParameter( "file" );
+ String fileParam = (String) request.getParameter("file");
- String debugParam = (String) request.getParameter( "debug" );
+ String debugParam = (String) request.getParameter("debug");
- if ( debugParam != null )
- {
- this.debug = Boolean.parseBoolean( debugParam );
+ if (debugParam != null) {
+ this.debug = Boolean.parseBoolean(debugParam);
}
- String ignoreDownloadErrorParam = (String) request.getParameter( "ignoreDownloadError" );
+ String ignoreDownloadErrorParam = (String) request.getParameter("ignoreDownloadError");
- if ( ignoreDownloadErrorParam != null )
- {
- this.ignoreDownloadError = Boolean.parseBoolean( ignoreDownloadErrorParam );
+ if (ignoreDownloadErrorParam != null) {
+ this.ignoreDownloadError = Boolean.parseBoolean(ignoreDownloadErrorParam);
}
boolean verbatim = true;
- String verbatimParam = (String) request.getParameter( "verbatim" );
+ String verbatimParam = (String) request.getParameter("verbatim");
- if ( verbatimParam != null && !"".equals( verbatimParam ) )
- {
- verbatim = Boolean.valueOf( verbatimParam );
+ if (verbatimParam != null && !"".equals(verbatimParam)) {
+ verbatim = Boolean.valueOf(verbatimParam);
}
- String encoding = (String) request.getParameter( "encoding" );
+ String encoding = (String) request.getParameter("encoding");
URL url;
- if ( !StringUtils.isEmpty( urlParam ) )
- {
- try
- {
- url = new URL( urlParam );
- }
- catch ( MalformedURLException e )
- {
- throw new IllegalArgumentException( urlParam + " is a malformed URL", e );
+ if (!StringUtils.isEmpty(urlParam)) {
+ try {
+ url = new URL(urlParam);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException(urlParam + " is a malformed URL", e);
}
- }
- else if ( !StringUtils.isEmpty( fileParam ) )
- {
- File f = new File( fileParam );
+ } else if (!StringUtils.isEmpty(fileParam)) {
+ File f = new File(fileParam);
- if ( !f.isAbsolute() )
- {
- f = new File( request.getBasedir(), fileParam );
+ if (!f.isAbsolute()) {
+ f = new File(request.getBasedir(), fileParam);
}
- try
- {
+ try {
url = f.toURI().toURL();
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException(fileParam + " is a malformed URL", e);
}
- catch ( MalformedURLException e )
- {
- throw new IllegalArgumentException( fileParam + " is a malformed URL", e );
- }
- }
- else
- {
- throw new IllegalArgumentException( "Either the 'url' or the 'file' param has to be given." );
+ } else {
+ throw new IllegalArgumentException("Either the 'url' or the 'file' param has to be given.");
}
StringBuffer snippet;
- try
- {
- snippet = getSnippet( url, encoding, id );
- }
- catch ( IOException e )
- {
- throw new MacroExecutionException( "Error reading snippet", e );
+ try {
+ snippet = getSnippet(url, encoding, id);
+ } catch (IOException e) {
+ throw new MacroExecutionException("Error reading snippet", e);
}
- if ( verbatim )
- {
- sink.verbatim( SinkEventAttributeSet.BOXED );
+ if (verbatim) {
+ sink.verbatim(SinkEventAttributeSet.BOXED);
- sink.text( snippet.toString() );
+ sink.text(snippet.toString());
sink.verbatim_();
- }
- else
- {
- sink.rawText( snippet.toString() );
+ } else {
+ sink.rawText(snippet.toString());
}
}
@@ -180,43 +173,31 @@ public class SnippetMacro
* @return The snippet.
* @throws IOException if something goes wrong.
*/
- private StringBuffer getSnippet( URL url, String encoding, String id )
- throws IOException
- {
+ private StringBuffer getSnippet(URL url, String encoding, String id) throws IOException {
StringBuffer result;
- String cachedSnippet = getCachedSnippet( url, id );
+ String cachedSnippet = getCachedSnippet(url, id);
- if ( cachedSnippet != null )
- {
- result = new StringBuffer( cachedSnippet );
+ if (cachedSnippet != null) {
+ result = new StringBuffer(cachedSnippet);
- if ( debug )
- {
- result.append( "(Served from cache)" );
- }
- }
- else
- {
- try
- {
- result = new SnippetReader( url, encoding ).readSnippet( id );
- cacheSnippet( url, id, result.toString() );
- if ( debug )
- {
- result.append( "(Fetched from url, cache content " ).append( cache ).append( ")" );
- }
+ if (debug) {
+ result.append("(Served from cache)");
}
- catch ( IOException e )
- {
- if ( ignoreDownloadError )
- {
- LOGGER.debug( "Exception while reading '{}'", url, e );
- result =
- new StringBuffer( "Error during retrieving content skip as ignoreDownloadError activated." );
+ } else {
+ try {
+ result = new SnippetReader(url, encoding).readSnippet(id);
+ cacheSnippet(url, id, result.toString());
+ if (debug) {
+ result.append("(Fetched from url, cache content ")
+ .append(cache)
+ .append(")");
}
- else
- {
+ } catch (IOException e) {
+ if (ignoreDownloadError) {
+ LOGGER.debug("Exception while reading '{}'", url, e);
+ result = new StringBuffer("Error during retrieving content skip as ignoreDownloadError activated.");
+ } else {
throw e;
}
}
@@ -231,13 +212,11 @@ public class SnippetMacro
* @param id The id of the snippet.
* @return The snippet.
*/
- private String getCachedSnippet( URL url, String id )
- {
- if ( isCacheTimedout( url, id ) )
- {
- removeFromCache( url, id );
+ private String getCachedSnippet(URL url, String id) {
+ if (isCacheTimedout(url, id)) {
+ removeFromCache(url, id);
}
- return cache.get( globalSnippetId( url, id ) );
+ return cache.get(globalSnippetId(url, id));
}
/**
@@ -248,9 +227,8 @@ public class SnippetMacro
* @param id The id of the snippet.
* @return True if timeout exceeded.
*/
- boolean isCacheTimedout( URL url, String id )
- {
- return timeInCache( url, id ) >= timeout;
+ boolean isCacheTimedout(URL url, String id) {
+ return timeInCache(url, id) >= timeout;
}
/**
@@ -260,9 +238,8 @@ public class SnippetMacro
* @param id The id of the snippet.
* @return The cache time.
*/
- long timeInCache( URL url, String id )
- {
- return System.currentTimeMillis() - getTimeCached( url, id );
+ long timeInCache(URL url, String id) {
+ return System.currentTimeMillis() - getTimeCached(url, id);
}
/**
@@ -272,11 +249,10 @@ public class SnippetMacro
* @param id The id of the snippet.
* @return The cache time.
*/
- long getTimeCached( URL url, String id )
- {
- String globalId = globalSnippetId( url, id );
+ long getTimeCached(URL url, String id) {
+ String globalId = globalSnippetId(url, id);
- return timeCached.containsKey( globalId ) ? timeCached.get( globalId ) : 0;
+ return timeCached.containsKey(globalId) ? timeCached.get(globalId) : 0;
}
/**
@@ -285,13 +261,12 @@ public class SnippetMacro
* @param url The URL to parse.
* @param id The id of the snippet.
*/
- private void removeFromCache( URL url, String id )
- {
- String globalId = globalSnippetId( url, id );
+ private void removeFromCache(URL url, String id) {
+ String globalId = globalSnippetId(url, id);
- timeCached.remove( globalId );
+ timeCached.remove(globalId);
- cache.remove( globalId );
+ cache.remove(globalId);
}
/**
@@ -302,10 +277,8 @@ public class SnippetMacro
* @return An identifier, concatenated url and id,
* or just url.toString() if id is empty or null.
*/
- private String globalSnippetId( URL url, String id )
- {
- if ( StringUtils.isEmpty( id ) )
- {
+ private String globalSnippetId(URL url, String id) {
+ if (StringUtils.isEmpty(id)) {
return url.toString();
}
@@ -319,11 +292,10 @@ public class SnippetMacro
* @param id The id of the snippet.
* @param content The content of the snippet.
*/
- public void cacheSnippet( URL url, String id, String content )
- {
- cache.put( globalSnippetId( url, id ), content );
+ public void cacheSnippet(URL url, String id, String content) {
+ cache.put(globalSnippetId(url, id), content);
- timeCached.put( globalSnippetId( url, id ), System.currentTimeMillis() );
+ timeCached.put(globalSnippetId(url, id), System.currentTimeMillis());
}
/**
@@ -331,8 +303,7 @@ public class SnippetMacro
*
* @param time The timeout to set.
*/
- public void setCacheTimeout( int time )
- {
+ public void setCacheTimeout(int time) {
this.timeout = time;
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetReader.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetReader.java
index c313bd61..02601378 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetReader.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetReader.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.snippet;
/*
@@ -27,16 +45,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
-import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
/**
* Utility class for reading snippets.
*/
-public class SnippetReader
-{
+public class SnippetReader {
/** System-dependent EOL. */
- private static final String EOL = System.getProperty( "line.separator" );
+ private static final String EOL = System.getProperty("line.separator");
/** The source. */
private URL source;
@@ -50,8 +67,7 @@ public class SnippetReader
* @param src The source
* @param encoding The file encoding
*/
- public SnippetReader( URL src, String encoding )
- {
+ public SnippetReader(URL src, String encoding) {
this.source = src;
this.encoding = encoding;
}
@@ -61,9 +77,8 @@ public class SnippetReader
*
* @param src The source
*/
- public SnippetReader( URL src )
- {
- this( src, null ) ;
+ public SnippetReader(URL src) {
+ this(src, null);
}
/**
@@ -73,16 +88,13 @@ public class SnippetReader
* @return The snippet.
* @throws java.io.IOException if something goes wrong.
*/
- public StringBuffer readSnippet( String snippetId )
- throws IOException
- {
- List<String> lines = readLines( snippetId );
- int minIndent = minIndent( lines );
+ public StringBuffer readSnippet(String snippetId) throws IOException {
+ List<String> lines = readLines(snippetId);
+ int minIndent = minIndent(lines);
StringBuffer result = new StringBuffer();
- for ( String line : lines )
- {
- result.append( line.substring( minIndent ) );
- result.append( EOL );
+ for (String line : lines) {
+ result.append(line.substring(minIndent));
+ result.append(EOL);
}
return result;
}
@@ -93,12 +105,10 @@ public class SnippetReader
* @param lines A List of lines.
* @return the minimal indent.
*/
- int minIndent( List<String> lines )
- {
+ int minIndent(List<String> lines) {
int minIndent = Integer.MAX_VALUE;
- for ( String line : lines )
- {
- minIndent = Math.min( minIndent, indent( line ) );
+ for (String line : lines) {
+ minIndent = Math.min(minIndent, indent(line));
}
return minIndent;
}
@@ -109,14 +119,11 @@ public class SnippetReader
* @param line A line.
* @return the indent.
*/
- int indent( String line )
- {
+ int indent(String line) {
char[] chars = line.toCharArray();
int indent = 0;
- for ( ; indent < chars.length; indent++ )
- {
- if ( chars[indent] != ' ' )
- {
+ for (; indent < chars.length; indent++) {
+ if (chars[indent] != ' ') {
break;
}
}
@@ -130,64 +137,45 @@ public class SnippetReader
* @return A List of lines.
* @throws IOException if something goes wrong.
*/
- private List<String> readLines( String snippetId )
- throws IOException
- {
+ private List<String> readLines(String snippetId) throws IOException {
BufferedReader reader;
- if ( encoding == null || "".equals( encoding ) )
- {
- reader = new BufferedReader( new InputStreamReader( source.openStream() ) );
- }
- else
- {
- reader = new BufferedReader( new InputStreamReader( source.openStream(), encoding ) );
+ if (encoding == null || "".equals(encoding)) {
+ reader = new BufferedReader(new InputStreamReader(source.openStream()));
+ } else {
+ reader = new BufferedReader(new InputStreamReader(source.openStream(), encoding));
}
List<String> lines = new ArrayList<>();
- try
- {
+ try {
boolean capture = false;
String line;
boolean foundStart = false;
boolean foundEnd = false;
- boolean hasSnippetId = StringUtils.isNotEmpty( snippetId );
- while ( ( line = reader.readLine() ) != null )
- {
- if ( !hasSnippetId )
- {
- lines.add( line );
- }
- else
- {
- if ( isStart( snippetId, line ) )
- {
+ boolean hasSnippetId = StringUtils.isNotEmpty(snippetId);
+ while ((line = reader.readLine()) != null) {
+ if (!hasSnippetId) {
+ lines.add(line);
+ } else {
+ if (isStart(snippetId, line)) {
capture = true;
foundStart = true;
- }
- else if ( isEnd( snippetId, line ) )
- {
+ } else if (isEnd(snippetId, line)) {
foundEnd = true;
break;
- }
- else if ( capture )
- {
- lines.add( line );
+ } else if (capture) {
+ lines.add(line);
}
}
}
- if ( hasSnippetId && !foundStart )
- {
- throw new IOException( "Failed to find START of snippet " + snippetId + " in file at URL: " + source );
+ if (hasSnippetId && !foundStart) {
+ throw new IOException("Failed to find START of snippet " + snippetId + " in file at URL: " + source);
}
- if ( hasSnippetId && !foundEnd )
- {
- throw new IOException( "Failed to find END of snippet " + snippetId + " in file at URL: " + source );
+ if (hasSnippetId && !foundEnd) {
+ throw new IOException("Failed to find END of snippet " + snippetId + " in file at URL: " + source);
}
- }
- finally
- {
- IOUtil.close( reader );
+ } finally {
+ IOUtil.close(reader);
}
return lines;
}
@@ -199,9 +187,8 @@ public class SnippetReader
* @param line the line.
* @return True, if the line is a start demarcator.
*/
- protected boolean isStart( String snippetId, String line )
- {
- return isDemarcator( snippetId, "START", line );
+ protected boolean isStart(String snippetId, String line) {
+ return isDemarcator(snippetId, "START", line);
}
/**
@@ -212,17 +199,16 @@ public class SnippetReader
* @param line the line.
* @return True, if the line is a start demarcator.
*/
- protected static boolean isDemarcator( String snippetId, String what, String line )
- {
+ protected static boolean isDemarcator(String snippetId, String what, String line) {
// SNIPPET and what are case insensitive
// SNIPPET and what can switch order
String snippetRegExp = "(^|\\W)(?i:SNIPPET)($|\\W)";
String snippetIdRegExp = "(^|\\W)" + snippetId + "($|\\W)";
String whatRegExp = "(^|\\W)(?i:" + what + ")($|\\W)";
-
- return Pattern.compile( snippetRegExp ).matcher( line ).find()
- && Pattern.compile( whatRegExp ).matcher( line ).find()
- && Pattern.compile( snippetIdRegExp ).matcher( line ).find();
+
+ return Pattern.compile(snippetRegExp).matcher(line).find()
+ && Pattern.compile(whatRegExp).matcher(line).find()
+ && Pattern.compile(snippetIdRegExp).matcher(line).find();
}
/**
@@ -232,8 +218,7 @@ public class SnippetReader
* @param line the line.
* @return True, if the line is an end demarcator.
*/
- protected boolean isEnd( String snippetId, String line )
- {
- return isDemarcator( snippetId, "END", line );
+ protected boolean isEnd(String snippetId, String line) {
+ return isDemarcator(snippetId, "END", line);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
index e03efd21..5b40fab8 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/toc/TocMacro.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.macro.toc;
/*
@@ -29,11 +47,10 @@ import org.apache.maven.doxia.index.IndexingSink;
import org.apache.maven.doxia.macro.AbstractMacro;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
-import org.apache.maven.doxia.util.HtmlTools;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.Sink;
-
+import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -78,10 +95,8 @@ import org.codehaus.plexus.util.StringUtils;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
*/
@Singleton
-@Named( "toc" )
-public class TocMacro
- extends AbstractMacro
-{
+@Named("toc")
+public class TocMacro extends AbstractMacro {
/** The section to display. */
private int section;
@@ -95,44 +110,35 @@ public class TocMacro
private static final int DEFAULT_DEPTH = 5;
/** {@inheritDoc} */
- public void execute( Sink sink, MacroRequest request )
- throws MacroExecutionException
- {
+ public void execute(Sink sink, MacroRequest request) throws MacroExecutionException {
String source = request.getSourceContent();
Parser parser = request.getParser();
- section = getInt( request, "section", 0 );
- fromDepth = getInt( request, "fromDepth", 0 );
- toDepth = getInt( request, "toDepth", DEFAULT_DEPTH );
+ section = getInt(request, "section", 0);
+ fromDepth = getInt(request, "fromDepth", 0);
+ toDepth = getInt(request, "toDepth", DEFAULT_DEPTH);
- if ( fromDepth > toDepth )
- {
+ if (fromDepth > toDepth) {
return;
}
- IndexEntry index = new IndexEntry( "index" );
- IndexingSink tocSink = new IndexingSink( index );
+ IndexEntry index = new IndexEntry("index");
+ IndexingSink tocSink = new IndexingSink(index);
- try
- {
- parser.parse( new StringReader( source ), tocSink );
- }
- catch ( ParseException e )
- {
- throw new MacroExecutionException( e );
+ try {
+ parser.parse(new StringReader(source), tocSink);
+ } catch (ParseException e) {
+ throw new MacroExecutionException(e);
}
- if ( index.getChildEntries().size() > 0 )
- {
- sink.list( getAttributesFromMap( request.getParameters() ) );
+ if (index.getChildEntries().size() > 0) {
+ sink.list(getAttributesFromMap(request.getParameters()));
int i = 1;
- for ( IndexEntry sectionIndex : index.getChildEntries() )
- {
- if ( ( i == section ) || ( section == 0 ) )
- {
- writeSubSectionN( sink, sectionIndex, 1 );
+ for (IndexEntry sectionIndex : index.getChildEntries()) {
+ if ((i == section) || (section == 0)) {
+ writeSubSectionN(sink, sectionIndex, 1);
}
i++;
@@ -147,50 +153,39 @@ public class TocMacro
* @param sectionIndex The section index.
* @param n The toc depth.
*/
- private void writeSubSectionN( Sink sink, IndexEntry sectionIndex, int n )
- {
- if ( fromDepth <= n )
- {
+ private void writeSubSectionN(Sink sink, IndexEntry sectionIndex, int n) {
+ if (fromDepth <= n) {
sink.listItem();
- sink.link( "#" + HtmlTools.encodeId( sectionIndex.getId() ) );
- sink.text( sectionIndex.getTitle() );
+ sink.link("#" + HtmlTools.encodeId(sectionIndex.getId()));
+ sink.text(sectionIndex.getTitle());
sink.link_();
}
- if ( toDepth > n )
- {
- if ( sectionIndex.getChildEntries().size() > 0 )
- {
- if ( fromDepth <= n )
- {
+ if (toDepth > n) {
+ if (sectionIndex.getChildEntries().size() > 0) {
+ if (fromDepth <= n) {
sink.list();
}
- for ( IndexEntry subsectionIndex : sectionIndex.getChildEntries() )
- {
- if ( n == toDepth - 1 )
- {
+ for (IndexEntry subsectionIndex : sectionIndex.getChildEntries()) {
+ if (n == toDepth - 1) {
sink.listItem();
- sink.link( "#" + HtmlTools.encodeId( subsectionIndex.getId() ) );
- sink.text( subsectionIndex.getTitle() );
+ sink.link("#" + HtmlTools.encodeId(subsectionIndex.getId()));
+ sink.text(subsectionIndex.getTitle());
sink.link_();
sink.listItem_();
- }
- else
- {
- writeSubSectionN( sink, subsectionIndex, n + 1 );
+ } else {
+ writeSubSectionN(sink, subsectionIndex, n + 1);
}
}
- if ( fromDepth <= n )
- {
+ if (fromDepth <= n) {
sink.list_();
}
}
}
- if ( fromDepth <= n )
- {
+ if (fromDepth <= n) {
sink.listItem_();
}
}
@@ -202,30 +197,23 @@ public class TocMacro
* @return the int value of a parameter in the request.
* @throws MacroExecutionException if something goes wrong.
*/
- private static int getInt( MacroRequest request, String parameter, int defaultValue )
- throws MacroExecutionException
- {
- String value = (String) request.getParameter( parameter );
+ private static int getInt(MacroRequest request, String parameter, int defaultValue) throws MacroExecutionException {
+ String value = (String) request.getParameter(parameter);
- if ( StringUtils.isEmpty( value ) )
- {
+ if (StringUtils.isEmpty(value)) {
return defaultValue;
}
int i;
- try
- {
- i = Integer.parseInt( value );
- }
- catch ( NumberFormatException e )
- {
+ try {
+ i = Integer.parseInt(value);
+ } catch (NumberFormatException e) {
return defaultValue;
}
- if ( i < 0 )
- {
- throw new MacroExecutionException( "The " + parameter + "=" + i + " should be positive." );
+ if (i < 0) {
+ throw new MacroExecutionException("The " + parameter + "=" + i + " should be positive.");
}
return i;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java b/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java
index fb9f19cf..0d376db9 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/markup/HtmlMarkup.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.markup;
/*
@@ -21,7 +39,6 @@ package org.apache.maven.doxia.markup;
import javax.swing.text.html.HTML.Tag;
-
/**
* List of <code>Html</code> tags.
* <p>
@@ -35,10 +52,8 @@ import javax.swing.text.html.HTML.Tag;
* @author ltheussl
* @since 1.0
*/
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface HtmlMarkup
- extends XmlMarkup
-{
+@SuppressWarnings("checkstyle:interfaceistype")
+public interface HtmlMarkup extends XmlMarkup {
/** A simple HTML tag. Eg <code><br/></code>. */
int TAG_TYPE_SIMPLE = 1;
@@ -71,12 +86,10 @@ public interface HtmlMarkup
Tag A = Tag.A;
/** HTML5 tag for <code>abbr</code>. */
- Tag ABBR = new Tag()
- {
+ Tag ABBR = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "abbr";
}
};
@@ -88,34 +101,28 @@ public interface HtmlMarkup
Tag AREA = Tag.AREA;
/** HTML5 tag for <code>article</code>. */
- Tag ARTICLE = new Tag()
- {
+ Tag ARTICLE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "article";
}
};
/** HTML5 tag for <code>aside</code>. */
- Tag ASIDE = new Tag()
- {
+ Tag ASIDE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "aside";
}
};
/** HTML5 tag for <code>audio</code>. */
- Tag AUDIO = new Tag()
- {
+ Tag AUDIO = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "audio";
}
};
@@ -127,23 +134,19 @@ public interface HtmlMarkup
Tag BASE = Tag.BASE;
/** HTML5 tag for <code>bdi</code>. */
- Tag BDI = new Tag()
- {
+ Tag BDI = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "bdi";
}
};
/** HTML5 tag for <code>bdo</code>. */
- Tag BDO = new Tag()
- {
+ Tag BDO = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "bdo";
}
};
@@ -158,23 +161,19 @@ public interface HtmlMarkup
Tag BR = Tag.BR;
/** HTML5 tag for <code>button</code>. */
- Tag BUTTON = new Tag()
- {
+ Tag BUTTON = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "button";
}
};
/** HTML5 tag for <code>canvas</code>. */
- Tag CANVAS = new Tag()
- {
+ Tag CANVAS = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "canvas";
}
};
@@ -189,56 +188,46 @@ public interface HtmlMarkup
Tag CODE = Tag.CODE;
/** HTML5 tag for <code>col</code>. */
- Tag COL = new Tag()
- {
+ Tag COL = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "col";
}
};
/** HTML5 tag for <code>colgroup</code>. */
- Tag COLGROUP = new Tag()
- {
+ Tag COLGROUP = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "colgroup";
}
};
/** HTML5 tag for <code>command</code>. */
- Tag COMMAND = new Tag()
- {
+ Tag COMMAND = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "command";
}
};
/** HTML5 tag for <code>data</code>. */
- Tag DATA = new Tag()
- {
+ Tag DATA = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "data";
}
};
/** HTML5 tag for <code>datalist</code>. */
- Tag DATALIST = new Tag()
- {
+ Tag DATALIST = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "datalist";
}
};
@@ -247,23 +236,19 @@ public interface HtmlMarkup
Tag DD = Tag.DD;
/** HTML5 tag for <code>del</code>. */
- Tag DEL = new Tag()
- {
+ Tag DEL = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "del";
}
};
/** HTML5 tag for <code>details</code>. */
- Tag DETAILS = new Tag()
- {
+ Tag DETAILS = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "details";
}
};
@@ -272,12 +257,10 @@ public interface HtmlMarkup
Tag DFN = Tag.DFN;
/** HTML5 tag for <code>dialog</code>. */
- Tag DIALOG = new Tag()
- {
+ Tag DIALOG = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "dialog";
}
};
@@ -295,56 +278,46 @@ public interface HtmlMarkup
Tag EM = Tag.EM;
/** HTML5 tag for <code>embed</code>. */
- Tag EMBED = new Tag()
- {
+ Tag EMBED = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "embed";
}
};
/** HTML5 tag for <code>fieldset</code>. */
- Tag FIELDSET = new Tag()
- {
+ Tag FIELDSET = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "fieldset";
}
};
/** HTML5 tag for <code>figcaption</code>. */
- Tag FIGCAPTION = new Tag()
- {
+ Tag FIGCAPTION = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "figcaption";
}
};
/** HTML5 tag for <code>figure</code>. */
- Tag FIGURE = new Tag()
- {
+ Tag FIGURE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "figure";
}
};
/** HTML5 tag for <code>footer</code>. */
- Tag FOOTER = new Tag()
- {
+ Tag FOOTER = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "footer";
}
};
@@ -356,7 +329,7 @@ public interface HtmlMarkup
Tag H1 = Tag.H1;
/** HTML5 tag for <code>h2</code>. */
- Tag H2 = Tag.H2 ;
+ Tag H2 = Tag.H2;
/** HTML5 tag for <code>h3</code>. */
Tag H3 = Tag.H3;
@@ -371,23 +344,19 @@ public interface HtmlMarkup
Tag HEAD = Tag.HEAD;
/** HTML5 tag for <code>header</code>. */
- Tag HEADER = new Tag()
- {
+ Tag HEADER = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "header";
}
};
/** HTML5 tag for <code>hgroup</code>. */
- Tag HGROUP = new Tag()
- {
+ Tag HGROUP = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "hgroup";
}
};
@@ -402,12 +371,10 @@ public interface HtmlMarkup
Tag I = Tag.I;
/** HTML5 tag for <code>iframe</code>. */
- Tag IFRAME = new Tag()
- {
+ Tag IFRAME = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "iframe";
}
};
@@ -419,12 +386,10 @@ public interface HtmlMarkup
Tag INPUT = Tag.INPUT;
/** HTML5 tag for <code>ins</code>. */
- Tag INS = new Tag()
- {
+ Tag INS = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "ins";
}
};
@@ -433,34 +398,28 @@ public interface HtmlMarkup
Tag KBD = Tag.KBD;
/** HTML5 tag for <code>keygen</code>. */
- Tag KEYGEN = new Tag()
- {
+ Tag KEYGEN = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "keygen";
}
};
/** HTML5 tag for <code>label</code>. */
- Tag LABEL = new Tag()
- {
+ Tag LABEL = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "label";
}
};
/** HTML5 tag for <code>legend</code>. */
- Tag LEGEND = new Tag()
- {
+ Tag LEGEND = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "legend";
}
};
@@ -475,23 +434,19 @@ public interface HtmlMarkup
Tag MAP = Tag.MAP;
/** HTML5 tag for <code>main</code>. */
- Tag MAIN = new Tag()
- {
+ Tag MAIN = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "main";
}
};
/** HTML5 tag for <code>mark</code>. */
- Tag MARK = new Tag()
- {
+ Tag MARK = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "mark";
}
};
@@ -500,12 +455,10 @@ public interface HtmlMarkup
Tag MENU = Tag.MENU;
/** HTML5 tag for <code>menuitem</code>. */
- Tag MENUITEM = new Tag()
- {
+ Tag MENUITEM = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "menuitem";
}
};
@@ -514,34 +467,28 @@ public interface HtmlMarkup
Tag META = Tag.META;
/** HTML5 tag for <code>meter</code>. */
- Tag METER = new Tag()
- {
+ Tag METER = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "meter";
}
};
/** HTML5 tag for <code>nav</code>. */
- Tag NAV = new Tag()
- {
+ Tag NAV = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "nav";
}
};
/** HTML5 tag for <code>noscript</code>. */
- Tag NOSCRIPT = new Tag()
- {
+ Tag NOSCRIPT = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "noscript";
}
};
@@ -553,12 +500,10 @@ public interface HtmlMarkup
Tag OL = Tag.OL;
/** HTML5 tag for <code>optgroup</code>. */
- Tag OPTGROUP = new Tag()
- {
+ Tag OPTGROUP = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "optgroup";
}
};
@@ -567,12 +512,10 @@ public interface HtmlMarkup
Tag OPTION = Tag.OPTION;
/** HTML5 tag for <code>output</code>. */
- Tag OUTPUT = new Tag()
- {
+ Tag OUTPUT = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "output";
}
};
@@ -584,12 +527,10 @@ public interface HtmlMarkup
Tag PARAM = Tag.PARAM;
/** HTML5 tag for <code>picture</code>. */
- Tag PICTURE = new Tag()
- {
+ Tag PICTURE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "picture";
}
};
@@ -598,78 +539,64 @@ public interface HtmlMarkup
Tag PRE = Tag.PRE;
/** HTML5 tag for <code>progress</code>. */
- Tag PROGRESS = new Tag()
- {
+ Tag PROGRESS = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "progress";
}
};
/** HTML5 tag for <code>q</code>. */
- Tag Q = new Tag()
- {
+ Tag Q = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "q";
}
};
/** HTML5 tag for <code>rb</code>. */
- Tag RB = new Tag()
- {
+ Tag RB = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "rb";
}
};
/** HTML5 tag for <code>rp</code>. */
- Tag RP = new Tag()
- {
+ Tag RP = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "rp";
}
};
/** HTML5 tag for <code>rt</code>. */
- Tag RT = new Tag()
- {
+ Tag RT = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "rt";
}
};
/** HTML5 tag for <code>rtc</code>. */
- Tag RTC = new Tag()
- {
+ Tag RTC = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "rtc";
}
};
/** HTML5 tag for <code>ruby</code>. */
- Tag RUBY = new Tag()
- {
+ Tag RUBY = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "ruby";
}
};
@@ -684,12 +611,10 @@ public interface HtmlMarkup
Tag SCRIPT = Tag.SCRIPT;
/** HTML5 tag for <code>section</code>. */
- Tag SECTION = new Tag()
- {
+ Tag SECTION = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "section";
}
};
@@ -701,12 +626,10 @@ public interface HtmlMarkup
Tag SMALL = Tag.SMALL;
/** HTML5 tag for <code>source</code>. */
- Tag SOURCE = new Tag()
- {
+ Tag SOURCE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "source";
}
};
@@ -724,12 +647,10 @@ public interface HtmlMarkup
Tag SUB = Tag.SUB;
/** HTML5 tag for <code>summary</code>. */
- Tag SUMMARY = new Tag()
- {
+ Tag SUMMARY = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "summary";
}
};
@@ -738,12 +659,10 @@ public interface HtmlMarkup
Tag SUP = Tag.SUP;
/** HTML5 tag for <code>svg</code>. */
- Tag SVG = new Tag()
- {
+ Tag SVG = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "svg";
}
};
@@ -752,12 +671,10 @@ public interface HtmlMarkup
Tag TABLE = Tag.TABLE;
/** HTML5 tag for <code>tbody</code>. */
- Tag TBODY = new Tag()
- {
+ Tag TBODY = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "tbody";
}
};
@@ -766,12 +683,10 @@ public interface HtmlMarkup
Tag TD = Tag.TD;
/** HTML5 tag for <code>template</code>. */
- Tag TEMPLATE = new Tag()
- {
+ Tag TEMPLATE = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "template";
}
};
@@ -780,12 +695,10 @@ public interface HtmlMarkup
Tag TEXTAREA = Tag.TEXTAREA;
/** HTML5 tag for <code>tfoot</code>. */
- Tag TFOOT = new Tag()
- {
+ Tag TFOOT = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "tfoot";
}
};
@@ -794,23 +707,19 @@ public interface HtmlMarkup
Tag TH = Tag.TH;
/** HTML5 tag for <code>thead</code>. */
- Tag THEAD = new Tag()
- {
+ Tag THEAD = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "thead";
}
};
/** HTML5 tag for <code>time</code>. */
- Tag TIME = new Tag()
- {
+ Tag TIME = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "time";
}
};
@@ -822,12 +731,10 @@ public interface HtmlMarkup
Tag TR = Tag.TR;
/** HTML5 tag for <code>track</code>. */
- Tag TRACK = new Tag()
- {
+ Tag TRACK = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "track";
}
};
@@ -839,28 +746,23 @@ public interface HtmlMarkup
Tag UL = Tag.UL;
/** HTML5 tag for <code>var</code>. */
- Tag VAR = Tag.VAR ;
+ Tag VAR = Tag.VAR;
/** HTML5 tag for <code>video</code>. */
- Tag VIDEO = new Tag()
- {
+ Tag VIDEO = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "video";
}
};
/** HTML5 tag for <code>wbr</code>. */
- Tag WBR = new Tag()
- {
+ Tag WBR = new Tag() {
/** {@inheritDoc} */
@Override
- public String toString()
- {
+ public String toString() {
return "wbr";
}
};
-
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/markup/Markup.java b/doxia-core/src/main/java/org/apache/maven/doxia/markup/Markup.java
index 0eff103b..684bf015 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/markup/Markup.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/markup/Markup.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.markup;
/*
@@ -25,11 +43,10 @@ package org.apache.maven.doxia.markup;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface Markup
-{
+@SuppressWarnings("checkstyle:interfaceistype")
+public interface Markup {
/** The vm line separator */
- String EOL = System.getProperty( "line.separator" );
+ String EOL = System.getProperty("line.separator");
// ----------------------------------------------------------------------
// Generic separator characters
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/markup/TextMarkup.java b/doxia-core/src/main/java/org/apache/maven/doxia/markup/TextMarkup.java
index c7903589..e7b38f54 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/markup/TextMarkup.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/markup/TextMarkup.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.markup;
/*
@@ -25,10 +43,8 @@ package org.apache.maven.doxia.markup;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface TextMarkup
- extends Markup
-{
+@SuppressWarnings("checkstyle:interfaceistype")
+public interface TextMarkup extends Markup {
// ----------------------------------------------------------------------
// Text separator characters
// ----------------------------------------------------------------------
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/markup/XmlMarkup.java b/doxia-core/src/main/java/org/apache/maven/doxia/markup/XmlMarkup.java
index cb46b5a4..89f190d6 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/markup/XmlMarkup.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/markup/XmlMarkup.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.markup;
/*
@@ -19,17 +37,14 @@ package org.apache.maven.doxia.markup;
* under the License.
*/
-
/**
* List of constants used by <code>Xml</code> markup syntax.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface XmlMarkup
- extends Markup
-{
+@SuppressWarnings("checkstyle:interfaceistype")
+public interface XmlMarkup extends Markup {
/** XML namespace: "http://www.w3.org/2001/XMLSchema-instance" */
String XML_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
index 2b8b9dc9..32d42d67 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -26,7 +44,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
-
import java.util.Properties;
import org.apache.maven.doxia.macro.Macro;
@@ -43,9 +60,7 @@ import org.apache.maven.doxia.sink.Sink;
* @author Jason van Zyl
* @since 1.0
*/
-public abstract class AbstractParser
- implements Parser
-{
+public abstract class AbstractParser implements Parser {
/** Indicates that a second parsing is required. */
private boolean secondParsing = false;
@@ -59,40 +74,28 @@ public abstract class AbstractParser
private static final String DOXIA_VERSION;
- static
- {
+ static {
final Properties props = new Properties();
- final InputStream is = AbstractParser.class
- .getResourceAsStream( "/META-INF/maven/org.apache.maven.doxia/doxia-core/pom.properties" );
-
- if ( is == null )
- {
- props.setProperty( "version", "unknown" ); // should not happen
- }
- else
- {
- try
- {
- props.load( is );
- }
- catch ( IOException ex )
- {
- props.setProperty( "version", "unknown" ); // should not happen
- }
- finally
- {
- try
- {
+ final InputStream is = AbstractParser.class.getResourceAsStream(
+ "/META-INF/maven/org.apache.maven.doxia/doxia-core/pom.properties");
+
+ if (is == null) {
+ props.setProperty("version", "unknown"); // should not happen
+ } else {
+ try {
+ props.load(is);
+ } catch (IOException ex) {
+ props.setProperty("version", "unknown"); // should not happen
+ } finally {
+ try {
is.close();
- }
- catch ( IOException ex )
- {
+ } catch (IOException ex) {
// oh well...
}
}
}
- DOXIA_VERSION = props.getProperty( "version" );
+ DOXIA_VERSION = props.getProperty("version");
}
/**
@@ -100,14 +103,12 @@ public abstract class AbstractParser
*
* @return a int
*/
- public int getType()
- {
+ public int getType() {
return UNKNOWN_TYPE;
}
/** {@inheritDoc} */
- public void setEmitComments( boolean emitComments )
- {
+ public void setEmitComments(boolean emitComments) {
this.emitComments = emitComments;
}
@@ -116,8 +117,7 @@ public abstract class AbstractParser
*
* @return a boolean
*/
- public boolean isEmitComments()
- {
+ public boolean isEmitComments() {
return emitComments;
}
@@ -132,12 +132,11 @@ public abstract class AbstractParser
*/
// Made public right now because of the structure of the APT parser and
// all its inner classes.
- public void executeMacro( String macroId, MacroRequest request, Sink sink )
- throws MacroExecutionException, MacroNotFoundException
- {
- Macro macro = getMacroManager().getMacro( macroId );
+ public void executeMacro(String macroId, MacroRequest request, Sink sink)
+ throws MacroExecutionException, MacroNotFoundException {
+ Macro macro = getMacroManager().getMacro(macroId);
- macro.execute( sink, request );
+ macro.execute(sink, request);
}
/**
@@ -146,19 +145,17 @@ public abstract class AbstractParser
* @return the base directory
* @deprecated this does not work in multi-module builds, see DOXIA-373
*/
- protected File getBasedir()
- {
+ protected File getBasedir() {
// TODO: This is baaad, it should come in with the request.
// (this is only used for macro requests, see AptParser)
- String basedir = System.getProperty( "basedir" );
+ String basedir = System.getProperty("basedir");
- if ( basedir != null )
- {
- return new File( basedir );
+ if (basedir != null) {
+ return new File(basedir);
}
- return new File( new File( "" ).getAbsolutePath() );
+ return new File(new File("").getAbsolutePath());
}
/**
@@ -169,10 +166,8 @@ public abstract class AbstractParser
* @throws org.apache.maven.doxia.parser.ParseException if the string could not be parsed
* @since 1.1
*/
- public void parse( String string, Sink sink )
- throws ParseException
- {
- this.parse( string, sink, null );
+ public void parse(String string, Sink sink) throws ParseException {
+ this.parse(string, sink, null);
}
/**
@@ -184,18 +179,14 @@ public abstract class AbstractParser
* @throws org.apache.maven.doxia.parser.ParseException if the string could not be parsed
* @since 1.10
*/
- public void parse( String string, Sink sink, String reference )
- throws ParseException
- {
- parse( new StringReader( string ), sink, reference );
+ public void parse(String string, Sink sink, String reference) throws ParseException {
+ parse(new StringReader(string), sink, reference);
}
/** {@inheritDoc} */
@Override
- public void parse( Reader source, Sink sink )
- throws ParseException
- {
- parse( source, sink, null );
+ public void parse(Reader source, Sink sink) throws ParseException {
+ parse(source, sink, null);
}
/**
@@ -203,8 +194,7 @@ public abstract class AbstractParser
*
* @param second true for second parsing
*/
- public void setSecondParsing( boolean second )
- {
+ public void setSecondParsing(boolean second) {
this.secondParsing = second;
}
@@ -214,8 +204,7 @@ public abstract class AbstractParser
* @return true if we are currently parsing a second time
* @since 1.1
*/
- protected boolean isSecondParsing()
- {
+ protected boolean isSecondParsing() {
return secondParsing;
}
@@ -225,8 +214,7 @@ public abstract class AbstractParser
* @return the current {@link MacroManager}
* @since 1.1
*/
- protected MacroManager getMacroManager()
- {
+ protected MacroManager getMacroManager() {
return macroManager;
}
@@ -237,8 +225,7 @@ public abstract class AbstractParser
*
* @since 1.1.2
*/
- protected void init()
- {
+ protected void init() {
// nop
}
@@ -248,8 +235,7 @@ public abstract class AbstractParser
* @return the current Doxia version as a String
* @since 1.2
*/
- protected static String doxiaVersion()
- {
+ protected static String doxiaVersion() {
return DOXIA_VERSION;
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractTextParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractTextParser.java
index 760ee503..2f6fc335 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractTextParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractTextParser.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -27,14 +45,10 @@ import org.apache.maven.doxia.markup.TextMarkup;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-public abstract class AbstractTextParser
- extends AbstractParser
- implements TextMarkup
-{
+public abstract class AbstractTextParser extends AbstractParser implements TextMarkup {
/** {@inheritDoc} */
@Override
- public final int getType()
- {
+ public final int getType() {
return TXT_TYPE;
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
index 7adb8d25..cf69334f 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -41,7 +59,6 @@ import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.util.HtmlTools;
import org.apache.maven.doxia.util.XmlValidator;
-
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
@@ -60,10 +77,7 @@ import org.xml.sax.SAXException;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-public abstract class AbstractXmlParser
- extends AbstractParser
- implements XmlMarkup
-{
+public abstract class AbstractXmlParser extends AbstractParser implements XmlMarkup {
/**
* Entity pattern for HTML entity, i.e. &nbsp;
* "<!ENTITY(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&[a-zA-Z]{2,6};)(\\s)*\"(\\s)*>
@@ -71,7 +85,7 @@ public abstract class AbstractXmlParser
* see <a href="http://www.w3.org/TR/REC-xml/#NT-EntityDecl">http://www.w3.org/TR/REC-xml/#NT-EntityDecl</a>.
*/
private static final Pattern PATTERN_ENTITY_1 =
- Pattern.compile( ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&[a-zA-Z]{2,6};)(\\s)*\"(\\s)*>" );
+ Pattern.compile(ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&[a-zA-Z]{2,6};)(\\s)*\"(\\s)*>");
/**
* Entity pattern for Unicode entity, i.e. &#38;
@@ -80,7 +94,7 @@ public abstract class AbstractXmlParser
* see <a href="http://www.w3.org/TR/REC-xml/#NT-EntityDecl">http://www.w3.org/TR/REC-xml/#NT-EntityDecl</a>.
*/
private static final Pattern PATTERN_ENTITY_2 =
- Pattern.compile( ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,5};)*)(\\s)*\"(\\s)*>" );
+ Pattern.compile(ENTITY_START + "(\\s)+([^>|^\\s]+)(\\s)+\"(\\s)*(&(#x?[0-9a-fA-F]{1,5};)*)(\\s)*\"(\\s)*>");
private boolean ignorableWhitespace;
@@ -105,57 +119,45 @@ public abstract class AbstractXmlParser
private boolean addDefaultEntities = true;
/** {@inheritDoc} */
- public void parse( Reader source, Sink sink, String reference )
- throws ParseException
- {
+ public void parse(Reader source, Sink sink, String reference) throws ParseException {
init();
Reader src = source;
// 1 first parsing if validation is required
- if ( isValidate() )
- {
+ if (isValidate()) {
String content;
- try
- {
- content = IOUtil.toString( new BufferedReader( src ) );
- }
- catch ( IOException e )
- {
- throw new ParseException( "Error reading the model", e );
+ try {
+ content = IOUtil.toString(new BufferedReader(src));
+ } catch (IOException e) {
+ throw new ParseException("Error reading the model", e);
}
- new XmlValidator( ).validate( content );
+ new XmlValidator().validate(content);
- src = new StringReader( content );
+ src = new StringReader(content);
}
// 2 second parsing to process
- try
- {
+ try {
XmlPullParser parser = addDefaultEntities
- ? new MXParser( EntityReplacementMap.defaultEntityReplacementMap )
- : new MXParser();
+ ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap)
+ : new MXParser();
- parser.setInput( src );
+ parser.setInput(src);
// allow parser initialization, e.g. for additional entities in XHTML
// Note: do it after input is set, otherwise values are reset
- initXmlParser( parser );
+ initXmlParser(parser);
- parseXml( parser, sink );
- }
- catch ( XmlPullParserException ex )
- {
- throw new ParseException( "Error parsing the model", ex, ex.getLineNumber(),
- ex.getColumnNumber() );
- }
- catch ( MacroExecutionException ex )
- {
- throw new ParseException( "Macro execution failed", ex );
+ parseXml(parser, sink);
+ } catch (XmlPullParserException ex) {
+ throw new ParseException("Error parsing the model", ex, ex.getLineNumber(), ex.getColumnNumber());
+ } catch (MacroExecutionException ex) {
+ throw new ParseException("Macro execution failed", ex);
}
- setSecondParsing( false );
+ setSecondParsing(false);
init();
}
@@ -165,16 +167,13 @@ public abstract class AbstractXmlParser
* @param parser A parser, not null.
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem initializing the parser
*/
- protected void initXmlParser( XmlPullParser parser )
- throws XmlPullParserException
- {
+ protected void initXmlParser(XmlPullParser parser) throws XmlPullParserException {
// nop
}
/** {@inheritDoc} */
@Override
- public final int getType()
- {
+ public final int getType() {
return XML_TYPE;
}
@@ -185,20 +184,17 @@ public abstract class AbstractXmlParser
* @return a SinkEventAttributeSet or null if the current parser event is not a start tag.
* @since 1.1
*/
- protected SinkEventAttributeSet getAttributesFromParser( XmlPullParser parser )
- {
+ protected SinkEventAttributeSet getAttributesFromParser(XmlPullParser parser) {
int count = parser.getAttributeCount();
- if ( count < 0 )
- {
+ if (count < 0) {
return null;
}
- SinkEventAttributeSet atts = new SinkEventAttributeSet( count );
+ SinkEventAttributeSet atts = new SinkEventAttributeSet(count);
- for ( int i = 0; i < count; i++ )
- {
- atts.addAttribute( parser.getAttributeName( i ), parser.getAttributeValue( i ) );
+ for (int i = 0; i < count; i++) {
+ atts.addAttribute(parser.getAttributeName(i), parser.getAttributeValue(i));
}
return atts;
@@ -212,75 +208,47 @@ public abstract class AbstractXmlParser
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
* @throws org.apache.maven.doxia.macro.MacroExecutionException if there's a problem executing a macro
*/
- private void parseXml( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException
- {
+ private void parseXml(XmlPullParser parser, Sink sink) throws XmlPullParserException, MacroExecutionException {
int eventType = parser.getEventType();
- while ( eventType != XmlPullParser.END_DOCUMENT )
- {
- if ( eventType == XmlPullParser.START_TAG )
- {
- handleStartTag( parser, sink );
- }
- else if ( eventType == XmlPullParser.END_TAG )
- {
- handleEndTag( parser, sink );
- }
- else if ( eventType == XmlPullParser.TEXT )
- {
- String text = getText( parser );
-
- if ( isIgnorableWhitespace() )
- {
- if ( text.trim().length() != 0 )
- {
- handleText( parser, sink );
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ if (eventType == XmlPullParser.START_TAG) {
+ handleStartTag(parser, sink);
+ } else if (eventType == XmlPullParser.END_TAG) {
+ handleEndTag(parser, sink);
+ } else if (eventType == XmlPullParser.TEXT) {
+ String text = getText(parser);
+
+ if (isIgnorableWhitespace()) {
+ if (text.trim().length() != 0) {
+ handleText(parser, sink);
}
+ } else {
+ handleText(parser, sink);
}
- else
- {
- handleText( parser, sink );
- }
- }
- else if ( eventType == XmlPullParser.CDSECT )
- {
- handleCdsect( parser, sink );
- }
- else if ( eventType == XmlPullParser.COMMENT )
- {
- handleComment( parser, sink );
- }
- else if ( eventType == XmlPullParser.ENTITY_REF )
- {
- handleEntity( parser, sink );
- }
- else if ( eventType == XmlPullParser.IGNORABLE_WHITESPACE )
- {
+ } else if (eventType == XmlPullParser.CDSECT) {
+ handleCdsect(parser, sink);
+ } else if (eventType == XmlPullParser.COMMENT) {
+ handleComment(parser, sink);
+ } else if (eventType == XmlPullParser.ENTITY_REF) {
+ handleEntity(parser, sink);
+ } else if (eventType == XmlPullParser.IGNORABLE_WHITESPACE) {
// nop
- }
- else if ( eventType == XmlPullParser.PROCESSING_INSTRUCTION )
- {
+ } else if (eventType == XmlPullParser.PROCESSING_INSTRUCTION) {
// nop
- }
- else if ( eventType == XmlPullParser.DOCDECL )
- {
- addLocalEntities( parser, parser.getText() );
+ } else if (eventType == XmlPullParser.DOCDECL) {
+ addLocalEntities(parser, parser.getText());
- for ( byte[] res : CachedFileEntityResolver.ENTITY_CACHE.values() )
- {
- addDTDEntities( parser, new String( res ) );
+ for (byte[] res : CachedFileEntityResolver.ENTITY_CACHE.values()) {
+ addDTDEntities(parser, new String(res));
}
}
- try
- {
+ try {
eventType = parser.nextToken();
- }
- catch ( IOException io )
- {
+ } catch (IOException io) {
// Does not have a cause arg
- throw new XmlPullParserException( "IOException: " + io.getMessage(), parser, io );
+ throw new XmlPullParserException("IOException: " + io.getMessage(), parser, io);
}
}
}
@@ -293,8 +261,8 @@ public abstract class AbstractXmlParser
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
* @throws org.apache.maven.doxia.macro.MacroExecutionException if there's a problem executing a macro
*/
- protected abstract void handleStartTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException;
+ protected abstract void handleStartTag(XmlPullParser parser, Sink sink)
+ throws XmlPullParserException, MacroExecutionException;
/**
* Goes through the possible end tags.
@@ -304,8 +272,8 @@ public abstract class AbstractXmlParser
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
* @throws org.apache.maven.doxia.macro.MacroExecutionException if there's a problem executing a macro
*/
- protected abstract void handleEndTag( XmlPullParser parser, Sink sink )
- throws XmlPullParserException, MacroExecutionException;
+ protected abstract void handleEndTag(XmlPullParser parser, Sink sink)
+ throws XmlPullParserException, MacroExecutionException;
/**
* Handles text events.
@@ -317,18 +285,15 @@ public abstract class AbstractXmlParser
* @param sink the sink to receive the events. Not null.
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
*/
- protected void handleText( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
+ 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.
*/
- if ( StringUtils.isNotEmpty( text ) )
- {
- sink.text( text );
+ if (StringUtils.isNotEmpty(text)) {
+ sink.text(text);
}
}
@@ -342,10 +307,8 @@ public abstract class AbstractXmlParser
* @param sink the sink to receive the events. Not null.
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
*/
- protected void handleCdsect( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- sink.text( getText( parser ) );
+ protected void handleCdsect(XmlPullParser parser, Sink sink) throws XmlPullParserException {
+ sink.text(getText(parser));
}
/**
@@ -358,12 +321,9 @@ public abstract class AbstractXmlParser
* @param sink the sink to receive the events. Not null.
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
*/
- protected void handleComment( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- if ( isEmitComments() )
- {
- sink.comment( getText( parser ) );
+ protected void handleComment(XmlPullParser parser, Sink sink) throws XmlPullParserException {
+ if (isEmitComments()) {
+ sink.comment(getText(parser));
}
}
@@ -381,22 +341,17 @@ public abstract class AbstractXmlParser
* @param sink the sink to receive the events. Not null.
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if there's a problem parsing the model
*/
- protected void handleEntity( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
+ protected void handleEntity(XmlPullParser parser, Sink sink) throws XmlPullParserException {
+ String text = getText(parser);
String name = parser.getName();
- if ( "#160".equals( name ) || "nbsp".equals( name ) || "#x00A0".equals( name ) )
- {
+ if ("#160".equals(name) || "nbsp".equals(name) || "#x00A0".equals(name)) {
sink.nonBreakingSpace();
- }
- else
- {
- String unescaped = HtmlTools.unescapeHTML( text );
+ } else {
+ String unescaped = HtmlTools.unescapeHTML(text);
- sink.text( unescaped );
+ sink.text(unescaped);
}
}
@@ -415,13 +370,12 @@ public abstract class AbstractXmlParser
* org.apache.maven.doxia.sink.Sink#unknown(String, Object[], org.apache.maven.doxia.sink.SinkEventAttributes)}
* method.
*/
- protected void handleUnknown( XmlPullParser parser, Sink sink, int type )
- {
- Object[] required = new Object[] { type };
+ protected void handleUnknown(XmlPullParser parser, Sink sink, int type) {
+ Object[] required = new Object[] {type};
- SinkEventAttributeSet attribs = getAttributesFromParser( parser );
+ SinkEventAttributeSet attribs = getAttributesFromParser(parser);
- sink.unknown( parser.getName(), required, attribs );
+ sink.unknown(parser.getName(), required, attribs);
}
/**
@@ -431,8 +385,7 @@ public abstract class AbstractXmlParser
* @see #setIgnorableWhitespace(boolean)
* @since 1.1
*/
- protected boolean isIgnorableWhitespace()
- {
+ protected boolean isIgnorableWhitespace() {
return ignorableWhitespace;
}
@@ -445,8 +398,7 @@ public abstract class AbstractXmlParser
* @param ignorable <code>true</code> to ignore whitespace, <code>false</code> otherwise.
* @since 1.1
*/
- protected void setIgnorableWhitespace( boolean ignorable )
- {
+ protected void setIgnorableWhitespace(boolean ignorable) {
this.ignorableWhitespace = ignorable;
}
@@ -457,8 +409,7 @@ public abstract class AbstractXmlParser
* @see #setCollapsibleWhitespace(boolean)
* @since 1.1
*/
- protected boolean isCollapsibleWhitespace()
- {
+ protected boolean isCollapsibleWhitespace() {
return collapsibleWhitespace;
}
@@ -471,8 +422,7 @@ public abstract class AbstractXmlParser
* @param collapsible <code>true</code> to allow collapsible text, <code>false</code> otherwise.
* @since 1.1
*/
- protected void setCollapsibleWhitespace( boolean collapsible )
- {
+ protected void setCollapsibleWhitespace(boolean collapsible) {
this.collapsibleWhitespace = collapsible;
}
@@ -483,8 +433,7 @@ public abstract class AbstractXmlParser
* @see #setTrimmableWhitespace(boolean)
* @since 1.1
*/
- protected boolean isTrimmableWhitespace()
- {
+ protected boolean isTrimmableWhitespace() {
return trimmableWhitespace;
}
@@ -497,8 +446,7 @@ public abstract class AbstractXmlParser
* @param trimmable <code>true</code> to allow trimmable text, <code>false</code> otherwise.
* @since 1.1
*/
- protected void setTrimmableWhitespace( boolean trimmable )
- {
+ protected void setTrimmableWhitespace(boolean trimmable) {
this.trimmableWhitespace = trimmable;
}
@@ -512,25 +460,20 @@ public abstract class AbstractXmlParser
* @see #isTrimmableWhitespace()
* @since 1.1
*/
- protected String getText( XmlPullParser parser )
- {
+ protected String getText(XmlPullParser parser) {
String text = parser.getText();
- if ( isTrimmableWhitespace() )
- {
+ if (isTrimmableWhitespace()) {
text = text.trim();
}
- if ( isCollapsibleWhitespace() )
- {
+ if (isCollapsibleWhitespace()) {
StringBuilder newText = new StringBuilder();
- String[] elts = StringUtils.split( text, " \r\n" );
- for ( int i = 0; i < elts.length; i++ )
- {
- newText.append( elts[i] );
- if ( ( i + 1 ) < elts.length )
- {
- newText.append( " " );
+ String[] elts = StringUtils.split(text, " \r\n");
+ for (int i = 0; i < elts.length; i++) {
+ newText.append(elts[i]);
+ if ((i + 1) < elts.length) {
+ newText.append(" ");
}
}
text = newText.toString();
@@ -551,10 +494,8 @@ public abstract class AbstractXmlParser
* @return a map of the defined entities in a local doctype.
* @since 1.1
*/
- protected Map<String, String> getLocalEntities()
- {
- if ( entities == null )
- {
+ protected Map<String, String> getLocalEntities() {
+ if (entities == null) {
entities = new LinkedHashMap<>();
}
@@ -567,8 +508,7 @@ public abstract class AbstractXmlParser
* @return <code>true</code> if XML content will be validate, <code>false</code> otherwise.
* @since 1.1
*/
- public boolean isValidate()
- {
+ public boolean isValidate() {
return validate;
}
@@ -579,28 +519,24 @@ public abstract class AbstractXmlParser
* @see #parse(Reader, Sink)
* @since 1.1
*/
- public void setValidate( boolean validate )
- {
+ public void setValidate(boolean validate) {
this.validate = validate;
}
/**
* @since 2.0.0-M4
*/
- public boolean getAddDefaultEntities()
- {
+ public boolean getAddDefaultEntities() {
return addDefaultEntities;
}
/**
* @since 2.0.0-M4
*/
- public void setAddDefaultEntities( boolean addDefaultEntities )
- {
+ public void setAddDefaultEntities(boolean addDefaultEntities) {
this.addDefaultEntities = addDefaultEntities;
}
-
// ----------------------------------------------------------------------
// Private methods
// ----------------------------------------------------------------------
@@ -616,17 +552,17 @@ public abstract class AbstractXmlParser
* @throws XmlPullParserException if any
* @see XmlPullParser#defineEntityReplacementText(String, String)
*/
- private void addEntity( XmlPullParser parser, String entityName, String entityValue )
- throws XmlPullParserException
- {
- if ( entityName.endsWith( "amp" ) || entityName.endsWith( "lt" ) || entityName.endsWith( "gt" )
- || entityName.endsWith( "quot" ) || entityName.endsWith( "apos" ) )
- {
+ private void addEntity(XmlPullParser parser, String entityName, String entityValue) throws XmlPullParserException {
+ if (entityName.endsWith("amp")
+ || entityName.endsWith("lt")
+ || entityName.endsWith("gt")
+ || entityName.endsWith("quot")
+ || entityName.endsWith("apos")) {
return;
}
- parser.defineEntityReplacementText( entityName, entityValue );
- getLocalEntities().put( entityName, entityValue );
+ parser.defineEntityReplacementText(entityName, entityValue);
+ getLocalEntities().put(entityName, entityValue);
}
/**
@@ -642,18 +578,14 @@ public abstract class AbstractXmlParser
* @param text not null
* @throws XmlPullParserException if any
*/
- private void addLocalEntities( XmlPullParser parser, String text )
- throws XmlPullParserException
- {
- int entitiesCount = StringUtils.countMatches( text, ENTITY_START );
- if ( entitiesCount > 0 )
- {
+ private void addLocalEntities(XmlPullParser parser, String text) throws XmlPullParserException {
+ int entitiesCount = StringUtils.countMatches(text, ENTITY_START);
+ if (entitiesCount > 0) {
// text should be foo [...]
- int start = text.indexOf( '[' );
- int end = text.lastIndexOf( ']' );
- if ( start != -1 && end != -1 )
- {
- addDTDEntities( parser, text.substring( start + 1, end ) );
+ int start = text.indexOf('[');
+ int end = text.lastIndexOf(']');
+ if (start != -1 && end != -1) {
+ addDTDEntities(parser, text.substring(start + 1, end));
}
}
}
@@ -673,46 +605,35 @@ public abstract class AbstractXmlParser
* @param text not null
* @throws XmlPullParserException if any
*/
- private void addDTDEntities( XmlPullParser parser, String text )
- throws XmlPullParserException
- {
- int entitiesCount = StringUtils.countMatches( text, ENTITY_START );
- if ( entitiesCount > 0 )
- {
- final String txt = StringUtils.replace( text, ENTITY_START, "\n" + ENTITY_START );
- try ( BufferedReader reader = new BufferedReader( new StringReader( txt ) ) )
- {
+ private void addDTDEntities(XmlPullParser parser, String text) throws XmlPullParserException {
+ int entitiesCount = StringUtils.countMatches(text, ENTITY_START);
+ if (entitiesCount > 0) {
+ final String txt = StringUtils.replace(text, ENTITY_START, "\n" + ENTITY_START);
+ try (BufferedReader reader = new BufferedReader(new StringReader(txt))) {
String line;
String tmpLine = "";
Matcher matcher;
- while ( ( line = reader.readLine() ) != null )
- {
+ while ((line = reader.readLine()) != null) {
tmpLine += "\n" + line;
- matcher = PATTERN_ENTITY_1.matcher( tmpLine );
- if ( matcher.find() && matcher.groupCount() == 7 )
- {
- String entityName = matcher.group( 2 );
- String entityValue = matcher.group( 5 );
+ matcher = PATTERN_ENTITY_1.matcher(tmpLine);
+ if (matcher.find() && matcher.groupCount() == 7) {
+ String entityName = matcher.group(2);
+ String entityValue = matcher.group(5);
- addEntity( parser, entityName, entityValue );
+ addEntity(parser, entityName, entityValue);
tmpLine = "";
- }
- else
- {
- matcher = PATTERN_ENTITY_2.matcher( tmpLine );
- if ( matcher.find() && matcher.groupCount() == 8 )
- {
- String entityName = matcher.group( 2 );
- String entityValue = matcher.group( 5 );
-
- addEntity( parser, entityName, entityValue );
+ } else {
+ matcher = PATTERN_ENTITY_2.matcher(tmpLine);
+ if (matcher.find() && matcher.groupCount() == 8) {
+ String entityName = matcher.group(2);
+ String entityValue = matcher.group(5);
+
+ addEntity(parser, entityName, entityValue);
tmpLine = "";
}
}
}
- }
- catch ( IOException e )
- {
+ } catch (IOException e) {
// nop
}
}
@@ -722,70 +643,58 @@ public abstract class AbstractXmlParser
* Implementation of the callback mechanism <code>EntityResolver</code>.
* Using a mechanism of cached files in temp dir to improve performance when using the <code>XMLReader</code>.
*/
- public static class CachedFileEntityResolver
- implements EntityResolver
- {
- private static final Logger LOGGER = LoggerFactory.getLogger( CachedFileEntityResolver.class );
+ public static class CachedFileEntityResolver implements EntityResolver {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CachedFileEntityResolver.class);
/** Map with systemId as key and the content of systemId as byte[]. */
protected static final Map<String, byte[]> ENTITY_CACHE = new Hashtable<>();
private static final Map<String, String> WELL_KNOWN_SYSTEM_IDS = new HashMap<>();
- static
- {
- WELL_KNOWN_SYSTEM_IDS.put( "http://www.w3.org/2001/xml.xsd", "xml.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "https://www.w3.org/2001/xml.xsd", "xml.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "http://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "https://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "http://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "https://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd" );
- WELL_KNOWN_SYSTEM_IDS.put( "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent" );
- WELL_KNOWN_SYSTEM_IDS.put( "https://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent" );
+ static {
+ WELL_KNOWN_SYSTEM_IDS.put("http://www.w3.org/2001/xml.xsd", "xml.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("https://www.w3.org/2001/xml.xsd", "xml.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("http://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("https://maven.apache.org/xsd/xdoc-2.0.xsd", "xdoc-2.0.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("http://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("https://maven.apache.org/xsd/fml-1.0.1.xsd", "fml-1.0.1.xsd");
+ WELL_KNOWN_SYSTEM_IDS.put("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent");
+ WELL_KNOWN_SYSTEM_IDS.put("https://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "xhtml-lat1.ent");
}
/** {@inheritDoc} */
- public InputSource resolveEntity( String publicId, String systemId )
- throws SAXException, IOException
- {
- byte[] res = ENTITY_CACHE.get( systemId );
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ byte[] res = ENTITY_CACHE.get(systemId);
// already cached?
- if ( res == null )
- {
- if ( WELL_KNOWN_SYSTEM_IDS.containsKey( systemId ) )
- {
- String resource = "/" + WELL_KNOWN_SYSTEM_IDS.get( systemId );
- URL url = getClass().getResource( resource );
- if ( url != null )
- {
- LOGGER.debug( "Resolving SYSTEM '{}' from well-known classpath resource '{}'",
- systemId, resource );
- res = toByteArray( url );
+ if (res == null) {
+ if (WELL_KNOWN_SYSTEM_IDS.containsKey(systemId)) {
+ String resource = "/" + WELL_KNOWN_SYSTEM_IDS.get(systemId);
+ URL url = getClass().getResource(resource);
+ if (url != null) {
+ LOGGER.debug(
+ "Resolving SYSTEM '{}' from well-known classpath resource '{}'", systemId, resource);
+ res = toByteArray(url);
}
}
- if ( res == null )
- {
- URI uri = URI.create( systemId );
- if ( uri.getScheme() == null )
- {
- uri = Paths.get( systemId ).toUri();
+ if (res == null) {
+ URI uri = URI.create(systemId);
+ if (uri.getScheme() == null) {
+ uri = Paths.get(systemId).toUri();
}
- LOGGER.debug( "Resolving SYSTEM '{}' from URI resource '{}'", systemId, uri );
- res = toByteArray( uri.toURL() );
+ LOGGER.debug("Resolving SYSTEM '{}' from URI resource '{}'", systemId, uri);
+ res = toByteArray(uri.toURL());
}
- ENTITY_CACHE.put( systemId, res );
- }
- else
- {
- LOGGER.debug( "Resolved SYSTEM '{}' from cache", systemId );
+ ENTITY_CACHE.put(systemId, res);
+ } else {
+ LOGGER.debug("Resolved SYSTEM '{}' from cache", systemId);
}
- InputSource is = new InputSource( new ByteArrayInputStream( res ) );
- is.setPublicId( publicId );
- is.setSystemId( systemId );
+ InputSource is = new InputSource(new ByteArrayInputStream(res));
+ is.setPublicId(publicId);
+ is.setSystemId(systemId);
return is;
}
@@ -795,26 +704,18 @@ public abstract class AbstractXmlParser
* @return return an array of byte
* @throws SAXException if any
*/
- private static byte[] toByteArray( URL url )
- throws SAXException
- {
+ private static byte[] toByteArray(URL url) throws SAXException {
InputStream is = null;
- try
- {
+ try {
is = url.openStream();
- if ( is == null )
- {
- throw new SAXException( "Cannot open stream from the url: " + url );
+ if (is == null) {
+ throw new SAXException("Cannot open stream from the url: " + url);
}
- return IOUtil.toByteArray( is );
- }
- catch ( IOException e )
- {
- throw new SAXException( e );
- }
- finally
- {
- IOUtil.close( is );
+ return IOUtil.toByteArray(is);
+ } catch (IOException e) {
+ throw new SAXException(e);
+ } finally {
+ IOUtil.close(is);
}
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/ParseException.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/ParseException.java
index ed294c68..31ff4cfe 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/ParseException.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/ParseException.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -25,9 +43,7 @@ package org.apache.maven.doxia.parser;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public class ParseException
- extends Exception
-{
+public class ParseException extends Exception {
/** serialVersionUID */
static final long serialVersionUID = 295967936746221567L;
@@ -48,9 +64,8 @@ public class ParseException
* @param e the cause. This can be retrieved later by the <code>Throwable.getCause()</code> method.
* (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
*/
- public ParseException( Exception e )
- {
- this( null, e, null, -1, -1 );
+ public ParseException(Exception e) {
+ this(null, e, null, -1, -1);
}
/**
@@ -61,9 +76,8 @@ public class ParseException
* @param message The detailed message.
* This can later be retrieved by the <code>Throwable.getMessage()</code> method.
*/
- public ParseException( String message )
- {
- this( message, null, null, -1, -1 );
+ public ParseException(String message) {
+ this(message, null, null, -1, -1);
}
/**
@@ -76,9 +90,8 @@ public class ParseException
* @param e the cause. This can be retrieved later by the <code>Throwable.getCause()</code> method.
* (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
*/
- public ParseException( String message, Exception e )
- {
- this( message, e, null, -1, -1 );
+ public ParseException(String message, Exception e) {
+ this(message, e, null, -1, -1);
}
/**
@@ -93,9 +106,8 @@ public class ParseException
* This can later be retrieved by the getColumnNumber() method.
* @since 1.1
*/
- public ParseException( String message, int line, int column )
- {
- this( message, null, null, line, column );
+ public ParseException(String message, int line, int column) {
+ this(message, null, null, line, column);
}
/**
@@ -112,9 +124,8 @@ public class ParseException
* This can later be retrieved by the getColumnNumber() method.
* @since 1.1
*/
- public ParseException( String message, Exception e, int line, int column )
- {
- this( message, e, null, line, column );
+ public ParseException(String message, Exception e, int line, int column) {
+ this(message, e, null, line, column);
}
/**
@@ -129,9 +140,8 @@ public class ParseException
* This can later be retrieved by the getColumnNumber() method.
* @since 1.1
*/
- public ParseException( Exception e, int line, int column )
- {
- this( null, e, null, line, column );
+ public ParseException(Exception e, int line, int column) {
+ this(null, e, null, line, column);
}
/**
@@ -147,9 +157,8 @@ public class ParseException
* @param column The column number where the parsing failed.
* This can later be retrieved by the getColumnNumber() method.
*/
- public ParseException( Exception e, String file, int line, int column )
- {
- this( null, e, file, line, column );
+ public ParseException(Exception e, String file, int line, int column) {
+ this(null, e, file, line, column);
}
/**
@@ -168,9 +177,8 @@ public class ParseException
*
* @since 1.1
*/
- public ParseException( String message, Exception e, String file, int line, int column )
- {
- super( message, e );
+ public ParseException(String message, Exception e, String file, int line, int column) {
+ super(message, e);
this.fileName = file;
this.lineNumber = line;
@@ -182,8 +190,7 @@ public class ParseException
*
* @return the file name that caused the <code>ParseException</code>.
*/
- public String getFileName()
- {
+ public String getFileName() {
return fileName;
}
@@ -192,8 +199,7 @@ public class ParseException
*
* @return the line number where the <code>ParseException</code> occurred.
*/
- public int getLineNumber()
- {
+ public int getLineNumber() {
return lineNumber;
}
@@ -203,8 +209,7 @@ public class ParseException
* @return the column number where the <code>ParseException</code> occurred.
* @since 1.1
*/
- public int getColumnNumber()
- {
+ public int getColumnNumber() {
return columnNumber;
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
index 98ecc1ae..250f3844 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -19,10 +37,10 @@ package org.apache.maven.doxia.parser;
* under the License.
*/
-import org.apache.maven.doxia.sink.Sink;
-
import java.io.Reader;
+import org.apache.maven.doxia.sink.Sink;
+
/**
* A Parser is responsible for parsing any document in a supported front-end
* format, and emitting the standard Doxia events, which can then be consumed
@@ -31,8 +49,7 @@ import java.io.Reader;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public interface Parser
-{
+public interface Parser {
/** Unknown parser type */
int UNKNOWN_TYPE = 0;
@@ -51,8 +68,7 @@ public interface Parser
* @param sink A sink that consumes the Doxia events.
* @throws org.apache.maven.doxia.parser.ParseException if the model could not be parsed.
*/
- void parse( Reader source, Sink sink )
- throws ParseException;
+ void parse(Reader source, Sink sink) throws ParseException;
/**
* Parses the given source model and emits Doxia events into the given sink.
@@ -63,8 +79,7 @@ public interface Parser
* @param reference the reference
* @throws org.apache.maven.doxia.parser.ParseException if the model could not be parsed.
*/
- void parse( Reader source, Sink sink, String reference )
- throws ParseException;
+ void parse(Reader source, Sink sink, String reference) throws ParseException;
/**
* The parser type value could be {@link #UNKNOWN_TYPE}, {@link #TXT_TYPE} or
@@ -79,7 +94,7 @@ public interface Parser
*
* @param emitComments <code>true</code> (default value) to emit comment Doxia events
*/
- void setEmitComments( boolean emitComments );
+ void setEmitComments(boolean emitComments);
/**
* Does the parser emit Doxia comments event when comments found in source?
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
index c3c8a3d7..a0b7a105 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser;
/*
@@ -19,21 +37,20 @@ package org.apache.maven.doxia.parser;
* under the License.
*/
+import javax.swing.text.html.HTML.Attribute;
+
import java.io.Reader;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
import java.util.regex.Pattern;
-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;
@@ -43,66 +60,62 @@ import org.slf4j.LoggerFactory;
/**
* Common base parser for xhtml5 events.
*/
-public class Xhtml5BaseParser
- extends AbstractXmlParser
- implements HtmlMarkup
-{
- private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5BaseParser.class );
+public class Xhtml5BaseParser extends AbstractXmlParser implements HtmlMarkup {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Xhtml5BaseParser.class);
/** Used to identify if a class string contains `bodyTableBorder` */
private static final Pattern BODYTABLEBORDER_CLASS_PATTERN =
- Pattern.compile( "(?:.*\\s|^)bodyTableBorder(?:\\s.*|$)" );
+ Pattern.compile("(?:.*\\s|^)bodyTableBorder(?:\\s.*|$)");
private static final Set<String> UNMATCHED_XHTML5_ELEMENTS = new HashSet<>();
private static final Set<String> UNMATCHED_XHTML5_SIMPLE_ELEMENTS = new HashSet<>();
- static
- {
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.AREA.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.AUDIO.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.BUTTON.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.CANVAS.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.COL.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.COLGROUP.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.COMMAND.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.DATA.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.DATALIST.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.DETAILS.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.DIALOG.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.EMBED.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.FIELDSET.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.FORM.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.HGROUP.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.IFRAME.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.INPUT.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.KEYGEN.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.LABEL.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.LEGEND.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.MAP.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.MENU.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.MENUITEM.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.METER.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.NOSCRIPT.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.OBJECT.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.OPTGROUP.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.OPTION.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.OUTPUT.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.PARAM.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.PICTURE.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.PROGRESS.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.SELECT.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.SOURCE.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.SUMMARY.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.SVG.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.TEMPLATE.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.TEXTAREA.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.TBODY.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.THEAD.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.TFOOT.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.TIME.toString() );
- UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add( HtmlMarkup.TRACK.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.VAR.toString() );
- UNMATCHED_XHTML5_ELEMENTS.add( HtmlMarkup.VIDEO.toString() );
+ static {
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.AREA.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.AUDIO.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.BUTTON.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.CANVAS.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.COL.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.COLGROUP.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.COMMAND.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.DATA.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.DATALIST.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.DETAILS.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.DIALOG.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.EMBED.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.FIELDSET.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.FORM.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.HGROUP.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.IFRAME.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.INPUT.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.KEYGEN.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.LABEL.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.LEGEND.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.MAP.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.MENU.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.MENUITEM.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.METER.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.NOSCRIPT.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.OBJECT.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.OPTGROUP.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.OPTION.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.OUTPUT.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.PARAM.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.PICTURE.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.PROGRESS.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.SELECT.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.SOURCE.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.SUMMARY.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.SVG.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.TEMPLATE.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.TEXTAREA.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.TBODY.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.THEAD.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.TFOOT.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.TIME.toString());
+ UNMATCHED_XHTML5_SIMPLE_ELEMENTS.add(HtmlMarkup.TRACK.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.VAR.toString());
+ UNMATCHED_XHTML5_ELEMENTS.add(HtmlMarkup.VIDEO.toString());
}
/**
@@ -137,18 +150,13 @@ public class Xhtml5BaseParser
/** {@inheritDoc} */
@Override
- public void parse( Reader source, Sink sink, String reference )
- throws ParseException
- {
+ public void parse(Reader source, Sink sink, String reference) throws ParseException {
init();
- try
- {
- super.parse( source, sink, reference );
- }
- finally
- {
- setSecondParsing( false );
+ try {
+ super.parse(source, sink, reference);
+ } finally {
+ setSecondParsing(false);
init();
}
}
@@ -160,10 +168,8 @@ public class Xhtml5BaseParser
* without additional DTD.
*/
@Override
- protected void initXmlParser( XmlPullParser parser )
- throws XmlPullParserException
- {
- super.initXmlParser( parser );
+ protected void initXmlParser(XmlPullParser parser) throws XmlPullParserException {
+ super.initXmlParser(parser);
}
/**
@@ -192,316 +198,182 @@ public class Xhtml5BaseParser
* @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 )
- {
+ protected boolean baseStartTag(XmlPullParser parser, Sink sink) {
boolean visited = true;
- SinkEventAttributeSet attribs = getAttributesFromParser( parser );
-
- if ( parser.getName().equals( HtmlMarkup.ARTICLE.toString() ) )
- {
- sink.article( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.NAV.toString() ) )
- {
- sink.navigation( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.ASIDE.toString() ) )
- {
- sink.sidebar( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SECTION.toString() ) )
- {
- handleSectionStart( sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
- {
- handleHeadingStart( sink, Sink.SECTION_LEVEL_1, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
- {
- handleHeadingStart( sink, Sink.SECTION_LEVEL_2, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
- {
- handleHeadingStart( sink, Sink.SECTION_LEVEL_3, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
- {
- handleHeadingStart( sink, Sink.SECTION_LEVEL_4, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
- {
- handleHeadingStart( sink, Sink.SECTION_LEVEL_5, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.HEADER.toString() ) )
- {
- sink.header( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.MAIN.toString() ) )
- {
- sink.content( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.FOOTER.toString() ) )
- {
- sink.footer( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.EM.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.EMPHASIS );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.STRONG.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.STRONG );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SMALL.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.SMALL );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.S.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.LINE_THROUGH );
- sink.inline( attribs );
+ SinkEventAttributeSet attribs = getAttributesFromParser(parser);
+
+ if (parser.getName().equals(HtmlMarkup.ARTICLE.toString())) {
+ sink.article(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.NAV.toString())) {
+ sink.navigation(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.ASIDE.toString())) {
+ sink.sidebar(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.SECTION.toString())) {
+ handleSectionStart(sink, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.H1.toString())) {
+ handleHeadingStart(sink, Sink.SECTION_LEVEL_1, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.H2.toString())) {
+ handleHeadingStart(sink, Sink.SECTION_LEVEL_2, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.H3.toString())) {
+ handleHeadingStart(sink, Sink.SECTION_LEVEL_3, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.H4.toString())) {
+ handleHeadingStart(sink, Sink.SECTION_LEVEL_4, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.H5.toString())) {
+ handleHeadingStart(sink, Sink.SECTION_LEVEL_5, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.HEADER.toString())) {
+ sink.header(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.MAIN.toString())) {
+ sink.content(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.FOOTER.toString())) {
+ sink.footer(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.EM.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.EMPHASIS);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.STRONG.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.STRONG);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.SMALL.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.SMALL);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.S.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.LINE_THROUGH);
+ sink.inline(attribs);
/* deprecated line-through support */
- }
- else if ( parser.getName().equals( HtmlMarkup.CITE.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.CITATION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.Q.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.QUOTE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DFN.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.DEFINITION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.ABBR.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.ABBREVIATION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.I.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.ITALIC );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.B.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.BOLD );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.CODE.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.CODE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.VAR.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.VARIABLE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SAMP.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.SAMPLE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.KBD.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.KEYBOARD );
- 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.SUB.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.SUBSCRIPT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.U.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.ANNOTATION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.MARK.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.HIGHLIGHT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.RUBY.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.RUBY );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.RB.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.RUBY_BASE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.RT.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.RUBY_TEXT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.RTC.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.RUBY_TEXT_CONTAINER );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.RP.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.RUBY_PARANTHESES );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.BDI.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.BIDIRECTIONAL_ISOLATION );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.BDO.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.BIDIRECTIONAL_OVERRIDE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.SPAN.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.PHRASE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.INS.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.INSERT );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DEL.toString() ) )
- {
- attribs.addAttributes( SinkEventAttributeSet.Semantics.DELETE );
- sink.inline( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.P.toString() ) )
- {
- handlePStart( sink, attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DIV.toString() ) )
- {
- 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 )
- {
+ } else if (parser.getName().equals(HtmlMarkup.CITE.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.CITATION);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.Q.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.QUOTE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.DFN.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.DEFINITION);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.ABBR.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.ABBREVIATION);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.I.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.ITALIC);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.B.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.BOLD);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.CODE.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.CODE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.VAR.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.VARIABLE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.SAMP.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.SAMPLE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.KBD.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.KEYBOARD);
+ 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.SUB.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.SUBSCRIPT);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.U.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.ANNOTATION);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.MARK.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.HIGHLIGHT);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.RUBY.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.RUBY);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.RB.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.RUBY_BASE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.RT.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.RUBY_TEXT);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.RTC.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.RUBY_TEXT_CONTAINER);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.RP.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.RUBY_PARANTHESES);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.BDI.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.BIDIRECTIONAL_ISOLATION);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.BDO.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.BIDIRECTIONAL_OVERRIDE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.SPAN.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.PHRASE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.INS.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.INSERT);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.DEL.toString())) {
+ attribs.addAttributes(SinkEventAttributeSet.Semantics.DELETE);
+ sink.inline(attribs);
+ } else if (parser.getName().equals(HtmlMarkup.P.toString())) {
+ handlePStart(sink, attribs);
+ } else if (parser.getName().equals(HtmlMarkup.DIV.toString())) {
+ 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 );
+ sink.definitionListItem(attribs);
hasDefinitionListItem = true;
- sink.definedTerm( attribs );
- }
- else if ( parser.getName().equals( HtmlMarkup.DD.toString() ) )
- {
- if ( !hasDefinitionListItem )
- {
- sink.definitionListItem( attribs );
+ 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.FIGURE.toString() ) ) )
- {
- sink.figure( attribs );
- }
- else if ( ( parser.getName().equals( HtmlMarkup.FIGCAPTION.toString() ) ) )
- {
- sink.figureCaption( 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.WBR.toString() ) )
- {
- sink.lineBreakOpportunity( 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.BLOCKQUOTE.toString() ) )
- {
- sink.blockquote( attribs );
- }
- else if ( UNMATCHED_XHTML5_ELEMENTS.contains( parser.getName() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_START );
- }
- else if ( UNMATCHED_XHTML5_SIMPLE_ELEMENTS.contains( parser.getName() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_SIMPLE );
- }
- else if ( parser.getName().equals( HtmlMarkup.SCRIPT.toString() )
- || parser.getName().equals( HtmlMarkup.STYLE.toString() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_START );
+ sink.definition(attribs);
+ } else if ((parser.getName().equals(HtmlMarkup.FIGURE.toString()))) {
+ sink.figure(attribs);
+ } else if ((parser.getName().equals(HtmlMarkup.FIGCAPTION.toString()))) {
+ sink.figureCaption(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.WBR.toString())) {
+ sink.lineBreakOpportunity(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.BLOCKQUOTE.toString())) {
+ sink.blockquote(attribs);
+ } else if (UNMATCHED_XHTML5_ELEMENTS.contains(parser.getName())) {
+ handleUnknown(parser, sink, TAG_TYPE_START);
+ } else if (UNMATCHED_XHTML5_SIMPLE_ELEMENTS.contains(parser.getName())) {
+ handleUnknown(parser, sink, TAG_TYPE_SIMPLE);
+ } else if (parser.getName().equals(HtmlMarkup.SCRIPT.toString())
+ || parser.getName().equals(HtmlMarkup.STYLE.toString())) {
+ handleUnknown(parser, sink, TAG_TYPE_START);
scriptBlock = true;
- }
- else
- {
+ } else {
visited = false;
}
@@ -520,179 +392,97 @@ public class Xhtml5BaseParser
* @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 )
- {
+ protected boolean baseEndTag(XmlPullParser parser, Sink sink) {
boolean visited = true;
- if ( parser.getName().equals( HtmlMarkup.P.toString() ) )
- {
+ if (parser.getName().equals(HtmlMarkup.P.toString())) {
sink.paragraph_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DIV.toString() ) )
- {
- handleDivEnd( sink );
- }
- else if ( parser.getName().equals( HtmlMarkup.PRE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.DIV.toString())) {
+ handleDivEnd(sink);
+ } else if (parser.getName().equals(HtmlMarkup.PRE.toString())) {
verbatim_();
sink.verbatim_();
- }
- else if ( parser.getName().equals( HtmlMarkup.UL.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.UL.toString())) {
sink.list_();
- }
- else if ( parser.getName().equals( HtmlMarkup.OL.toString() ) )
- {
+ } 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 )
- {
+ } 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() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.DT.toString())) {
sink.definedTerm_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DD.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.DD.toString())) {
sink.definition_();
sink.definitionListItem_();
hasDefinitionListItem = false;
- }
- else if ( ( parser.getName().equals( HtmlMarkup.FIGURE.toString() ) ) )
- {
+ } else if ((parser.getName().equals(HtmlMarkup.FIGURE.toString()))) {
sink.figure_();
- }
- else if ( ( parser.getName().equals( HtmlMarkup.FIGCAPTION.toString() ) ) )
- {
+ } else if ((parser.getName().equals(HtmlMarkup.FIGCAPTION.toString()))) {
sink.figureCaption_();
- }
- else if ( parser.getName().equals( HtmlMarkup.A.toString() ) )
- {
- handleAEnd( sink );
- }
-
- else if ( parser.getName().equals( HtmlMarkup.EM.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.A.toString())) {
+ handleAEnd(sink);
+ } else if (parser.getName().equals(HtmlMarkup.EM.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.STRONG.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.STRONG.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SMALL.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SMALL.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.S.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.S.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.CITE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.CITE.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.Q.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.Q.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DFN.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.DFN.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.ABBR.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.ABBR.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.I.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.I.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.B.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.B.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.CODE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.CODE.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.VAR.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.VAR.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SAMP.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SAMP.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.KBD.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.KBD.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SUP.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SUP.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SUB.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SUB.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.U.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.U.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.MARK.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.MARK.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.RUBY.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.RUBY.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.RB.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.RB.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.RT.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.RT.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.RTC.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.RTC.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.RP.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.RP.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.BDI.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.BDI.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.BDO.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.BDO.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SPAN.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SPAN.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.INS.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.INS.toString())) {
sink.inline_();
- }
- else if ( parser.getName().equals( HtmlMarkup.DEL.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.DEL.toString())) {
sink.inline_();
}
@@ -700,92 +490,51 @@ public class Xhtml5BaseParser
// Tables
// ----------------------------------------------------------------------
- else if ( parser.getName().equals( HtmlMarkup.TABLE.toString() ) )
- {
+ else if (parser.getName().equals(HtmlMarkup.TABLE.toString())) {
sink.tableRows_();
sink.table_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TR.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.TR.toString())) {
sink.tableRow_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TH.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.TH.toString())) {
sink.tableHeaderCell_();
- }
- else if ( parser.getName().equals( HtmlMarkup.TD.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.TD.toString())) {
sink.tableCell_();
- }
- else if ( parser.getName().equals( HtmlMarkup.CAPTION.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.CAPTION.toString())) {
sink.tableCaption_();
- }
- else if ( parser.getName().equals( HtmlMarkup.ARTICLE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.ARTICLE.toString())) {
sink.article_();
- }
- else if ( parser.getName().equals( HtmlMarkup.NAV.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.NAV.toString())) {
sink.navigation_();
- }
- else if ( parser.getName().equals( HtmlMarkup.ASIDE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.ASIDE.toString())) {
sink.sidebar_();
- }
- else if ( parser.getName().equals( HtmlMarkup.SECTION.toString() ) )
- {
- handleSectionEnd( sink );
- }
- else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.SECTION.toString())) {
+ handleSectionEnd(sink);
+ } else if (parser.getName().equals(HtmlMarkup.H1.toString())) {
sink.sectionTitle1_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.H2.toString())) {
sink.sectionTitle2_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.H3.toString())) {
sink.sectionTitle3_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.H4.toString())) {
sink.sectionTitle4_();
- }
- else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.H5.toString())) {
sink.sectionTitle5_();
- }
- else if ( parser.getName().equals( HtmlMarkup.HEADER.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.HEADER.toString())) {
sink.header_();
- }
- else if ( parser.getName().equals( HtmlMarkup.MAIN.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.MAIN.toString())) {
sink.content_();
- }
- else if ( parser.getName().equals( HtmlMarkup.FOOTER.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.FOOTER.toString())) {
sink.footer_();
- }
- else if ( parser.getName().equals( HtmlMarkup.BLOCKQUOTE.toString() ) )
- {
+ } else if (parser.getName().equals(HtmlMarkup.BLOCKQUOTE.toString())) {
sink.blockquote_();
- }
- else if ( UNMATCHED_XHTML5_ELEMENTS.contains( parser.getName() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_END );
- }
- else if ( parser.getName().equals( HtmlMarkup.SCRIPT.toString() )
- || parser.getName().equals( HtmlMarkup.STYLE.toString() ) )
- {
- handleUnknown( parser, sink, TAG_TYPE_END );
+ } else if (UNMATCHED_XHTML5_ELEMENTS.contains(parser.getName())) {
+ handleUnknown(parser, sink, TAG_TYPE_END);
+ } else if (parser.getName().equals(HtmlMarkup.SCRIPT.toString())
+ || parser.getName().equals(HtmlMarkup.STYLE.toString())) {
+ handleUnknown(parser, sink, TAG_TYPE_END);
scriptBlock = false;
- }
- else
- {
+ } else {
visited = false;
}
@@ -798,13 +547,14 @@ public class Xhtml5BaseParser
* 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() );
+ 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());
}
}
@@ -814,21 +564,17 @@ public class Xhtml5BaseParser
* 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 ) )
- {
+ 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 );
+ 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
@@ -836,46 +582,34 @@ public class Xhtml5BaseParser
*
* NOTE: text within script tags is ignored, scripting code should be embedded in CDATA.
*/
- if ( StringUtils.isNotEmpty( text ) && !isScriptBlock() )
- {
- sink.text( text );
+ if (StringUtils.isNotEmpty(text) && !isScriptBlock()) {
+ sink.text(text);
}
}
/** {@inheritDoc} */
@Override
- protected void handleComment( XmlPullParser parser, Sink sink )
- throws XmlPullParserException
- {
- String text = getText( parser );
+ protected void handleComment(XmlPullParser parser, Sink sink) throws XmlPullParserException {
+ String text = getText(parser);
- if ( "PB".equals( text.trim() ) )
- {
+ if ("PB".equals(text.trim())) {
sink.pageBreak();
- }
- else
- {
- if ( isEmitComments() )
- {
- sink.comment( text );
+ } 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 );
+ 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);
}
}
@@ -913,10 +647,9 @@ public class Xhtml5BaseParser
* @param sink the sink to receive the events.
* @param attribs a {@link org.apache.maven.doxia.sink.impl.SinkEventAttributeSet} object.
*/
- protected void consecutiveSections( int newLevel, Sink sink, SinkEventAttributeSet attribs )
- {
- closeOpenSections( newLevel, sink );
- openMissingSections( newLevel, sink );
+ protected void consecutiveSections(int newLevel, Sink sink, SinkEventAttributeSet attribs) {
+ closeOpenSections(newLevel, sink);
+ openMissingSections(newLevel, sink);
this.headingLevel = newLevel;
}
@@ -927,29 +660,17 @@ public class Xhtml5BaseParser
* @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.headingLevel >= newLevel
- && this.sectionLevel < headingLevel )
- {
- if ( headingLevel == Sink.SECTION_LEVEL_5 )
- {
+ private void closeOpenSections(int newLevel, Sink sink) {
+ while (this.headingLevel >= newLevel && this.sectionLevel < headingLevel) {
+ if (headingLevel == Sink.SECTION_LEVEL_5) {
sink.section5_();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_4 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_4) {
sink.section4_();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_3 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_3) {
sink.section3_();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_2 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_2) {
sink.section2_();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_1 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_1) {
sink.section1_();
}
@@ -963,31 +684,19 @@ public class Xhtml5BaseParser
* @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.headingLevel < newLevel
- && this.sectionLevel < newLevel )
- {
+ private void openMissingSections(int newLevel, Sink sink) {
+ while (this.headingLevel < newLevel && this.sectionLevel < newLevel) {
this.headingLevel++;
- if ( headingLevel == Sink.SECTION_LEVEL_5 )
- {
+ if (headingLevel == Sink.SECTION_LEVEL_5) {
sink.section5();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_4 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_4) {
sink.section4();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_3 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_3) {
sink.section3();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_2 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_2) {
sink.section2();
- }
- else if ( headingLevel == Sink.SECTION_LEVEL_1 )
- {
+ } else if (headingLevel == Sink.SECTION_LEVEL_1) {
sink.section1();
}
}
@@ -998,8 +707,7 @@ public class Xhtml5BaseParser
*
* @return the current section level.
*/
- protected int getSectionLevel()
- {
+ protected int getSectionLevel() {
return this.headingLevel;
}
@@ -1008,24 +716,21 @@ public class Xhtml5BaseParser
*
* @param newLevel the new section level.
*/
- protected void setSectionLevel( int newLevel )
- {
+ protected void setSectionLevel(int newLevel) {
this.headingLevel = newLevel;
}
/**
* Stop verbatim mode.
*/
- protected void verbatim_()
- {
+ protected void verbatim_() {
this.inVerbatim = false;
}
/**
* Start verbatim mode.
*/
- protected void verbatim()
- {
+ protected void verbatim() {
this.inVerbatim = true;
}
@@ -1034,8 +739,7 @@ public class Xhtml5BaseParser
*
* @return true if we are currently in verbatim mode.
*/
- protected boolean isVerbatim()
- {
+ protected boolean isVerbatim() {
return this.inVerbatim;
}
@@ -1045,8 +749,7 @@ public class Xhtml5BaseParser
* @return true if we are currently inside <code><script></code> tags.
* @since 1.1.1.
*/
- protected boolean isScriptBlock()
- {
+ protected boolean isScriptBlock() {
return this.scriptBlock;
}
@@ -1057,13 +760,11 @@ public class Xhtml5BaseParser
* @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 );
+ protected String validAnchor(String id) {
+ if (!DoxiaUtils.isValidId(id)) {
+ String linkAnchor = DoxiaUtils.encodeId(id, true);
- LOGGER.debug( "Modified invalid link '{}' to '{}'", id, linkAnchor );
+ LOGGER.debug("Modified invalid link '{}' to '{}'", id, linkAnchor);
return linkAnchor;
}
@@ -1073,8 +774,7 @@ public class Xhtml5BaseParser
/** {@inheritDoc} */
@Override
- protected void init()
- {
+ protected void init() {
super.init();
this.scriptBlock = false;
@@ -1085,140 +785,106 @@ public class Xhtml5BaseParser
this.inVerbatim = false;
}
- private void handleAEnd( Sink sink )
- {
- if ( isLink )
- {
+ private void handleAEnd(Sink sink) {
+ if (isLink) {
sink.link_();
isLink = false;
- }
- else if ( isAnchor )
- {
+ } else if (isAnchor) {
sink.anchor_();
isAnchor = false;
}
}
- private void handleAStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
- String href = parser.getAttributeValue( null, Attribute.HREF.toString() );
+ 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 (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 );
+ if (!DoxiaUtils.isValidId(hash)) {
+ href = href.substring(0, hashIndex) + "#" + DoxiaUtils.encodeId(hash, true);
- LOGGER.debug( "Modified invalid link '{}' to '{}'", hash, href );
+ LOGGER.debug("Modified invalid link '{}' to '{}'", hash, href);
}
}
- sink.link( href, attribs );
+ sink.link(href, attribs);
isLink = true;
- }
- else
- {
- String id = parser.getAttributeValue( null, Attribute.ID.toString() );
- if ( id != null )
- {
- sink.anchor( validAnchor( id ), attribs );
+ } 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 )
- {
- String divclass = parser.getAttributeValue( null, Attribute.CLASS.toString() );
+ private boolean handleDivStart(XmlPullParser parser, SinkEventAttributeSet attribs, Sink sink) {
+ String divclass = parser.getAttributeValue(null, Attribute.CLASS.toString());
- this.divStack.push( divclass );
+ this.divStack.push(divclass);
- if ( "content".equals( divclass ) )
- {
- SinkEventAttributeSet atts = new SinkEventAttributeSet( attribs );
- atts.removeAttribute( SinkEventAttributes.CLASS );
- sink.content( atts );
+ if ("content".equals(divclass)) {
+ SinkEventAttributeSet atts = new SinkEventAttributeSet(attribs);
+ atts.removeAttribute(SinkEventAttributes.CLASS);
+ sink.content(atts);
}
- if ( "source".equals( divclass ) )
- {
+ if ("source".equals(divclass)) {
return false;
- }
- else
- {
- sink.division( attribs );
+ } else {
+ sink.division(attribs);
}
return true;
}
- private boolean handleDivEnd( Sink sink )
- {
+ private boolean handleDivEnd(Sink sink) {
String divclass = divStack.pop();
- if ( "content".equals( divclass ) )
- {
+ if ("content".equals(divclass)) {
sink.content_();
}
- if ( "source".equals( divclass ) )
- {
+ if ("source".equals(divclass)) {
return false;
- }
- else
- {
+ } else {
sink.division_();
}
return true;
}
- private void handleImgStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
- String src = parser.getAttributeValue( null, Attribute.SRC.toString() );
+ private void handleImgStart(XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs) {
+ String src = parser.getAttributeValue(null, Attribute.SRC.toString());
- if ( src != null )
- {
- sink.figureGraphics( src, attribs );
+ 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 handleLIStart(Sink sink, SinkEventAttributeSet attribs) {
+ if (orderedListDepth == 0) {
+ sink.listItem(attribs);
+ } else {
+ sink.numberedListItem(attribs);
}
}
- private void handleListItemEnd( Sink sink )
- {
- if ( orderedListDepth == 0 )
- {
+ private void handleListItemEnd(Sink sink) {
+ if (orderedListDepth == 0) {
sink.listItem_();
- }
- else
- {
+ } else {
sink.numberedListItem_();
}
}
- private void handleOLStart( XmlPullParser parser, Sink sink, SinkEventAttributeSet attribs )
- {
+ 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() );
+ String style = parser.getAttributeValue(null, Attribute.STYLE.toString());
- if ( style != null )
- {
- switch ( style )
- {
+ if (style != null) {
+ switch (style) {
case "list-style-type: upper-alpha":
numbering = Sink.NUMBERING_UPPER_ALPHA;
break;
@@ -1239,13 +905,12 @@ public class Xhtml5BaseParser
}
}
- sink.numberedList( numbering, attribs );
+ sink.numberedList(numbering, attribs);
orderedListDepth++;
}
- private void handlePStart( Sink sink, SinkEventAttributeSet attribs )
- {
- sink.paragraph( attribs );
+ private void handlePStart(Sink sink, SinkEventAttributeSet attribs) {
+ sink.paragraph(attribs);
}
/*
@@ -1258,41 +923,36 @@ public class Xhtml5BaseParser
* 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 )
- {
+ private void handlePreStart(SinkEventAttributeSet attribs, Sink sink) {
verbatim();
- sink.verbatim( attribs );
+ sink.verbatim(attribs);
}
- private void handleSectionStart( Sink sink, SinkEventAttributeSet attribs )
- {
- sink.section( ++sectionLevel, attribs );
+ private void handleSectionStart(Sink sink, SinkEventAttributeSet attribs) {
+ sink.section(++sectionLevel, attribs);
}
- private void handleHeadingStart( Sink sink, int level, SinkEventAttributeSet attribs )
- {
- consecutiveSections( level, sink, attribs );
- sink.sectionTitle( level, attribs );
+ private void handleHeadingStart(Sink sink, int level, SinkEventAttributeSet attribs) {
+ consecutiveSections(level, sink, attribs);
+ sink.sectionTitle(level, attribs);
}
- private void handleSectionEnd( Sink sink )
- {
- closeOpenSections( sectionLevel, sink );
+ private void handleSectionEnd(Sink sink) {
+ closeOpenSections(sectionLevel, sink);
this.headingLevel = 0;
- sink.section_( sectionLevel-- );
+ sink.section_(sectionLevel--);
}
- private void handleTableStart( Sink sink, SinkEventAttributeSet attribs, XmlPullParser parser )
- {
- sink.table( attribs );
- String givenTableClass = parser.getAttributeValue( null, Attribute.CLASS.toString() );
+ private void handleTableStart(Sink sink, SinkEventAttributeSet attribs, XmlPullParser parser) {
+ sink.table(attribs);
+ String givenTableClass = parser.getAttributeValue(null, Attribute.CLASS.toString());
boolean grid = false;
- if ( givenTableClass != null && BODYTABLEBORDER_CLASS_PATTERN.matcher( givenTableClass ).matches() )
- {
+ if (givenTableClass != null
+ && BODYTABLEBORDER_CLASS_PATTERN.matcher(givenTableClass).matches()) {
grid = true;
}
- sink.tableRows( null, grid );
+ sink.tableRows(null, grid);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
index 08ad918b..a6ea0a27 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.manager;
/*
@@ -23,10 +41,10 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.apache.maven.doxia.parser.Parser;
-
import java.util.Map;
+import org.apache.maven.doxia.parser.Parser;
+
/**
* Simple implementation of the <code>ParserManager</code> interface.
*
@@ -35,22 +53,17 @@ import java.util.Map;
*/
@Singleton
@Named
-public class DefaultParserManager
- implements ParserManager
-{
- @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
+public class DefaultParserManager implements ParserManager {
+ @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@Inject
private Map<String, Parser> parsers;
/** {@inheritDoc} */
- public Parser getParser( String id )
- throws ParserNotFoundException
- {
- Parser parser = parsers.get( id );
-
- if ( parser == null )
- {
- throw new ParserNotFoundException( "Cannot find parser with id = " + id );
+ public Parser getParser(String id) throws ParserNotFoundException {
+ Parser parser = parsers.get(id);
+
+ if (parser == null) {
+ throw new ParserNotFoundException("Cannot find parser with id = " + id);
}
return parser;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserManager.java
index 77bca137..380abfff 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.manager;
/*
@@ -27,8 +45,7 @@ import org.apache.maven.doxia.parser.Parser;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public interface ParserManager
-{
+public interface ParserManager {
/**
* Returns the parser that corresponds to the given id.
@@ -38,6 +55,5 @@ public interface ParserManager
* @throws org.apache.maven.doxia.parser.manager.ParserNotFoundException if no parser could be found
* for the given id.
*/
- Parser getParser( String id )
- throws ParserNotFoundException;
+ Parser getParser(String id) throws ParserNotFoundException;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserNotFoundException.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserNotFoundException.java
index 57f9948c..5a147068 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserNotFoundException.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/ParserNotFoundException.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.manager;
/*
@@ -26,9 +44,7 @@ package org.apache.maven.doxia.parser.manager;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @since 1.0
*/
-public class ParserNotFoundException
- extends Exception
-{
+public class ParserNotFoundException extends Exception {
/** serialVersionUID */
static final long serialVersionUID = 295967936746221567L;
@@ -38,9 +54,8 @@ public class ParserNotFoundException
* @param message The detailed message.
* This can later be retrieved by the Throwable.getMessage() method.
*/
- public ParserNotFoundException( String message )
- {
- super( message );
+ public ParserNotFoundException(String message) {
+ super(message);
}
/**
@@ -51,9 +66,8 @@ public class ParserNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public ParserNotFoundException( Throwable cause )
- {
- super( cause );
+ public ParserNotFoundException(Throwable cause) {
+ super(cause);
}
/**
@@ -66,8 +80,7 @@ public class ParserNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public ParserNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
+ public ParserNotFoundException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/AbstractParserModule.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/AbstractParserModule.java
index e2312060..168d41e2 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/AbstractParserModule.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/AbstractParserModule.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.module;
/*
@@ -24,9 +42,7 @@ package org.apache.maven.doxia.parser.module;
*
* @since 1.6
*/
-public abstract class AbstractParserModule
- implements ParserModule
-{
+public abstract class AbstractParserModule implements ParserModule {
/** The source directory. */
private final String sourceDirectory;
@@ -39,9 +55,8 @@ public abstract class AbstractParserModule
/**
* Constructor with null.
*/
- public AbstractParserModule()
- {
- this( null, null, (String[]) null );
+ public AbstractParserModule() {
+ this(null, null, (String[]) null);
}
/**
@@ -49,9 +64,8 @@ public abstract class AbstractParserModule
*
* @param parserId the parser id
*/
- public AbstractParserModule( String parserId )
- {
- this( parserId, parserId, parserId );
+ public AbstractParserModule(String parserId) {
+ this(parserId, parserId, parserId);
}
/**
@@ -60,9 +74,8 @@ public abstract class AbstractParserModule
* @param parserId the parser id
* @param extension the file extension
*/
- public AbstractParserModule( String parserId, String extension )
- {
- this( parserId, parserId, new String[] { extension } );
+ public AbstractParserModule(String parserId, String extension) {
+ this(parserId, parserId, new String[] {extension});
}
/**
@@ -73,8 +86,7 @@ public abstract class AbstractParserModule
* @param extensions not null
* @since 1.7
*/
- protected AbstractParserModule( String sourceDirectory, String parserId, String... extensions )
- {
+ protected AbstractParserModule(String sourceDirectory, String parserId, String... extensions) {
super();
this.sourceDirectory = sourceDirectory;
this.extensions = extensions;
@@ -86,8 +98,7 @@ public abstract class AbstractParserModule
*
* @return a {@link java.lang.String} object.
*/
- public String getSourceDirectory()
- {
+ public String getSourceDirectory() {
return sourceDirectory;
}
@@ -96,8 +107,7 @@ public abstract class AbstractParserModule
*
* @return an array of {@link java.lang.String} objects.
*/
- public String[] getExtensions()
- {
+ public String[] getExtensions() {
return extensions;
}
@@ -106,8 +116,7 @@ public abstract class AbstractParserModule
*
* @return a {@link java.lang.String} object.
*/
- public String getParserId()
- {
+ public String getParserId() {
return parserId;
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
index 5ff18808..0cc15940 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.module;
/*
@@ -34,10 +52,8 @@ import java.util.Map;
*/
@Singleton
@Named
-public class DefaultParserModuleManager
- implements ParserModuleManager
-{
- @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
+public class DefaultParserModuleManager implements ParserModuleManager {
+ @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@Inject
private Map<String, ParserModule> parserModules;
@@ -48,14 +64,11 @@ public class DefaultParserModuleManager
*
* @return a {@link java.util.Collection} object.
*/
- public Collection<ParserModule> getParserModules()
- {
- if ( parserModulesValues == null )
- {
+ public Collection<ParserModule> getParserModules() {
+ if (parserModulesValues == null) {
Map<Class<?>, ParserModule> parserModulesTmp = new LinkedHashMap<>();
- for ( ParserModule module : parserModules.values() )
- {
- parserModulesTmp.put( module.getClass(), module );
+ for (ParserModule module : parserModules.values()) {
+ parserModulesTmp.put(module.getClass(), module);
}
parserModulesValues = parserModulesTmp.values();
}
@@ -64,14 +77,11 @@ public class DefaultParserModuleManager
}
/** {@inheritDoc} */
- public ParserModule getParserModule( String id )
- throws ParserModuleNotFoundException
- {
- ParserModule parserModule = parserModules.get( id );
+ public ParserModule getParserModule(String id) throws ParserModuleNotFoundException {
+ ParserModule parserModule = parserModules.get(id);
- if ( parserModule == null )
- {
- throw new ParserModuleNotFoundException( "Cannot find parser module id = " + id );
+ if (parserModule == null) {
+ throw new ParserModuleNotFoundException("Cannot find parser module id = " + id);
}
return parserModule;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModule.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModule.java
index ec60df47..75485b27 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModule.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModule.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.module;
/*
@@ -25,8 +43,7 @@ package org.apache.maven.doxia.parser.module;
*
* @since 1.6
*/
-public interface ParserModule
-{
+public interface ParserModule {
/**
* Returns the directory that contains source files for a given module.
*
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleManager.java
index c6db574b..3378a951 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleManager.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.module;
/*
@@ -26,8 +44,7 @@ import java.util.Collection;
*
* @since 1.6
*/
-public interface ParserModuleManager
-{
+public interface ParserModuleManager {
/**
* Returns a collection of ParserModules.
*
@@ -43,6 +60,5 @@ public interface ParserModuleManager
* @throws ParserModuleNotFoundException if no ParserModule could be found
* for the given id.
*/
- ParserModule getParserModule( String id )
- throws ParserModuleNotFoundException;
+ ParserModule getParserModule(String id) throws ParserModuleNotFoundException;
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleNotFoundException.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleNotFoundException.java
index ec541197..734750b1 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleNotFoundException.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/ParserModuleNotFoundException.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.parser.module;
/*
@@ -25,9 +43,7 @@ package org.apache.maven.doxia.parser.module;
*
* @since 1.6
*/
-public class ParserModuleNotFoundException
- extends Exception
-{
+public class ParserModuleNotFoundException extends Exception {
private static final long serialVersionUID = 8717077929507984309L;
/**
@@ -37,9 +53,8 @@ public class ParserModuleNotFoundException
* @param message The detailed message.
* This can later be retrieved by the Throwable.getMessage() method.
*/
- public ParserModuleNotFoundException( String message )
- {
- super( message );
+ public ParserModuleNotFoundException(String message) {
+ super(message);
}
/**
@@ -50,9 +65,8 @@ public class ParserModuleNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public ParserModuleNotFoundException( Throwable cause )
- {
- super( cause );
+ public ParserModuleNotFoundException(Throwable cause) {
+ super(cause);
}
/**
@@ -65,8 +79,7 @@ public class ParserModuleNotFoundException
* Throwable.getCause() method. (A null value is permitted, and indicates
* that the cause is nonexistent or unknown.)
*/
- public ParserModuleNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
+ public ParserModuleNotFoundException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
index e5495cf2..582d2f02 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -29,61 +47,49 @@ import org.apache.maven.doxia.sink.Sink;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.1
*/
-public abstract class AbstractSink
- implements Sink, Markup
-{
+public abstract class AbstractSink implements Sink, Markup {
/**
- * Parses the given String and replaces all occurrences of
- * '\n', '\r' and '\r\n' with the system EOL. All Sinks should
- * make sure that text output is filtered through this method.
- *
- * @param text the text to scan.
- * May be null in which case null is returned.
- * @return a String that contains only System EOLs.
- */
- protected static String unifyEOLs( String text )
- {
- if ( text == null )
- {
+ * Parses the given String and replaces all occurrences of
+ * '\n', '\r' and '\r\n' with the system EOL. All Sinks should
+ * make sure that text output is filtered through this method.
+ *
+ * @param text the text to scan.
+ * May be null in which case null is returned.
+ * @return a String that contains only System EOLs.
+ */
+ protected static String unifyEOLs(String text) {
+ if (text == null) {
return null;
}
int length = text.length();
- StringBuilder buffer = new StringBuilder( length );
+ StringBuilder buffer = new StringBuilder(length);
- for ( int i = 0; i < length; i++ )
- {
- if ( text.charAt( i ) == '\r' )
- {
- if ( ( i + 1 ) < length && text.charAt( i + 1 ) == '\n' )
- {
+ for (int i = 0; i < length; i++) {
+ if (text.charAt(i) == '\r') {
+ if ((i + 1) < length && text.charAt(i + 1) == '\n') {
i++;
}
- buffer.append( EOL );
- }
- else if ( text.charAt( i ) == '\n' )
- {
- buffer.append( EOL );
- }
- else
- {
- buffer.append( text.charAt( i ) );
+ buffer.append(EOL);
+ } else if (text.charAt(i) == '\n') {
+ buffer.append(EOL);
+ } else {
+ buffer.append(text.charAt(i));
}
}
return buffer.toString();
}
- /**
- * This is called in {@link #head()} or in {@link #close()}, and can be used
- * to set the sink into a clear state so it can be re-used.
- *
- * @since 1.1.2
- */
- protected void init()
- {
- // nop
- }
+ /**
+ * This is called in {@link #head()} or in {@link #close()}, and can be used
+ * to set the sink into a clear state so it can be re-used.
+ *
+ * @since 1.1.2
+ */
+ protected void init() {
+ // nop
+ }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSink.java
index eb8bbb95..949a4780 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -26,10 +44,6 @@ import org.apache.maven.doxia.markup.TextMarkup;
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
*/
-public abstract class AbstractTextSink
- extends SinkAdapter
- implements TextMarkup
-{
+public abstract class AbstractTextSink extends SinkAdapter implements TextMarkup {
// nop
}
-
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSinkFactory.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSinkFactory.java
index 3f7acb3c..1efb4ab9 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSinkFactory.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractTextSinkFactory.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -38,9 +56,7 @@ import org.codehaus.plexus.util.WriterFactory;
* @author Benjamin Bentmann
* @since 1.1
*/
-public abstract class AbstractTextSinkFactory
- implements SinkFactory
-{
+public abstract class AbstractTextSinkFactory implements SinkFactory {
/**
* Create a text Sink for a given encoding.
*
@@ -48,49 +64,37 @@ public abstract class AbstractTextSinkFactory
* @param encoding The character encoding used by the writer.
* @return a Sink for text output in the given encoding.
*/
- protected abstract Sink createSink( Writer writer, String encoding );
+ protected abstract Sink createSink(Writer writer, String encoding);
/** {@inheritDoc} */
- public Sink createSink( File outputDir, String outputName )
- throws IOException
- {
- return createSink( outputDir, outputName, WriterFactory.UTF_8 );
+ public Sink createSink(File outputDir, String outputName) throws IOException {
+ return createSink(outputDir, outputName, WriterFactory.UTF_8);
}
/** {@inheritDoc} */
- public Sink createSink( File outputDir, String outputName, String encoding )
- throws IOException
- {
- Objects.requireNonNull( outputDir, "outputDir cannot be null" );
+ public Sink createSink(File outputDir, String outputName, String encoding) throws IOException {
+ Objects.requireNonNull(outputDir, "outputDir cannot be null");
- if ( !outputDir.exists() )
- {
+ if (!outputDir.exists()) {
outputDir.mkdirs();
- }
- else
- {
- if ( !outputDir.isDirectory() )
- {
- throw new IllegalArgumentException( "The dir '" + outputDir + "' is not a directory." );
+ } else {
+ if (!outputDir.isDirectory()) {
+ throw new IllegalArgumentException("The dir '" + outputDir + "' is not a directory.");
}
}
- Writer writer = WriterFactory.newWriter( new File( outputDir, outputName ), encoding );
+ Writer writer = WriterFactory.newWriter(new File(outputDir, outputName), encoding);
- return createSink( writer, encoding );
+ return createSink(writer, encoding);
}
/** {@inheritDoc} */
- public Sink createSink( OutputStream out )
- throws IOException
- {
- return createSink( out, WriterFactory.UTF_8 );
+ public Sink createSink(OutputStream out) throws IOException {
+ return createSink(out, WriterFactory.UTF_8);
}
/** {@inheritDoc} */
- public Sink createSink( OutputStream out, String encoding )
- throws IOException
- {
- return createSink( new OutputStreamWriter( out, encoding ), encoding );
+ public Sink createSink(OutputStream out, String encoding) throws IOException {
+ return createSink(new OutputStreamWriter(out, encoding), encoding);
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSink.java
index 5dbb5591..5d5da179 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -19,11 +37,11 @@ package org.apache.maven.doxia.sink.impl;
* under the License.
*/
-import java.util.Objects;
-
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Tag;
+import java.util.Objects;
+
import org.apache.maven.doxia.markup.XmlMarkup;
/**
@@ -32,14 +50,11 @@ import org.apache.maven.doxia.markup.XmlMarkup;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.0
*/
-public abstract class AbstractXmlSink
- extends SinkAdapter
- implements XmlMarkup
-{
+public abstract class AbstractXmlSink extends SinkAdapter implements XmlMarkup {
/** Default namespace prepended to all tags */
private String nameSpace;
- private boolean firstTag = true;
+ private boolean firstTag = true;
private boolean insertNewline = true;
@@ -48,8 +63,7 @@ public abstract class AbstractXmlSink
*
* @param insertNewline a boolean.
*/
- public void setInsertNewline( boolean insertNewline )
- {
+ public void setInsertNewline(boolean insertNewline) {
this.insertNewline = insertNewline;
}
@@ -59,8 +73,7 @@ public abstract class AbstractXmlSink
* @param ns the default namespace.
* @since 1.1
*/
- public void setNameSpace( String ns )
- {
+ public void setNameSpace(String ns) {
this.nameSpace = ns;
}
@@ -70,8 +83,7 @@ public abstract class AbstractXmlSink
* @return the current default namespace.
* @since 1.1
*/
- public String getNameSpace()
- {
+ public String getNameSpace() {
return this.nameSpace;
}
@@ -84,9 +96,8 @@ public abstract class AbstractXmlSink
* @param t a non null tag
* @see #writeStartTag(javax.swing.text.html.HTML.Tag, javax.swing.text.MutableAttributeSet)
*/
- protected void writeStartTag( Tag t )
- {
- writeStartTag ( t, null );
+ protected void writeStartTag(Tag t) {
+ writeStartTag(t, null);
}
/**
@@ -99,9 +110,8 @@ public abstract class AbstractXmlSink
* @param att a set of attributes. May be null.
* @see #writeStartTag(javax.swing.text.html.HTML.Tag, javax.swing.text.MutableAttributeSet, boolean)
*/
- protected void writeStartTag( Tag t, MutableAttributeSet att )
- {
- writeStartTag ( t, att, false );
+ protected void writeStartTag(Tag t, MutableAttributeSet att) {
+ writeStartTag(t, att, false);
}
/**
@@ -114,37 +124,33 @@ public abstract class AbstractXmlSink
* @param att a set of attributes. May be null.
* @param isSimpleTag boolean to write as a simple tag.
*/
- protected void writeStartTag( Tag t, MutableAttributeSet att, boolean isSimpleTag )
- {
- Objects.requireNonNull( t, "t cannot be null" );
+ protected void writeStartTag(Tag t, MutableAttributeSet att, boolean isSimpleTag) {
+ Objects.requireNonNull(t, "t cannot be null");
StringBuilder sb = new StringBuilder();
- if ( insertNewline && t.isBlock() && !firstTag )
- {
- sb.append( EOL );
+ if (insertNewline && t.isBlock() && !firstTag) {
+ sb.append(EOL);
}
firstTag = false;
- sb.append( LESS_THAN );
+ sb.append(LESS_THAN);
- if ( nameSpace != null )
- {
- sb.append( nameSpace ).append( ':' );
+ if (nameSpace != null) {
+ sb.append(nameSpace).append(':');
}
- sb.append( t.toString() );
+ sb.append(t.toString());
- sb.append( SinkUtils.getAttributeString( att ) );
+ sb.append(SinkUtils.getAttributeString(att));
- if ( isSimpleTag )
- {
- sb.append( SPACE ).append( SLASH );
+ if (isSimpleTag) {
+ sb.append(SPACE).append(SLASH);
}
- sb.append( GREATER_THAN );
+ sb.append(GREATER_THAN);
- write( sb.toString() );
+ write(sb.toString());
}
/**
@@ -152,9 +158,8 @@ public abstract class AbstractXmlSink
*
* @since 1.1
*/
- protected void writeEOL()
- {
- write( EOL );
+ protected void writeEOL() {
+ write(EOL);
}
/**
@@ -162,23 +167,21 @@ public abstract class AbstractXmlSink
*
* @param t a tag.
*/
- protected void writeEndTag( Tag t )
- {
- Objects.requireNonNull( t, "t cannot be null" );
+ protected void writeEndTag(Tag t) {
+ Objects.requireNonNull(t, "t cannot be null");
StringBuilder sb = new StringBuilder();
- sb.append( LESS_THAN );
- sb.append( SLASH );
+ sb.append(LESS_THAN);
+ sb.append(SLASH);
- if ( nameSpace != null )
- {
- sb.append( nameSpace ).append( ':' );
+ if (nameSpace != null) {
+ sb.append(nameSpace).append(':');
}
- sb.append( t.toString() );
- sb.append( GREATER_THAN );
+ sb.append(t.toString());
+ sb.append(GREATER_THAN);
- write( sb.toString() );
+ write(sb.toString());
}
/**
@@ -190,9 +193,8 @@ public abstract class AbstractXmlSink
* @param t a non null tag
* @see #writeSimpleTag(javax.swing.text.html.HTML.Tag, javax.swing.text.MutableAttributeSet)
*/
- protected void writeSimpleTag( Tag t )
- {
- writeSimpleTag( t, null );
+ protected void writeSimpleTag(Tag t) {
+ writeSimpleTag(t, null);
}
/**
@@ -205,9 +207,8 @@ public abstract class AbstractXmlSink
* @param att a set of attributes. May be null.
* @see #writeStartTag(javax.swing.text.html.HTML.Tag, javax.swing.text.MutableAttributeSet, boolean)
*/
- protected void writeSimpleTag( Tag t, MutableAttributeSet att )
- {
- writeStartTag ( t, att, true );
+ protected void writeSimpleTag(Tag t, MutableAttributeSet att) {
+ writeStartTag(t, att, true);
}
/**
@@ -215,5 +216,5 @@ public abstract class AbstractXmlSink
*
* @param text the given text to write
*/
- protected abstract void write( String text );
+ protected abstract void write(String text);
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSinkFactory.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSinkFactory.java
index 4a516b57..b27456b5 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSinkFactory.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractXmlSinkFactory.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -30,9 +48,7 @@ import org.apache.maven.doxia.sink.Sink;
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @since 1.1
*/
-public abstract class AbstractXmlSinkFactory
- extends AbstractTextSinkFactory
-{
+public abstract class AbstractXmlSinkFactory extends AbstractTextSinkFactory {
/**
* Create a text Sink for a given encoding and for a given language identifier.
*
@@ -44,5 +60,5 @@ public abstract class AbstractXmlSinkFactory
* @return a Sink for XML output in the given encoding.
* @see <a href="http://www.w3.org/TR/REC-xml/#sec-lang-tag">http://www.w3.org/TR/REC-xml/#sec-lang-tag</a>
*/
- protected abstract Sink createSink( Writer writer, String encoding, String languageId );
+ protected abstract Sink createSink(Writer writer, String encoding, String languageId);
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/PipelineSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/PipelineSink.java
index 14187da7..28f9a6ad 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/PipelineSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/PipelineSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -23,7 +41,6 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-
import java.util.List;
import org.apache.maven.doxia.sink.Sink;
@@ -33,9 +50,7 @@ import org.apache.maven.doxia.sink.Sink;
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
*/
-public class PipelineSink
- implements InvocationHandler
-{
+public class PipelineSink implements InvocationHandler {
private List<Sink> pipeline;
/**
@@ -43,8 +58,7 @@ public class PipelineSink
*
* @param pipeline A List of Sinks.
*/
- public PipelineSink( List<Sink> pipeline )
- {
+ public PipelineSink(List<Sink> pipeline) {
this.pipeline = pipeline;
}
@@ -53,9 +67,8 @@ public class PipelineSink
*
* @param sink the Sink to add.
*/
- public void addSink( Sink sink )
- {
- pipeline.add( sink );
+ public void addSink(Sink sink) {
+ pipeline.add(sink);
}
/**
@@ -70,12 +83,10 @@ public class PipelineSink
* @param args an array of {@link java.lang.Object} objects.
* @return a {@link java.lang.Object} object.
*/
- public Object invoke( Object proxy, Method method, Object[] args )
- throws IllegalAccessException, InvocationTargetException
- {
- for ( Sink sink : pipeline )
- {
- method.invoke( sink, args );
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws IllegalAccessException, InvocationTargetException {
+ for (Sink sink : pipeline) {
+ method.invoke(sink, args);
}
return null;
@@ -87,10 +98,8 @@ public class PipelineSink
* @param pipeline A List of Sinks.
* @return a {@link org.apache.maven.doxia.sink.Sink} object.
*/
- public static Sink newInstance( List<Sink> pipeline )
- {
- return (Sink) Proxy.newProxyInstance( PipelineSink.class.getClassLoader(),
- new Class<?>[]{Sink.class},
- new PipelineSink( pipeline ) );
+ public static Sink newInstance(List<Sink> pipeline) {
+ return (Sink) Proxy.newProxyInstance(
+ PipelineSink.class.getClassLoader(), new Class<?>[] {Sink.class}, new PipelineSink(pipeline));
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
index 4663af25..698d12b6 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -40,9 +58,7 @@ import org.apache.maven.doxia.sink.SinkFactory;
* @author Robert Scholte
* @since 1.3
*/
-public class RandomAccessSink
- implements Sink
-{
+public class RandomAccessSink implements Sink {
private SinkFactory sinkFactory;
private String encoding;
@@ -64,12 +80,10 @@ public class RandomAccessSink
* @param stream a {@link java.io.OutputStream} object.
* @throws java.io.IOException if any.
*/
- public RandomAccessSink( SinkFactory sinkFactory, OutputStream stream )
- throws IOException
- {
+ public RandomAccessSink(SinkFactory sinkFactory, OutputStream stream) throws IOException {
this.sinkFactory = sinkFactory;
this.coreOutputStream = stream;
- this.currentSink = sinkFactory.createSink( stream );
+ this.currentSink = sinkFactory.createSink(stream);
this.coreSink = this.currentSink;
}
@@ -81,13 +95,11 @@ public class RandomAccessSink
* @param encoding a {@link java.lang.String} object.
* @throws java.io.IOException if any.
*/
- public RandomAccessSink( SinkFactory sinkFactory, OutputStream stream, String encoding )
- throws IOException
- {
+ public RandomAccessSink(SinkFactory sinkFactory, OutputStream stream, String encoding) throws IOException {
this.sinkFactory = sinkFactory;
this.coreOutputStream = stream;
this.encoding = encoding;
- this.currentSink = sinkFactory.createSink( stream, encoding );
+ this.currentSink = sinkFactory.createSink(stream, encoding);
this.coreSink = this.currentSink;
}
@@ -99,12 +111,10 @@ public class RandomAccessSink
* @param outputName a {@link java.lang.String} object.
* @throws java.io.IOException if any.
*/
- public RandomAccessSink( SinkFactory sinkFactory, File outputDirectory, String outputName )
- throws IOException
- {
+ public RandomAccessSink(SinkFactory sinkFactory, File outputDirectory, String outputName) throws IOException {
this.sinkFactory = sinkFactory;
- this.coreOutputStream = new FileOutputStream( new File( outputDirectory, outputName ) );
- this.currentSink = sinkFactory.createSink( coreOutputStream );
+ this.coreOutputStream = new FileOutputStream(new File(outputDirectory, outputName));
+ this.currentSink = sinkFactory.createSink(coreOutputStream);
this.coreSink = this.currentSink;
}
@@ -117,34 +127,30 @@ public class RandomAccessSink
* @param encoding a {@link java.lang.String} object.
* @throws java.io.IOException if any.
*/
- public RandomAccessSink( SinkFactory sinkFactory, File outputDirectory, String outputName, String encoding )
- throws IOException
- {
+ public RandomAccessSink(SinkFactory sinkFactory, File outputDirectory, String outputName, String encoding)
+ throws IOException {
this.sinkFactory = sinkFactory;
- this.coreOutputStream = new FileOutputStream( new File( outputDirectory, outputName ) );
+ this.coreOutputStream = new FileOutputStream(new File(outputDirectory, outputName));
this.encoding = encoding;
- this.currentSink = sinkFactory.createSink( coreOutputStream, encoding );
+ this.currentSink = sinkFactory.createSink(coreOutputStream, encoding);
this.coreSink = this.currentSink;
}
/** {@inheritDoc} */
@Override
- public void address()
- {
+ public void address() {
currentSink.address();
}
/** {@inheritDoc} */
@Override
- public void address( SinkEventAttributes attributes )
- {
- currentSink.address( attributes );
+ public void address(SinkEventAttributes attributes) {
+ currentSink.address(attributes);
}
/** {@inheritDoc} */
@Override
- public void address_()
- {
+ public void address_() {
currentSink.address_();
}
@@ -154,32 +160,25 @@ public class RandomAccessSink
*
* @return a subsink reference you can write to
*/
- public Sink addSinkHook()
- {
+ public Sink addSinkHook() {
Sink subSink = null;
- try
- {
+ try {
ByteArrayOutputStream subOut = new ByteArrayOutputStream();
ByteArrayOutputStream newOut = new ByteArrayOutputStream();
- outputStreams.add( subOut );
- outputStreams.add( newOut );
+ outputStreams.add(subOut);
+ outputStreams.add(newOut);
- if ( encoding != null )
- {
- subSink = sinkFactory.createSink( subOut, encoding );
- currentSink = sinkFactory.createSink( newOut, encoding );
- }
- else
- {
- subSink = sinkFactory.createSink( subOut );
- currentSink = sinkFactory.createSink( newOut );
+ if (encoding != null) {
+ subSink = sinkFactory.createSink(subOut, encoding);
+ currentSink = sinkFactory.createSink(newOut, encoding);
+ } else {
+ subSink = sinkFactory.createSink(subOut);
+ currentSink = sinkFactory.createSink(newOut);
}
- sinks.add( subSink );
- sinks.add( currentSink );
- }
- catch ( IOException e )
- {
+ sinks.add(subSink);
+ sinks.add(currentSink);
+ } catch (IOException e) {
// IOException can only be caused by our own ByteArrayOutputStream
}
return subSink;
@@ -187,130 +186,111 @@ public class RandomAccessSink
/** {@inheritDoc} */
@Override
- public void anchor( String name )
- {
- currentSink.anchor( name );
+ public void anchor(String name) {
+ currentSink.anchor(name);
}
/** {@inheritDoc} */
@Override
- public void anchor( String name, SinkEventAttributes attributes )
- {
- currentSink.anchor( name, attributes );
+ public void anchor(String name, SinkEventAttributes attributes) {
+ currentSink.anchor(name, attributes);
}
/** {@inheritDoc} */
@Override
- public void anchor_()
- {
+ public void anchor_() {
currentSink.anchor_();
}
/** {@inheritDoc} */
@Override
- public void article()
- {
+ public void article() {
currentSink.article();
}
/** {@inheritDoc} */
@Override
- public void article( SinkEventAttributes attributes )
- {
- currentSink.article( attributes );
+ public void article(SinkEventAttributes attributes) {
+ currentSink.article(attributes);
}
/** {@inheritDoc} */
@Override
- public void article_()
- {
+ public void article_() {
currentSink.article_();
}
/** {@inheritDoc} */
@Override
- public void author()
- {
+ public void author() {
currentSink.author();
}
/** {@inheritDoc} */
@Override
- public void author( SinkEventAttributes attributes )
- {
- currentSink.author( attributes );
+ public void author(SinkEventAttributes attributes) {
+ currentSink.author(attributes);
}
/** {@inheritDoc} */
@Override
- public void author_()
- {
+ public void author_() {
currentSink.author_();
}
/** {@inheritDoc} */
@Override
- public void blockquote()
- {
+ public void blockquote() {
currentSink.blockquote();
}
/** {@inheritDoc} */
@Override
- public void blockquote( SinkEventAttributes attributes )
- {
- currentSink.blockquote( attributes );
+ public void blockquote(SinkEventAttributes attributes) {
+ currentSink.blockquote(attributes);
}
/** {@inheritDoc} */
@Override
- public void blockquote_()
- {
+ public void blockquote_() {
currentSink.blockquote_();
}
/** {@inheritDoc} */
@Override
- public void body()
- {
+ public void body() {
currentSink.body();
}
/** {@inheritDoc} */
@Override
- public void body( SinkEventAttributes attributes )
- {
- currentSink.body( attributes );
+ public void body(SinkEventAttributes attributes) {
+ currentSink.body(attributes);
}
/** {@inheritDoc} */
@Override
- public void body_()
- {
+ public void body_() {
currentSink.body_();
}
/** {@inheritDoc} */
@Override
- public void bold()
- {
+ public void bold() {
currentSink.bold();
}
/** {@inheritDoc} */
@Override
- public void bold_()
- {
+ public void bold_() {
currentSink.bold_();
}
/**
* Close all sinks
*/
- public void close()
- {
- for ( Sink sink : sinks )
- {
+ public void close() {
+ for (Sink sink : sinks) {
// sink is responsible for closing it's stream
sink.close();
}
@@ -319,254 +299,216 @@ public class RandomAccessSink
/** {@inheritDoc} */
@Override
- public void comment( String comment )
- {
- currentSink.comment( comment );
+ public void comment(String comment) {
+ currentSink.comment(comment);
}
/** {@inheritDoc} */
@Override
- public void content()
- {
+ public void content() {
currentSink.content();
}
/** {@inheritDoc} */
@Override
- public void content( SinkEventAttributes attributes )
- {
- currentSink.content( attributes );
+ public void content(SinkEventAttributes attributes) {
+ currentSink.content(attributes);
}
/** {@inheritDoc} */
@Override
- public void content_()
- {
+ public void content_() {
currentSink.content_();
}
/** {@inheritDoc} */
@Override
- public void data( String value )
- {
- currentSink.data( value );
+ public void data(String value) {
+ currentSink.data(value);
}
/** {@inheritDoc} */
@Override
- public void data( String value, SinkEventAttributes attributes )
- {
- currentSink.data( value, attributes );
+ public void data(String value, SinkEventAttributes attributes) {
+ currentSink.data(value, attributes);
}
/** {@inheritDoc} */
@Override
- public void data_()
- {
+ public void data_() {
currentSink.data_();
}
/** {@inheritDoc} */
@Override
- public void date()
- {
+ public void date() {
currentSink.date();
}
/** {@inheritDoc} */
@Override
- public void date( SinkEventAttributes attributes )
- {
- currentSink.date( attributes );
+ public void date(SinkEventAttributes attributes) {
+ currentSink.date(attributes);
}
/** {@inheritDoc} */
@Override
- public void date_()
- {
+ public void date_() {
currentSink.date_();
}
/** {@inheritDoc} */
@Override
- public void definedTerm()
- {
+ public void definedTerm() {
currentSink.definedTerm();
}
/** {@inheritDoc} */
@Override
- public void definedTerm( SinkEventAttributes attributes )
- {
- currentSink.definedTerm( attributes );
+ public void definedTerm(SinkEventAttributes attributes) {
+ currentSink.definedTerm(attributes);
}
/** {@inheritDoc} */
@Override
- public void definedTerm_()
- {
+ public void definedTerm_() {
currentSink.definedTerm_();
}
/** {@inheritDoc} */
@Override
- public void definition()
- {
+ public void definition() {
currentSink.definition();
}
/** {@inheritDoc} */
@Override
- public void definition( SinkEventAttributes attributes )
- {
- currentSink.definition( attributes );
+ public void definition(SinkEventAttributes attributes) {
+ currentSink.definition(attributes);
}
/** {@inheritDoc} */
@Override
- public void definitionList()
- {
+ public void definitionList() {
currentSink.definitionList();
}
/** {@inheritDoc} */
@Override
- public void definitionList( SinkEventAttributes attributes )
- {
- currentSink.definitionList( attributes );
+ public void definitionList(SinkEventAttributes attributes) {
+ currentSink.definitionList(attributes);
}
/** {@inheritDoc} */
@Override
- public void definitionListItem()
- {
+ public void definitionListItem() {
currentSink.definitionListItem();
}
/** {@inheritDoc} */
@Override
- public void definitionListItem( SinkEventAttributes attributes )
- {
- currentSink.definitionListItem( attributes );
+ public void definitionListItem(SinkEventAttributes attributes) {
+ currentSink.definitionListItem(attributes);
}
/** {@inheritDoc} */
@Override
- public void definitionListItem_()
- {
+ public void definitionListItem_() {
currentSink.definitionListItem_();
}
/** {@inheritDoc} */
@Override
- public void definitionList_()
- {
+ public void definitionList_() {
currentSink.definitionList_();
}
/** {@inheritDoc} */
@Override
- public void definition_()
- {
+ public void definition_() {
currentSink.definition_();
}
/** {@inheritDoc} */
@Override
- public void division()
- {
+ public void division() {
currentSink.division();
}
/** {@inheritDoc} */
@Override
- public void division( SinkEventAttributes attributes )
- {
- currentSink.division( attributes );
+ public void division(SinkEventAttributes attributes) {
+ currentSink.division(attributes);
}
/** {@inheritDoc} */
@Override
- public void division_()
- {
+ public void division_() {
currentSink.division_();
}
/** {@inheritDoc} */
@Override
- public void figure()
- {
+ public void figure() {
currentSink.figure();
}
/** {@inheritDoc} */
@Override
- public void figure( SinkEventAttributes attributes )
- {
- currentSink.figure( attributes );
+ public void figure(SinkEventAttributes attributes) {
+ currentSink.figure(attributes);
}
/** {@inheritDoc} */
@Override
- public void figureCaption()
- {
+ public void figureCaption() {
currentSink.figureCaption();
}
/** {@inheritDoc} */
@Override
- public void figureCaption( SinkEventAttributes attributes )
- {
- currentSink.figureCaption( attributes );
+ public void figureCaption(SinkEventAttributes attributes) {
+ currentSink.figureCaption(attributes);
}
/** {@inheritDoc} */
@Override
- public void figureCaption_()
- {
+ public void figureCaption_() {
currentSink.figureCaption_();
}
/** {@inheritDoc} */
@Override
- public void figureGraphics( String name )
- {
- currentSink.figureGraphics( name );
+ public void figureGraphics(String name) {
+ currentSink.figureGraphics(name);
}
/** {@inheritDoc} */
@Override
- public void figureGraphics( String src, SinkEventAttributes attributes )
- {
- currentSink.figureGraphics( src, attributes );
+ public void figureGraphics(String src, SinkEventAttributes attributes) {
+ currentSink.figureGraphics(src, attributes);
}
/** {@inheritDoc} */
@Override
- public void figure_()
- {
+ public void figure_() {
currentSink.figure_();
}
/**
* Flush all sinks
*/
- public void flush()
- {
- for ( int i = 0; i < sinks.size(); i++ )
- {
+ public void flush() {
+ for (int i = 0; i < sinks.size(); i++) {
// first flush to get complete buffer
// sink is responsible for flushing it's stream
- Sink sink = sinks.get( i );
+ Sink sink = sinks.get(i);
sink.flush();
- ByteArrayOutputStream stream = outputStreams.get( i );
- try
- {
- coreOutputStream.write( stream.toByteArray() );
- }
- catch ( IOException e )
- {
+ ByteArrayOutputStream stream = outputStreams.get(i);
+ try {
+ coreOutputStream.write(stream.toByteArray());
+ } catch (IOException e) {
// @todo
}
}
@@ -575,729 +517,625 @@ public class RandomAccessSink
/** {@inheritDoc} */
@Override
- public void footer()
- {
+ public void footer() {
currentSink.footer();
}
/** {@inheritDoc} */
@Override
- public void footer( SinkEventAttributes attributes )
- {
- currentSink.footer( attributes );
+ public void footer(SinkEventAttributes attributes) {
+ currentSink.footer(attributes);
}
/** {@inheritDoc} */
@Override
- public void footer_()
- {
+ public void footer_() {
currentSink.footer_();
}
/** {@inheritDoc} */
@Override
- public void head()
- {
+ public void head() {
currentSink.head();
}
/** {@inheritDoc} */
@Override
- public void head( SinkEventAttributes attributes )
- {
- currentSink.head( attributes );
+ public void head(SinkEventAttributes attributes) {
+ currentSink.head(attributes);
}
/** {@inheritDoc} */
@Override
- public void head_()
- {
+ public void head_() {
currentSink.head_();
}
/** {@inheritDoc} */
@Override
- public void header()
- {
+ public void header() {
currentSink.header();
}
/** {@inheritDoc} */
@Override
- public void header( SinkEventAttributes attributes )
- {
- currentSink.header( attributes );
+ public void header(SinkEventAttributes attributes) {
+ currentSink.header(attributes);
}
/** {@inheritDoc} */
@Override
- public void header_()
- {
+ public void header_() {
currentSink.header_();
}
/** {@inheritDoc} */
@Override
- public void horizontalRule()
- {
+ public void horizontalRule() {
currentSink.horizontalRule();
}
/** {@inheritDoc} */
@Override
- public void horizontalRule( SinkEventAttributes attributes )
- {
- currentSink.horizontalRule( attributes );
+ public void horizontalRule(SinkEventAttributes attributes) {
+ currentSink.horizontalRule(attributes);
}
/** {@inheritDoc} */
@Override
- public void inline()
- {
+ public void inline() {
currentSink.inline();
}
/** {@inheritDoc} */
@Override
- public void inline( SinkEventAttributes attributes )
- {
- currentSink.inline( attributes );
+ public void inline(SinkEventAttributes attributes) {
+ currentSink.inline(attributes);
}
/** {@inheritDoc} */
@Override
- public void inline_()
- {
+ public void inline_() {
currentSink.inline_();
}
/** {@inheritDoc} */
@Override
- public void italic()
- {
+ public void italic() {
currentSink.italic();
}
/** {@inheritDoc} */
@Override
- public void italic_()
- {
+ public void italic_() {
currentSink.italic_();
}
/** {@inheritDoc} */
@Override
- public void lineBreak()
- {
+ public void lineBreak() {
currentSink.lineBreak();
}
/** {@inheritDoc} */
@Override
- public void lineBreak( SinkEventAttributes attributes )
- {
- currentSink.lineBreak( attributes );
+ public void lineBreak(SinkEventAttributes attributes) {
+ currentSink.lineBreak(attributes);
}
/** {@inheritDoc} */
@Override
- public void lineBreakOpportunity()
- {
+ public void lineBreakOpportunity() {
currentSink.lineBreakOpportunity();
}
/** {@inheritDoc} */
@Override
- public void lineBreakOpportunity( SinkEventAttributes attributes )
- {
- currentSink.lineBreakOpportunity( attributes );
+ public void lineBreakOpportunity(SinkEventAttributes attributes) {
+ currentSink.lineBreakOpportunity(attributes);
}
/** {@inheritDoc} */
@Override
- public void link( String name )
- {
- currentSink.link( name );
+ public void link(String name) {
+ currentSink.link(name);
}
/** {@inheritDoc} */
@Override
- public void link( String name, SinkEventAttributes attributes )
- {
- currentSink.link( name, attributes );
+ public void link(String name, SinkEventAttributes attributes) {
+ currentSink.link(name, attributes);
}
/** {@inheritDoc} */
@Override
- public void link_()
- {
+ public void link_() {
currentSink.link_();
}
/** {@inheritDoc} */
@Override
- public void list()
- {
+ public void list() {
currentSink.list();
}
/** {@inheritDoc} */
@Override
- public void list( SinkEventAttributes attributes )
- {
- currentSink.list( attributes );
+ public void list(SinkEventAttributes attributes) {
+ currentSink.list(attributes);
}
/** {@inheritDoc} */
@Override
- public void listItem()
- {
+ public void listItem() {
currentSink.listItem();
}
/** {@inheritDoc} */
@Override
- public void listItem( SinkEventAttributes attributes )
- {
- currentSink.listItem( attributes );
+ public void listItem(SinkEventAttributes attributes) {
+ currentSink.listItem(attributes);
}
/** {@inheritDoc} */
@Override
- public void listItem_()
- {
+ public void listItem_() {
currentSink.listItem_();
}
/** {@inheritDoc} */
@Override
- public void list_()
- {
+ public void list_() {
currentSink.list_();
}
/** {@inheritDoc} */
@Override
- public void monospaced()
- {
+ public void monospaced() {
currentSink.monospaced();
}
/** {@inheritDoc} */
@Override
- public void monospaced_()
- {
+ public void monospaced_() {
currentSink.monospaced_();
}
/** {@inheritDoc} */
@Override
- public void navigation()
- {
+ public void navigation() {
currentSink.navigation();
}
/** {@inheritDoc} */
@Override
- public void navigation( SinkEventAttributes attributes )
- {
- currentSink.navigation( attributes );
+ public void navigation(SinkEventAttributes attributes) {
+ currentSink.navigation(attributes);
}
/** {@inheritDoc} */
@Override
- public void navigation_()
- {
+ public void navigation_() {
currentSink.navigation_();
}
/** {@inheritDoc} */
@Override
- public void nonBreakingSpace()
- {
+ public void nonBreakingSpace() {
currentSink.nonBreakingSpace();
}
/** {@inheritDoc} */
@Override
- public void numberedList( int numbering )
- {
- currentSink.numberedList( numbering );
+ public void numberedList(int numbering) {
+ currentSink.numberedList(numbering);
}
/** {@inheritDoc} */
@Override
- public void numberedList( int numbering, SinkEventAttributes attributes )
- {
- currentSink.numberedList( numbering, attributes );
+ public void numberedList(int numbering, SinkEventAttributes attributes) {
+ currentSink.numberedList(numbering, attributes);
}
/** {@inheritDoc} */
@Override
- public void numberedListItem()
- {
+ public void numberedListItem() {
currentSink.numberedListItem();
}
/** {@inheritDoc} */
@Override
- public void numberedListItem( SinkEventAttributes attributes )
- {
- currentSink.numberedListItem( attributes );
+ public void numberedListItem(SinkEventAttributes attributes) {
+ currentSink.numberedListItem(attributes);
}
/** {@inheritDoc} */
@Override
- public void numberedListItem_()
- {
+ public void numberedListItem_() {
currentSink.numberedListItem_();
}
/** {@inheritDoc} */
@Override
- public void numberedList_()
- {
+ public void numberedList_() {
currentSink.numberedList_();
}
/** {@inheritDoc} */
@Override
- public void pageBreak()
- {
+ public void pageBreak() {
currentSink.pageBreak();
}
/** {@inheritDoc} */
@Override
- public void paragraph()
- {
+ public void paragraph() {
currentSink.paragraph();
}
/** {@inheritDoc} */
@Override
- public void paragraph( SinkEventAttributes attributes )
- {
- currentSink.paragraph( attributes );
+ public void paragraph(SinkEventAttributes attributes) {
+ currentSink.paragraph(attributes);
}
/** {@inheritDoc} */
@Override
- public void paragraph_()
- {
+ public void paragraph_() {
currentSink.paragraph_();
}
/** {@inheritDoc} */
@Override
- public void rawText( String text )
- {
- currentSink.rawText( text );
+ public void rawText(String text) {
+ currentSink.rawText(text);
}
/** {@inheritDoc} */
@Override
- public void section( int level, SinkEventAttributes attributes )
- {
- currentSink.section( level, attributes );
+ public void section(int level, SinkEventAttributes attributes) {
+ currentSink.section(level, attributes);
}
/** {@inheritDoc} */
@Override
- public void section1()
- {
+ public void section1() {
currentSink.section1();
}
/** {@inheritDoc} */
@Override
- public void section1_()
- {
+ public void section1_() {
currentSink.section1_();
}
/** {@inheritDoc} */
@Override
- public void section2()
- {
+ public void section2() {
currentSink.section2();
}
/** {@inheritDoc} */
@Override
- public void section2_()
- {
+ public void section2_() {
currentSink.section2_();
}
/** {@inheritDoc} */
@Override
- public void section3()
- {
+ public void section3() {
currentSink.section3();
}
/** {@inheritDoc} */
@Override
- public void section3_()
- {
+ public void section3_() {
currentSink.section3_();
}
/** {@inheritDoc} */
@Override
- public void section4()
- {
+ public void section4() {
currentSink.section4();
}
/** {@inheritDoc} */
@Override
- public void section4_()
- {
+ public void section4_() {
currentSink.section4_();
}
/** {@inheritDoc} */
@Override
- public void section5()
- {
+ public void section5() {
currentSink.section5();
}
/** {@inheritDoc} */
@Override
- public void section5_()
- {
+ public void section5_() {
currentSink.section5_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle()
- {
+ public void sectionTitle() {
currentSink.sectionTitle();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle( int level, SinkEventAttributes attributes )
- {
- currentSink.sectionTitle( level, attributes );
+ public void sectionTitle(int level, SinkEventAttributes attributes) {
+ currentSink.sectionTitle(level, attributes);
}
/** {@inheritDoc} */
@Override
- public void sectionTitle1()
- {
+ public void sectionTitle1() {
currentSink.sectionTitle1();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle1_()
- {
+ public void sectionTitle1_() {
currentSink.sectionTitle1_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle2()
- {
+ public void sectionTitle2() {
currentSink.sectionTitle2();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle2_()
- {
+ public void sectionTitle2_() {
currentSink.sectionTitle2_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle3()
- {
+ public void sectionTitle3() {
currentSink.sectionTitle3();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle3_()
- {
+ public void sectionTitle3_() {
currentSink.sectionTitle3_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle4()
- {
+ public void sectionTitle4() {
currentSink.sectionTitle4();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle4_()
- {
+ public void sectionTitle4_() {
currentSink.sectionTitle4_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle5()
- {
+ public void sectionTitle5() {
currentSink.sectionTitle5();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle5_()
- {
+ public void sectionTitle5_() {
currentSink.sectionTitle5_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle_()
- {
+ public void sectionTitle_() {
currentSink.sectionTitle_();
}
/** {@inheritDoc} */
@Override
- public void sectionTitle_( int level )
- {
- currentSink.sectionTitle_( level );
+ public void sectionTitle_(int level) {
+ currentSink.sectionTitle_(level);
}
/** {@inheritDoc} */
@Override
- public void section_( int level )
- {
- currentSink.section_( level );
+ public void section_(int level) {
+ currentSink.section_(level);
}
/** {@inheritDoc} */
@Override
- public void sidebar()
- {
+ public void sidebar() {
currentSink.sidebar();
}
/** {@inheritDoc} */
@Override
- public void sidebar( SinkEventAttributes attributes )
- {
- currentSink.sidebar( attributes );
+ public void sidebar(SinkEventAttributes attributes) {
+ currentSink.sidebar(attributes);
}
/** {@inheritDoc} */
@Override
- public void sidebar_()
- {
+ public void sidebar_() {
currentSink.sidebar_();
}
/** {@inheritDoc} */
@Override
- public void table()
- {
+ public void table() {
currentSink.table();
}
/** {@inheritDoc} */
@Override
- public void table( SinkEventAttributes attributes )
- {
- currentSink.table( attributes );
+ public void table(SinkEventAttributes attributes) {
+ currentSink.table(attributes);
}
/** {@inheritDoc} */
@Override
- public void tableCaption()
- {
+ public void tableCaption() {
currentSink.tableCaption();
}
/** {@inheritDoc} */
@Override
- public void tableCaption( SinkEventAttributes attributes )
- {
- currentSink.tableCaption( attributes );
+ public void tableCaption(SinkEventAttributes attributes) {
+ currentSink.tableCaption(attributes);
}
/** {@inheritDoc} */
@Override
- public void tableCaption_()
- {
+ public void tableCaption_() {
currentSink.tableCaption_();
}
/** {@inheritDoc} */
@Override
- public void tableCell()
- {
+ public void tableCell() {
currentSink.tableCell();
}
/** {@inheritDoc} */
@Override
- public void tableCell( SinkEventAttributes attributes )
- {
- currentSink.tableCell( attributes );
+ public void tableCell(SinkEventAttributes attributes) {
+ currentSink.tableCell(attributes);
}
/** {@inheritDoc} */
@Override
- public void tableCell_()
- {
+ public void tableCell_() {
currentSink.tableCell_();
}
/** {@inheritDoc} */
@Override
- public void tableHeaderCell()
- {
+ public void tableHeaderCell() {
currentSink.tableHeaderCell();
}
/** {@inheritDoc} */
@Override
- public void tableHeaderCell( SinkEventAttributes attributes )
- {
- currentSink.tableHeaderCell( attributes );
+ public void tableHeaderCell(SinkEventAttributes attributes) {
+ currentSink.tableHeaderCell(attributes);
}
/** {@inheritDoc} */
@Override
- public void tableHeaderCell_()
- {
+ public void tableHeaderCell_() {
currentSink.tableHeaderCell_();
}
/** {@inheritDoc} */
@Override
- public void tableRow()
- {
+ public void tableRow() {
currentSink.tableRow();
}
/** {@inheritDoc} */
@Override
- public void tableRow( SinkEventAttributes attributes )
- {
- currentSink.tableRow( attributes );
+ public void tableRow(SinkEventAttributes attributes) {
+ currentSink.tableRow(attributes);
}
/** {@inheritDoc} */
@Override
- public void tableRow_()
- {
+ public void tableRow_() {
currentSink.tableRow_();
}
/** {@inheritDoc} */
@Override
- public void tableRows()
- {
+ public void tableRows() {
currentSink.tableRows();
}
/** {@inheritDoc} */
@Override
- public void tableRows( int[] justification, boolean grid )
- {
- currentSink.tableRows( justification, grid );
+ public void tableRows(int[] justification, boolean grid) {
+ currentSink.tableRows(justification, grid);
}
/** {@inheritDoc} */
@Override
- public void tableRows_()
- {
+ public void tableRows_() {
currentSink.tableRows_();
}
/** {@inheritDoc} */
@Override
- public void table_()
- {
+ public void table_() {
currentSink.table_();
}
/** {@inheritDoc} */
@Override
- public void text( String text )
- {
- currentSink.text( text );
+ public void text(String text) {
+ currentSink.text(text);
}
/** {@inheritDoc} */
@Override
- public void text( String text, SinkEventAttributes attributes )
- {
- currentSink.text( text, attributes );
+ public void text(String text, SinkEventAttributes attributes) {
+ currentSink.text(text, attributes);
}
/** {@inheritDoc} */
@Override
- public void time( String datetime )
- {
- currentSink.time( datetime );
+ public void time(String datetime) {
+ currentSink.time(datetime);
}
/** {@inheritDoc} */
@Override
- public void time( String datetime, SinkEventAttributes attributes )
- {
- currentSink.time( datetime, attributes );
+ public void time(String datetime, SinkEventAttributes attributes) {
+ currentSink.time(datetime, attributes);
}
/** {@inheritDoc} */
@Override
- public void time_()
- {
+ public void time_() {
currentSink.time_();
}
/** {@inheritDoc} */
@Override
- public void title()
- {
+ public void title() {
currentSink.title();
}
/** {@inheritDoc} */
@Override
- public void title( SinkEventAttributes attributes )
- {
- currentSink.title( attributes );
+ public void title(SinkEventAttributes attributes) {
+ currentSink.title(attributes);
}
/** {@inheritDoc} */
@Override
- public void title_()
- {
+ public void title_() {
currentSink.title_();
}
/** {@inheritDoc} */
@Override
- public void unknown( String name, Object[] requiredParams, SinkEventAttributes attributes )
- {
- currentSink.unknown( name, requiredParams, attributes );
+ public void unknown(String name, Object[] requiredParams, SinkEventAttributes attributes) {
+ currentSink.unknown(name, requiredParams, attributes);
}
/** {@inheritDoc} */
@Override
- public void verbatim( SinkEventAttributes attributes )
- {
- currentSink.verbatim( attributes );
+ public void verbatim(SinkEventAttributes attributes) {
+ currentSink.verbatim(attributes);
}
/** {@inheritDoc} */
@Override
- public void verbatim_()
- {
+ public void verbatim_() {
currentSink.verbatim_();
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkAdapter.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkAdapter.java
index f0cc09ae..00741828 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkAdapter.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkAdapter.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.doxia.sink.impl;
/*
@@ -28,1194 +46,997 @@ import org.apache.maven.doxia.sink.SinkEventAttributes;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
*/
-public class SinkAdapter
- extends AbstractSink
-{
+public class SinkAdapter extends AbstractSink {
/** {@inheritDoc} */
@Override
- public void head()
- {
+ public void head() {
// nop
}
/** {@inheritDoc} */
@Override
- public void head_()
- {
+ public void head_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void body()
- {
+ public void body() {
// nop
}
/** {@inheritDoc} */
@Override
- public void body_()
- {
+ public void body_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void article()
- {
+ public void article() {
// nop
}
/** {@inheritDoc} */
@Override
- public void article_()
- {
+ public void article_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void navigation()
- {
+ public void navigation() {
// nop
}
/** {@inheritDoc} */
@Override
- public void navigation_()
- {
+ public void navigation_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sidebar()
- {
+ public void sidebar() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sidebar_()
- {
+ public void sidebar_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section1()
- {
+ public void section1() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section1_()
- {
+ public void section1_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section2()
- {
+ public void section2() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section2_()
- {
+ public void section2_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section3()
- {
+ public void section3() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section3_()
- {
+ public void section3_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section4()
- {
+ public void section4() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section4_()
- {
+ public void section4_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section5()
- {
+ public void section5() {
// nop
}
/** {@inheritDoc} */
@Override
- public void section5_()
- {
+ public void section5_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void list()
- {
+ public void list() {
// nop
}
/** {@inheritDoc} */
@Override
- public void list_()
- {
+ public void list_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void listItem()
- {
+ public void listItem() {
// nop
}
/** {@inheritDoc} */
@Override
- public void listItem_()
- {
+ public void listItem_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void numberedList( int numbering )
- {
+ public void numberedList(int numbering) {
// nop
}
/** {@inheritDoc} */
@Override
- public void numberedList_()
- {
+ public void numberedList_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void numberedListItem()
- {
+ public void numberedListItem() {
// nop
}
/** {@inheritDoc} */
@Override
- public void numberedListItem_()
- {
+ public void numberedListItem_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definitionList()
- {
+ public void definitionList() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definitionList_()
- {
+ public void definitionList_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definitionListItem()
- {
+ public void definitionListItem() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definitionListItem_()
- {
+ public void definitionListItem_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definition()
- {
+ public void definition() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definition_()
- {
+ public void definition_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void figure()
- {
+ public void figure() {
// nop
}
/** {@inheritDoc} */
@Override
- public void figure_()
- {
+ public void figure_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void table()
- {
+ public void table() {
// nop
}
/** {@inheritDoc} */
@Override
- public void table_()
- {
+ public void table_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableRows()
- {
+ public void tableRows() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableRows_()
- {
+ public void tableRows_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableRow()
- {
+ public void tableRow() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableRow_()
- {
+ public void tableRow_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void title()
- {
+ public void title() {
// nop
}
/** {@inheritDoc} */
@Override
- public void title_()
- {
+ public void title_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void author()
- {
+ public void author() {
// nop
}
/** {@inheritDoc} */
@Override
- public void author_()
- {
+ public void author_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void date()
- {
+ public void date() {
// nop
}
/** {@inheritDoc} */
@Override
- public void date_()
- {
+ public void date_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle()
- {
+ public void sectionTitle() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle_()
- {
+ public void sectionTitle_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle1()
- {
+ public void sectionTitle1() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle1_()
- {
+ public void sectionTitle1_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle2()
- {
+ public void sectionTitle2() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle2_()
- {
+ public void sectionTitle2_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle3()
- {
+ public void sectionTitle3() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle3_()
- {
+ public void sectionTitle3_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle4()
- {
+ public void sectionTitle4() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle4_()
- {
+ public void sectionTitle4_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle5()
- {
+ public void sectionTitle5() {
// nop
}
/** {@inheritDoc} */
@Override
- public void sectionTitle5_()
- {
+ public void sectionTitle5_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void header()
- {
+ public void header() {
// nop
}
/** {@inheritDoc} */
@Override
- public void header_()
- {
+ public void header_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void content()
- {
+ public void content() {
// nop
}
/** {@inheritDoc} */
@Override
- public void content_()
- {
+ public void content_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void footer()
- {
+ public void footer() {
// nop
}
/** {@inheritDoc} */
@Override
- public void footer_()
- {
+ public void footer_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void paragraph()
- {
+ public void paragraph() {
// nop
}
/** {@inheritDoc} */
@Override
- public void paragraph_()
- {
+ public void paragraph_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void data( String value )
- {
+ public void data(String value) {
// nop
}
/** {@inheritDoc} */
@Override
- public void data_()
- {
+ public void data_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void time( String datetime )
- {
+ public void time(String datetime) {
// nop
}
/** {@inheritDoc} */
@Override
- public void time_()
- {
+ public void time_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void address()
- {
+ public void address() {
// nop
}
/** {@inheritDoc} */
@Override
- public void address_()
- {
+ public void address_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void blockquote()
- {
+ public void blockquote() {
// nop
}
/** {@inheritDoc} */
@Override
- public void blockquote_()
- {
+ public void blockquote_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void division()
- {
+ public void division() {
// nop
}
/** {@inheritDoc} */
@Override
- public void division_()
- {
+ public void division_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void verbatim_()
- {
+ public void verbatim_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definedTerm()
- {
+ public void definedTerm() {
// nop
}
/** {@inheritDoc} */
@Override
- public void definedTerm_()
- {
+ public void definedTerm_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void figureCaption()
- {
+ public void figureCaption() {
// nop
}
/** {@inheritDoc} */
@Override
- public void figureCaption_()
- {
+ public void figureCaption_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableCell()
- {
+ public void tableCell() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableCell_()
- {
+ public void tableCell_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableHeaderCell()
- {
+ public void tableHeaderCell() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableHeaderCell_()
- {
+ public void tableHeaderCell_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableCaption()
- {
+ public void tableCaption() {
// nop
}
/** {@inheritDoc} */
@Override
- public void tableCaption_()
- {
+ public void tableCaption_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void figureGraphics( String name )
- {
+ public void figureGraphics(String name) {
// nop
}
/** {@inheritDoc} */
@Override
- public void horizontalRule()
- {
+ public void horizontalRule() {
// nop
}
/** {@inheritDoc} */
@Override
- public void pageBreak()
- {
+ public void pageBreak() {
// nop
}
/** {@inheritDoc} */
@Override
- public void anchor( String name )
- {
+ public void anchor(String name) {
// nop
}
/** {@inheritDoc} */
@Override
- public void anchor_()
- {
+ public void anchor_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void link( String name )
- {
+ public void link(String name) {
// nop
}
/** {@inheritDoc} */
@Override
- public void link_()
- {
+ public void link_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void inline()
- {
+ public void inline() {
// nop
}
/** {@inheritDoc} */
@Override
- public void inline_()
- {
+ public void inline_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void italic()
- {
+ public void italic() {
// nop
}
/** {@inheritDoc} */
@Override
- public void italic_()
- {
+ public void italic_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void bold()
- {
+ public void bold() {
// nop
}
/** {@inheritDoc} */
@Override
- public void bold_()
- {
+ public void bold_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void monospaced()
- {
+ public void monospaced() {
// nop
}
/** {@inheritDoc} */
@Override
- public void monospaced_()
- {
+ public void monospaced_() {
// nop
}
/** {@inheritDoc} */
@Override
- public void lineBreak()
- {
+ public void lineBreak() {
// nop
}
/** {@inheritDoc} */
@Override
- public void lineBreakOpportunity()
- {
+ public void lineBreakOpportunity() {
// nop
}
/** {@inheritDoc} */
@Override
- public void nonBreakingSpace()
- {
+ public void nonBreakingSpace() {
// nop
}
/** {@inheritDoc} */
@Override
- public void text( String text )
- {
+ public void text(String text) {
// nop
}
/** {@inheritDoc} */
@Override
- public void rawText( String text )
- {
+ public void rawText(String text) {
// nop
}
/** {@inheritDoc} */
@Override
- public void comment( String comment )
- {
... 38958 lines suppressed ...