You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2022/04/18 13:04:48 UTC
[maven-doxia-converter] 02/02: drop not supported source/sinks
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch drop-sinks
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git
commit a1946b320a550fd315904dbc8fee3179b0e1bff4
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Apr 18 15:04:06 2022 +0200
drop not supported source/sinks
---
.../org/apache/maven/doxia/DefaultConverter.java | 50 +------
.../java/org/apache/maven/doxia/ConverterTest.java | 126 -----------------
src/test/resources/unit/confluence/test.confluence | 98 -------------
src/test/resources/unit/docbook/test.xml | 153 ---------------------
src/test/resources/unit/twiki/test.twiki | 109 ---------------
5 files changed, 3 insertions(+), 533 deletions(-)
diff --git a/src/main/java/org/apache/maven/doxia/DefaultConverter.java b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
index 0991900..e6330a4 100644
--- a/src/main/java/org/apache/maven/doxia/DefaultConverter.java
+++ b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
@@ -76,14 +76,8 @@ public class DefaultConverter
{
private static final String APT_PARSER = "apt";
- private static final String CONFLUENCE_PARSER = "confluence";
-
- private static final String DOCBOOK_PARSER = "docbook";
-
private static final String FML_PARSER = "fml";
- private static final String TWIKI_PARSER = "twiki";
-
private static final String XDOC_PARSER = "xdoc";
private static final String XHTML_PARSER = "xhtml";
@@ -92,25 +86,10 @@ public class DefaultConverter
/** Supported input format, i.e. supported Doxia parser */
public static final List<String> SUPPORTED_FROM_FORMAT =
- Arrays.asList(APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, TWIKI_PARSER, XDOC_PARSER, XHTML_PARSER,
- XHTML5_PARSER);
+ Arrays.asList(APT_PARSER, FML_PARSER, XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER);
private static final String APT_SINK = "apt";
- private static final String CONFLUENCE_SINK = "confluence";
-
- private static final String DOCBOOK_SINK = "docbook";
-
- private static final String FO_SINK = "fo";
-
- private static final String ITEXT_SINK = "itext";
-
- private static final String LATEX_SINK = "latex";
-
- private static final String RTF_SINK = "rtf";
-
- private static final String TWIKI_SINK = "twiki";
-
private static final String XDOC_SINK = "xdoc";
private static final String XHTML_SINK = "xhtml";
@@ -119,8 +98,7 @@ public class DefaultConverter
/** Supported output format, i.e. supported Doxia Sink */
public static final List<String> SUPPORTED_TO_FORMAT =
- Arrays.asList( APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, RTF_SINK, TWIKI_SINK, XDOC_SINK,
- XHTML_SINK, XHTML5_SINK) ;
+ Arrays.asList( APT_SINK, XDOC_SINK, XHTML_SINK, XHTML5_SINK) ;
/** Flag to format the generated files, actually only for XML based sinks. */
private boolean formatOutput;
@@ -435,17 +413,9 @@ public class DefaultConverter
parse( parser, reader, sink );
- if ( formatOutput && ( DOCBOOK_SINK.equals( output.getFormat() ) || FO_SINK.equals( output.getFormat() )
- || ITEXT_SINK.equals( output.getFormat() ) || XDOC_SINK.equals( output.getFormat() )
+ if ( formatOutput && ( XDOC_SINK.equals( output.getFormat() )
|| XHTML_SINK.equals( output.getFormat() ) || XHTML5_SINK.equals( output.getFormat() ) ) )
{
- // format all xml files excluding docbook which is buggy
- // TODO Add doc book format
- if ( DOCBOOK_SINK.equals( output.getFormat() ) || DOCBOOK_PARSER.equals( inputFormat ) )
- {
- return;
- }
-
try ( Reader r = ReaderFactory.newXmlReader( outputFile );
Writer w = WriterFactory.newXmlWriter( outputFile ) )
{
@@ -591,16 +561,6 @@ public class DefaultConverter
{
return supportedFromFormat;
}
- else if ( CONFLUENCE_PARSER.equalsIgnoreCase( supportedFromFormat ) && isDoxiaFileName( f,
- supportedFromFormat ) )
- {
- return supportedFromFormat;
- }
- else if ( TWIKI_PARSER.equalsIgnoreCase( supportedFromFormat ) && isDoxiaFileName( f,
- supportedFromFormat ) )
- {
- return supportedFromFormat;
- }
// Handle Doxia xml files
String firstTag = getFirstTag( f );
@@ -609,10 +569,6 @@ public class DefaultConverter
//noinspection UnnecessaryContinue
continue;
}
- else if ( "article".equals( firstTag ) && DOCBOOK_PARSER.equalsIgnoreCase( supportedFromFormat ) )
- {
- return supportedFromFormat;
- }
else if ( "faqs".equals( firstTag ) && FML_PARSER.equalsIgnoreCase( supportedFromFormat ) )
{
return supportedFromFormat;
diff --git a/src/test/java/org/apache/maven/doxia/ConverterTest.java b/src/test/java/org/apache/maven/doxia/ConverterTest.java
index fc380f0..d1cc8ce 100644
--- a/src/test/java/org/apache/maven/doxia/ConverterTest.java
+++ b/src/test/java/org/apache/maven/doxia/ConverterTest.java
@@ -179,42 +179,6 @@ public class ConverterTest
assertTrue( new File( out ).length() != 0 );
}
- /**
- * Input confluence file / output file
- *
- * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
- * @throws Exception if any
- */
- public void testConfluenceFileConverter()
- throws Exception
- {
- String in = getBasedir() + "/src/test/resources/unit/confluence/test.confluence";
- String from = "confluence";
- String out = getBasedir() + "/target/unit/file/confluence/test.confluence.xhtml";
- String to = "xhtml";
-
- InputFileWrapper input =
- InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
- OutputFileWrapper output =
- OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
- converter.setFormatOutput( formatOutput );
- converter.convert( input, output );
- assertTrue( new File( out ).exists() );
- assertTrue( new File( out ).length() != 0 );
-
- in = getBasedir() + "/target/unit/file/confluence/test.confluence.xhtml";
- from = "xhtml";
- out = getBasedir() + "/target/unit/file/confluence/test.confluence";
- to = "confluence";
-
- input = InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
- output = OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
- converter.setFormatOutput( formatOutput );
- converter.convert( input, output );
- }
-
/**
* Input docbook file / output file
*
@@ -297,53 +261,6 @@ public class ConverterTest
}
}
- /**
- * Input twiki file / output file
- *
- * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
- * @throws Exception if any
- */
- public void testTwikiFileConverter()
- throws Exception
- {
- String in = getBasedir() + "/src/test/resources/unit/twiki/test.twiki";
- String from = "twiki";
- String out = getBasedir() + "/target/unit/file/twiki/test.twiki.xhtml";
- String to = "xhtml";
-
- InputFileWrapper input =
- InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
- OutputFileWrapper output =
- OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
- converter.setFormatOutput( formatOutput );
- converter.convert( input, output );
- assertTrue( new File( out ).exists() );
- assertTrue( new File( out ).length() != 0 );
-
- in = getBasedir() + "/target/unit/file/twiki/test.twiki.xhtml";
- from = "xhtml";
- out = getBasedir() + "/target/unit/file/twiki/test.twiki";
- to = "twiki";
-
- input = InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
- output = OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
- converter.setFormatOutput( formatOutput );
- try
- {
- converter.convert( input, output );
- }
- catch ( ConverterException e )
- {
- // The TWiki parser is wrong for * <pre>some text</pre>
- if ( !e.getMessage().contains( "Error validating the model" ) )
- {
- throw e;
- }
- }
- }
-
/**
* Input xdoc file / output dir
*
@@ -494,43 +411,6 @@ public class ConverterTest
assertTrue( outFile.length() != 0 );
}
- /**
- * Input confluence reader / output writer
- *
- * @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
- * @throws Exception if any
- */
- public void testConfluenceWriterConverter()
- throws Exception
- {
- String in = getBasedir() + "/src/test/resources/unit/confluence/test.confluence";
- String from = "confluence";
- String out = getBasedir() + "/target/unit/writer/confluence/test.confluence.xhtml";
- String to = "xhtml";
-
- File inFile = new File( in );
- File outFile = new File( out );
- outFile.getParentFile().mkdirs();
-
- try ( OutputStream fo = new FileOutputStream( outFile ) )
- {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
- InputReaderWrapper input = InputReaderWrapper.valueOf( new FileReader( inFile ), from,
- converter.getInputFormats() );
- OutputStreamWrapper output = OutputStreamWrapper.valueOf( outputStream, to, "UTF-8",
- converter.getOutputFormats() );
-
- converter.setFormatOutput( formatOutput );
- converter.convert( input, output );
-
- IOUtil.copy( outputStream.toByteArray(), fo );
- }
-
- assertTrue( outFile.exists() );
- assertTrue( outFile.length() != 0 );
- }
-
/**
* Input xdoc (autodetect) reader / output writer
*
@@ -662,10 +542,7 @@ public class ConverterTest
public void testAutodetectEncoding()
{
assertEquals( "ISO-8859-1", autoDetectEncoding( "apt/test.apt" ) );
- assertEquals( "ISO-8859-1", autoDetectEncoding( "confluence/test.confluence" ) );
- assertEquals( "UTF-8", autoDetectEncoding( "docbook/test.xml" ) );
assertEquals( "UTF-8", autoDetectEncoding( "fml/test.fml" ) ); // plexus-utils should detect ISO-8859-1
- assertEquals( "ISO-8859-1", autoDetectEncoding( "twiki/test.twiki" ) );
assertEquals( "UTF-8", autoDetectEncoding( "xhtml/test.xhtml" ) );
}
@@ -697,10 +574,7 @@ public class ConverterTest
assertTrue( true );
}
- assertEquals( autoDetectFormat( "confluence/test.confluence", "UTF-8" ), "confluence" );
- assertEquals( autoDetectFormat( "docbook/test.xml", "UTF-8" ), "docbook" );
assertEquals( autoDetectFormat( "fml/test.fml", "UTF-8" ), "fml" );
- assertEquals( autoDetectFormat( "twiki/test.twiki", "UTF-8" ), "twiki" );
assertEquals( autoDetectFormat( "xhtml/test.xhtml", "UTF-8" ), "xhtml" );
}
}
diff --git a/src/test/resources/unit/confluence/test.confluence b/src/test/resources/unit/confluence/test.confluence
deleted file mode 100644
index 71d3d10..0000000
--- a/src/test/resources/unit/confluence/test.confluence
+++ /dev/null
@@ -1,98 +0,0 @@
-This the way that we would like to *translate* sites that are primarily
-authored in confluence while at the same time having the site be rendered in
-a _standard way on a static website_.
-
-----
-
-Here is a link to [JIRA|http://jira.codehaus.org]
-
-Here is a link with no text [http://jira.codehaus.org]
-
-This is some {{monospaced}} text.
-
-* item one
-** foo
-** bar
-* item two
-* item three
-
-Some more text
-
-# number one
-# number two
-# number three
-
-||one||two||three||
-|foo|bar|baz|
-
-h1. I am h1
-
-this is how you would code a mojo!
-
-{code}
-public class MyMojo
- extends AbstractMojo
-{
- /**
- * @parameter expression="${plugin.artifacts}"
- * @required
- */
- private List pluginArtifacts;
-
- public void execute()
- throws MojoExecutionException
- {
- ...
- for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
- {
- Artifact pluginArtifact = (Artifact) i.next();
- }
- ...
- }
-}
-{code}
-
-h2. I am h2
-
-this is the way of the world
-
-{noformat}
-public class MyMojo
- extends AbstractMojo
-{
- /**
- * @parameter expression="${plugin.artifacts}"
- * @required
- */
- private List pluginArtifacts;
-
- public void execute()
- throws MojoExecutionException
- {
- ...
- for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
- {
- Artifact pluginArtifact = (Artifact) i.next();
- }
- ...
- }
-}
-{noformat}
-
-h3. I am h3
-
-this is the way of the world
-
-h4. I am h4
-
-this is the way of the world
-
-h5. I am h5
-
-this is the way of the world
-
-h1. Answered Questions
-
-h3. What can I do to get the Maven love?
-
-Well, you just have to be calm and the maven love will come your way.
diff --git a/src/test/resources/unit/docbook/test.xml b/src/test/resources/unit/docbook/test.xml
deleted file mode 100644
index cd73649..0000000
--- a/src/test/resources/unit/docbook/test.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.1//EN"
- "http://www.oasis-open.org/docbook/xml/simple/1.1/sdocbook.dtd">
-
-<article id="index">
- <articleinfo>
- <title>Geotools2 Developer Guide</title>
-
- <author>
- <firstname>Cameron</firstname>
-
- <surname>Shorter</surname>
- </author>
-
- <date>22 May 2002</date>
-
- <abstract>
- <para>Guide to aid <filename>geotools2</filename> development.</para>
- </abstract>
- </articleinfo>
-
- <section id="intro">
- <title>Introduction</title>
-
- <para>This document aims to help new geotools developers get up to speed
- and track practices of existing developers in order to keep the project
- consistent.</para>
-
- <para>If you feel something is missing, feel free to contribute a new
- section.</para>
- </section>
-
- <section id="design">
- <title>Design</title>
- <figure>
- <title>Geotools Logo</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/developersguide/geotools_logo.png"
- format="PNG"/>
- </imageobject>
- <textobject><phrase>Geotools Logo</phrase></textobject>
- </mediaobject>
- </figure>
-
- <para>To do: Explain</para><itemizedlist><listitem><para>Key design structure
- (core interfaces, data sources, rendering, tools)</para></listitem><listitem><para>Design
- Drivers (Our design goals: modular, derives structure from netbeans,
- support multiple version of java, ..)</para></listitem><listitem><para>Directory
- structure</para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section id="development">
- <title>Development</title>
-
- <section id="building">
- <title>Building</title>
-
- <para>To do:</para><itemizedlist><listitem><para>using ant</para></listitem><listitem><para>what
- ant checks</para></listitem><listitem><para>insert the
- "howto-build.html" doc into here</para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section id="cvs">
- <title>Code Versioning (using CVS)</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Point to sourceforge CVS howto
- links.</para></listitem><listitem><para>Also point to some HOWTOs for
- windows users.</para></listitem><listitem><para>What is acceptable to
- commit to CVS, what is not. (Ie, code should compile)</para></listitem><listitem><para>Talk
- about version numbering convention, use of branches, etc (if we decide
- to do this).</para></listitem></itemizedlist>
-
- <para>To do:</para>
- </section>
-
- <section id="CodingStandards">
- <title>Coding Standards</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Using Sun's coding
- standard, need to note any exceptions to it.</para></listitem><listitem><para>Note
- the auto checking of coding standards.</para></listitem><listitem><para>Javadocs</para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section id="templates">
- <title>Template File</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Provide a template file.</para></listitem><listitem><para>Link
- it to sections explaining the different parts of the template.</para></listitem><listitem><para>Include
- headers, footers, example logging, example coding style, CVS key tags,
- sample javadocs.</para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section id="logging">
- <title>Logging</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Talk about log4j, links to</para></listitem><listitem><para></para></listitem><listitem><para></para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section id="testing">
- <title>Testing</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Explain use of junit. Might be
- a link to another web site.</para></listitem><listitem><para></para></listitem><listitem><para></para></listitem><listitem><para></para></listitem></itemizedlist>
- </section>
-
- <section>
- <title>Documentation</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Talk about docbook, why we
- decided to use it (most commonly used format of LDP, converts to
- multiple formats, tools coming which can support it. Need to mention
- which version of docbook we are using.</para></listitem><listitem><para>Mention
- tools that can be used.</para></listitem><listitem><para>Links to
- docbook references.</para></listitem><listitem><para>Process for
- updating this document.</para></listitem><listitem><para>How to use ant
- tools to build doc.</para></listitem></itemizedlist>
- </section>
- </section>
-
- <section id="tools">
- <title>Development Tools</title>
-
- <section id="netbeans">
- <title>Netbeans</title>
-
- <para>To do:</para><itemizedlist><listitem><para>Where to get it.</para></listitem><listitem><para>Aim
- is to make geotools a module within Netbeans</para></listitem><listitem><para>How
- to setup getools to fit the multiple directory structure</para></listitem><listitem><para>The
- extra Netbeans modules that are useful and should be downloaded.</para></listitem></itemizedlist>
- </section>
- </section>
-</article>
-
diff --git a/src/test/resources/unit/twiki/test.twiki b/src/test/resources/unit/twiki/test.twiki
deleted file mode 100644
index d64d7ed..0000000
--- a/src/test/resources/unit/twiki/test.twiki
+++ /dev/null
@@ -1,109 +0,0 @@
----+ Twiki Java Parser
-
----++ Features
-
-This parser of the [[http://www.twiki.org][TWiki]] text format supports most
-of http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules formatting commands.
-
----+++ General
-
- * Paragraps,
- * Wiki Words
- * WikiWord
- * Web.WikiWord#anchor,
- * escaped: !WikiWord
- * Forced Links:
- * [[wiki word]]
- * escaped ![[wiki word]]
- * Specific links:
- * [[http://www.zauber.com.ar][Zauber]],
- * prevention: ![[http://www.zauber.com.ar][Forced links]]
- * Anchors: [[#AnchorEnd][End]]
- * inline urls:
- * http://twiki.org/
- * mailto link:
- * [[mailto:a@z.com Mail]]
- * [[mailto:?subject=Hi Hi]]
-
----+++ Text Format:
-
- * *bold*
- * _italic_
- * __bold italic__
- * =Fixedfont=
- * ==Bold fixed==
-
-And nested formats like:
- * *bold with _italic_ and some =fixed= and bold*
-Make sure there is no space between the text and the bold, italic, or other
-indicators (* _ __ = ==).
-
----+++ Lists
-
- * items
- * nested items
- * ordered list
- * arabic numerals
- 1. item
- 1. item
- 1. ...
- * uppercase letters
- A. item
- A. item
- A. ...
- * lowercase letters
- a. item
- a. item
- a. ...
- * uppercase roman numerals
- A. item
- A. item
- A. ....
- * Uppercase Roman Numerals
- I. item
- I. item
- I. ...
- * Lowercase Roman Numerals
- i. item
- i. item
- i. ....
-
----+++ Separators
-
-Up
----------------------------
-Down
-
----+++ Table
-
- | *A* | *B* | *C* |
- | Foo | bar | Foo |
- | Bar | Foo | bar |
- | Foo | bar | Foo |
-
----++ Missing things
----+++ Verbating Mode
-<verbatim>
-class CatAnimal {
- void purr() {
- <code here>
-}
-</verbatim>
-
----+++ Definition List
-(i don't use it)
- $ Sushi: Japan
- $ Dim Sum: S.F.
- $ Asado: Argentina
-
----+++ Diable Links
-
-<noautolink>
- RedHat &
- SuSE
-</noautolink>
-
----+++ Html
- * <pre>some text</pre>
-
-#EndAnchor