You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/01/14 12:42:45 UTC
[maven-doxia-sitetools] branch master updated: [DOXIASITETOOLS-239] Remove Doxia Sitetools Doc Renderer
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-sitetools.git
The following commit(s) were added to refs/heads/master by this push:
new 5cf7917 [DOXIASITETOOLS-239] Remove Doxia Sitetools Doc Renderer
5cf7917 is described below
commit 5cf7917257a72acc8d370b38ea905a7d9080de17
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Jan 9 00:01:35 2022 +0100
[DOXIASITETOOLS-239] Remove Doxia Sitetools Doc Renderer
This closes #21
---
doxia-doc-renderer/pom.xml | 160 -----
.../docrenderer/AbstractDocumentRenderer.java | 728 ---------------------
.../maven/doxia/docrenderer/DocRenderer.java | 66 --
.../maven/doxia/docrenderer/DocumentRenderer.java | 109 ---
.../doxia/docrenderer/DocumentRendererContext.java | 141 ----
.../docrenderer/DocumentRendererException.java | 55 --
.../docrenderer/itext/AbstractITextRender.java | 516 ---------------
.../docrenderer/itext/DefaultPdfRenderer.java | 65 --
.../docrenderer/itext/DefaultRtfRenderer.java | 65 --
.../maven/doxia/docrenderer/itext/PdfRenderer.java | 35 -
.../maven/doxia/docrenderer/itext/RtfRenderer.java | 35 -
.../doxia/docrenderer/pdf/AbstractPdfRenderer.java | 54 --
.../maven/doxia/docrenderer/pdf/PdfRenderer.java | 49 --
.../doxia/docrenderer/pdf/fo/FoPdfRenderer.java | 367 -----------
.../docrenderer/pdf/itext/ITextPdfRenderer.java | 690 -------------------
.../maven/doxia/docrenderer/itext/package.html | 27 -
.../maven/doxia/docrenderer/pdf/itext/TOC.xslt | 243 -------
doxia-doc-renderer/src/site/apt/index.apt | 27 -
doxia-doc-renderer/src/site/site.xml | 41 --
.../doxia/docrenderer/DocumentRendererTest.java | 145 ----
.../src/test/resources/site/apt/index.apt | 66 --
.../src/test/resources/site/apt/overview.apt | 104 ---
.../src/test/resources/site/apt/resources.apt | 49 --
.../src/test/resources/site/fml/faq.fml | 67 --
doxia-doc-renderer/src/test/resources/site/pdf.xml | 57 --
.../src/test/resources/site/resources/css/site.css | 57 --
.../site/resources/images/architecture.odg | Bin 12767 -> 0 bytes
.../site/resources/images/architecture.png | Bin 19581 -> 0 bytes
.../site/resources/images/asf_logo_wide.png | Bin 7090 -> 0 bytes
.../resources/site/resources/images/doxia-logo.png | Bin 16375 -> 0 bytes
.../src/test/resources/site/site.xml | 84 ---
.../resources/site/xdoc/references/fml-format.xml | 101 ---
.../resources/site/xdoc/references/xdoc-format.xml | 279 --------
pom.xml | 5 -
src/site/resources/images/doxia-sitetools-deps.png | Bin 55078 -> 31137 bytes
src/site/xdoc/doxia-sitetools-deps.odg | Bin 14097 -> 13178 bytes
src/site/xdoc/index.xml | 16 +-
37 files changed, 5 insertions(+), 4498 deletions(-)
diff --git a/doxia-doc-renderer/pom.xml b/doxia-doc-renderer/pom.xml
deleted file mode 100644
index ac34bed..0000000
--- a/doxia-doc-renderer/pom.xml
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>doxia-sitetools</artifactId>
- <groupId>org.apache.maven.doxia</groupId>
- <version>2.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>doxia-doc-renderer</artifactId>
-
- <name>Doxia Sitetools :: Document Renderer</name>
- <description>The Document Renderer handles the rendering of documents, in formats like PDF and RTF.</description>
-
- <dependencies>
- <!-- doxia -->
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-logging-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-sink-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-itext</artifactId>
- <version>${doxiaVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-fo</artifactId>
- <version>${doxiaVersion}</version>
- <!-- TODO remove with upgrade to 1.9.2 -->
- <exclusions>
- <!-- exclude JAI - missing on Maven Central -->
- <exclusion>
- <groupId>javax.media</groupId>
- <artifactId>jai-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.media</groupId>
- <artifactId>jai-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- The modules are not in doxia core anymore so you have to state a dependency so that
- the component descriptor gets picked up. -->
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-apt</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-fml</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xdoc</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xhtml</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-markdown</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <!-- plexus -->
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-velocity</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- misc -->
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </dependency>
-
- <!-- misc -->
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.2</version>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>2.0.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- To be sure that JVM will implement AWT in software -->
- <systemProperties>
- <property>
- <name>java.awt.headless</name>
- <value>true</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
deleted file mode 100644
index 108cd21..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
+++ /dev/null
@@ -1,728 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.maven.doxia.Doxia;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.apache.maven.doxia.document.io.xpp3.DocumentXpp3Reader;
-import org.apache.maven.doxia.sink.Sink;
-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.logging.PlexusLoggerWrapper;
-import org.apache.maven.doxia.parser.module.ParserModule;
-import org.apache.maven.doxia.parser.module.ParserModuleManager;
-import org.apache.maven.doxia.util.XmlValidator;
-
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.context.Context;
-
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.xml.XmlStreamReader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.codehaus.plexus.velocity.SiteResourceLoader;
-import org.codehaus.plexus.velocity.VelocityComponent;
-
-/**
- * Abstract <code>document</code> renderer.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public abstract class AbstractDocumentRenderer
- extends AbstractLogEnabled
- implements DocumentRenderer
-{
- @Requirement
- protected ParserModuleManager parserModuleManager;
-
- @Requirement
- protected Doxia doxia;
-
- @Requirement
- private VelocityComponent velocity;
-
- /**
- * The common base directory of source files.
- */
- private String baseDir;
-
- //--------------------------------------------
- //
- //--------------------------------------------
-
- /**
- * Render an aggregate document from the files found in a Map.
- *
- * @param filesToProcess the Map of Files to process. The Map should contain as keys the paths of the
- * source files (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- * @param outputDirectory the output directory where the aggregate document should be generated.
- * @param documentModel the document model, containing all the metadata, etc.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @deprecated since 1.1.2, use {@link #render(Map, File, DocumentModel, DocumentRendererContext)}
- */
- public abstract void render( Map<String, ParserModule> filesToProcess, File outputDirectory,
- DocumentModel documentModel )
- throws DocumentRendererException, IOException;
-
- //--------------------------------------------
- //
- //--------------------------------------------
-
- /** {@inheritDoc} */
- public void render( Collection<String> files, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException
- {
- render( getFilesToProcess( files ), outputDirectory, documentModel, null );
- }
-
- /** {@inheritDoc} */
- public void render( File baseDirectory, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException
- {
- render( baseDirectory, outputDirectory, documentModel, null );
- }
-
- /**
- * Render an aggregate document from the files found in a Map.
- *
- * @param filesToProcess the Map of Files to process. The Map should contain as keys the paths of the
- * source files (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- * @param outputDirectory the output directory where the aggregate document should be generated.
- * @param documentModel the document model, containing all the metadata, etc.
- * @param context the rendering context when processing files.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- // nop
- }
-
- /**
- * Render a document from the files found in a source directory, depending on a rendering context.
- *
- * @param baseDirectory the directory containing the source files.
- * This should follow the standard Maven convention, ie containing all the site modules.
- * @param outputDirectory the output directory where the document should be generated.
- * @param documentModel the document model, containing all the metadata, etc.
- * If the model contains a TOC, only the files found in this TOC are rendered,
- * otherwise all files found under baseDirectory will be processed.
- * If the model is null, render all files from baseDirectory individually.
- * @param context the rendering context when processing files.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @since 1.1.2
- */
- public void render( File baseDirectory, File outputDirectory, DocumentModel documentModel,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- render( getFilesToProcess( baseDirectory ), outputDirectory, documentModel, context );
- }
-
- /**
- * Render a document from the files found in baseDirectory. This just forwards to
- * {@link #render(File,File,DocumentModel)} with a new DocumentModel.
- *
- * @param baseDirectory the directory containing the source files.
- * This should follow the standard Maven convention, ie containing all the site modules.
- * @param outputDirectory the output directory where the document should be generated.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @see #render(File, File, DocumentModel)
- */
- public void render( File baseDirectory, File outputDirectory )
- throws DocumentRendererException, IOException
- {
- render( baseDirectory, outputDirectory, (DocumentModel) null );
- }
-
- /**
- * Render a document from the files found in baseDirectory.
- *
- * @param baseDirectory the directory containing the source files.
- * This should follow the standard Maven convention, ie containing all the site modules.
- * @param outputDirectory the output directory where the document should be generated.
- * @param documentDescriptor a file containing the document model.
- * If this file does not exist or is null, some default settings will be used.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @see #render(File, File) if documentDescriptor does not exist or is null
- * @see #render(Map, File, DocumentModel) otherwise
- */
- public void render( File baseDirectory, File outputDirectory, File documentDescriptor )
- throws DocumentRendererException, IOException
- {
- if ( ( documentDescriptor == null ) || ( !documentDescriptor.exists() ) )
- {
- getLogger().warn( "No documentDescriptor found: using default settings!" );
-
- render( baseDirectory, outputDirectory );
- }
- else
- {
- render( getFilesToProcess( baseDirectory ), outputDirectory, readDocumentModel( documentDescriptor ),
- null );
- }
- }
-
- /**
- * Render documents separately for each file found in a Map.
- *
- * @param filesToProcess the Map of Files to process. The Map should contain as keys the paths of the
- * source files (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- * @param outputDirectory the output directory where the documents should be generated.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @since 1.1.1
- * @deprecated since 1.1.2, use {@link #renderIndividual(Map, File, DocumentRendererContext)}
- */
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory )
- throws DocumentRendererException, IOException
- {
- // nop
- }
-
- /**
- * Render documents separately for each file found in a Map.
- *
- * @param filesToProcess the Map of Files to process. The Map should contain as keys the paths of the
- * source files (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- * @param outputDirectory the output directory where the documents should be generated.
- * @param context the rendering context.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- * @since 1.1.2
- */
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- // nop
- }
-
- /**
- * Returns a Map of files to process. The Map contains as keys the paths of the source files
- * (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- *
- * @param baseDirectory the directory containing the source files.
- * This should follow the standard Maven convention, ie containing all the site modules.
- * @return a Map of files to process.
- * @throws java.io.IOException in case of a problem reading the files under baseDirectory.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- */
- public Map<String, ParserModule> getFilesToProcess( File baseDirectory )
- throws IOException, DocumentRendererException
- {
- if ( !baseDirectory.isDirectory() )
- {
- getLogger().warn( "No files found to process!" );
-
- return new HashMap<String, ParserModule>();
- }
-
- setBaseDir( baseDirectory.getAbsolutePath() );
-
- Map<String, ParserModule> filesToProcess = new LinkedHashMap<String, ParserModule>();
- Map<String, String> duplicatesFiles = new LinkedHashMap<String, String>();
-
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- File moduleBasedir = new File( baseDirectory, module.getSourceDirectory() );
-
- if ( moduleBasedir.exists() )
- {
- // TODO: handle in/excludes
- List<String> allFiles = FileUtils.getFileNames( moduleBasedir, "**/*.*", null, false );
-
- String[] extensions = getExtensions( module );
- List<String> docs = new LinkedList<String>( allFiles );
- // Take care of extension case
- for ( Iterator<String> it = docs.iterator(); it.hasNext(); )
- {
- String name = it.next().trim();
-
- if ( !endsWithIgnoreCase( name, extensions ) )
- {
- it.remove();
- }
- }
-
- String[] vmExtensions = new String[extensions.length];
- for ( int i = 0; i < extensions.length; i++ )
- {
- vmExtensions[i] = extensions[i] + ".vm";
- }
- List<String> velocityFiles = new LinkedList<String>( allFiles );
- // *.xml.vm
- for ( Iterator<String> it = velocityFiles.iterator(); it.hasNext(); )
- {
- String name = it.next().trim();
-
- if ( !endsWithIgnoreCase( name, vmExtensions ) )
- {
- it.remove();
- }
- }
- docs.addAll( velocityFiles );
-
- for ( String filePath : docs )
- {
- filePath = filePath.trim();
-
- if ( filePath.lastIndexOf( '.' ) > 0 )
- {
- String key = filePath.substring( 0, filePath.lastIndexOf( '.' ) );
-
- if ( duplicatesFiles.containsKey( key ) )
- {
- throw new DocumentRendererException( "Files '" + module.getSourceDirectory()
- + File.separator + filePath + "' clashes with existing '"
- + duplicatesFiles.get( key ) + "'." );
- }
-
- duplicatesFiles.put( key, module.getSourceDirectory() + File.separator + filePath );
- }
-
- filesToProcess.put( filePath, module );
- }
- }
- }
-
- return filesToProcess;
- }
-
- protected static String[] getExtensions( ParserModule module )
- {
- String[] extensions = new String[module.getExtensions().length];
- for ( int i = module.getExtensions().length - 1; i >= 0; i-- )
- {
- extensions[i] = '.' + module.getExtensions()[i];
- }
- return extensions;
- }
-
- // TODO replace with StringUtils.endsWithIgnoreCase() from maven-shared-utils 0.7
- protected static boolean endsWithIgnoreCase( String str, String searchStr )
- {
- if ( str.length() < searchStr.length() )
- {
- return false;
- }
-
- return str.regionMatches( true, str.length() - searchStr.length(), searchStr, 0, searchStr.length() );
- }
-
- protected static boolean endsWithIgnoreCase( String str, String[] searchStrs )
- {
- for ( String searchStr : searchStrs )
- {
- if ( endsWithIgnoreCase( str, searchStr ) )
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns a Map of files to process. The Map contains as keys the paths of the source files
- * (relative to {@link #getBaseDir() baseDir}), and the corresponding ParserModule as values.
- *
- * @param files The Collection of source files.
- * @return a Map of files to process.
- */
- public Map<String, ParserModule> getFilesToProcess( Collection<String> files )
- {
- // ----------------------------------------------------------------------
- // Map all the file names to parser ids
- // ----------------------------------------------------------------------
-
- Map<String, ParserModule> filesToProcess = new HashMap<String, ParserModule>();
-
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- String[] extensions = getExtensions( module );
-
- String sourceDirectory = File.separator + module.getSourceDirectory() + File.separator;
-
- for ( String file : files )
- {
- // first check if the file path contains one of the recognized source dir identifiers
- // (there's trouble if a pathname contains 2 identifiers), then match file extensions (not unique).
-
- if ( file.indexOf( sourceDirectory ) != -1 )
- {
- filesToProcess.put( file, module );
- }
- else
- {
- // don't overwrite if it's there already
- if ( endsWithIgnoreCase( file, extensions ) && !filesToProcess.containsKey( file ) )
- {
- filesToProcess.put( file, module );
- }
- }
- }
- }
-
- return filesToProcess;
- }
-
- /** {@inheritDoc} */
- public DocumentModel readDocumentModel( File documentDescriptor )
- throws DocumentRendererException, IOException
- {
- DocumentModel documentModel;
-
- Reader reader = null;
- try
- {
- reader = ReaderFactory.newXmlReader( documentDescriptor );
- documentModel = new DocumentXpp3Reader().read( reader );
- }
- catch ( XmlPullParserException e )
- {
- throw new DocumentRendererException( "Error parsing document descriptor", e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
- return documentModel;
- }
-
- /**
- * Sets the current base directory.
- *
- * @param newDir the absolute path to the base directory to set.
- */
- public void setBaseDir( String newDir )
- {
- this.baseDir = newDir;
- }
-
- /**
- * Return the current base directory.
- *
- * @return the current base directory.
- */
- public String getBaseDir()
- {
- return this.baseDir;
- }
-
- //--------------------------------------------
- //
- //--------------------------------------------
-
- /**
- * Parse a source document into a sink.
- *
- * @param fullDocPath absolute path to the source document.
- * @param parserId determines the parser to use.
- * @param sink the sink to receive the events.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException in case of a parsing error.
- * @throws java.io.IOException if the source document cannot be opened.
- * @deprecated since 1.1.2, use {@link #parse(String, String, Sink, DocumentRendererContext)}
- */
- protected void parse( String fullDocPath, String parserId, Sink sink )
- throws DocumentRendererException, IOException
- {
- parse( fullDocPath, parserId, sink, null );
- }
-
- /**
- * Parse a source document into a sink.
- *
- * @param fullDocPath absolute path to the source document.
- * @param parserId determines the parser to use.
- * @param sink the sink to receive the events.
- * @param context the rendering context.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException in case of a parsing error.
- * @throws java.io.IOException if the source document cannot be opened.
- */
- protected void parse( String fullDocPath, String parserId, Sink sink, DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Parsing file " + fullDocPath );
- }
-
- Reader reader = null;
- try
- {
- File f = new File( fullDocPath );
-
- Parser parser = doxia.getParser( parserId );
- switch ( parser.getType() )
- {
- case Parser.XML_TYPE:
- reader = ReaderFactory.newXmlReader( f );
-
- if ( isVelocityFile( f ) )
- {
- reader = getVelocityReader( f, ( (XmlStreamReader) reader ).getEncoding(), context );
- }
- if ( context != null && Boolean.TRUE.equals( (Boolean) context.get( "validate" ) ) )
- {
- reader = validate( reader, fullDocPath );
- }
- break;
-
- case Parser.TXT_TYPE:
- case Parser.UNKNOWN_TYPE:
- default:
- if ( isVelocityFile( f ) )
- {
- reader =
- getVelocityReader( f, ( context == null ? ReaderFactory.FILE_ENCODING
- : context.getInputEncoding() ), context );
- }
- else
- {
- if ( context == null )
- {
- reader = ReaderFactory.newPlatformReader( f );
- }
- else
- {
- reader = ReaderFactory.newReader( f, context.getInputEncoding() );
- }
- }
- }
-
- sink.enableLogging( new PlexusLoggerWrapper( getLogger() ) );
-
- doxia.parse( reader, parserId, sink );
- }
- catch ( ParserNotFoundException e )
- {
- throw new DocumentRendererException( "No parser '" + parserId
- + "' found for " + fullDocPath + ": " + e.getMessage(), e );
- }
- catch ( ParseException e )
- {
- throw new DocumentRendererException( "Error parsing " + fullDocPath + ": " + e.getMessage(), e );
- }
- finally
- {
- IOUtil.close( reader );
-
- sink.flush();
- }
- }
-
- /**
- * Copies the contents of the resource directory to an output folder.
- *
- * @param outputDirectory the destination folder.
- * @throws java.io.IOException if any.
- */
- protected void copyResources( File outputDirectory )
- throws IOException
- {
- File resourcesDirectory = new File( getBaseDir(), "resources" );
-
- if ( !resourcesDirectory.isDirectory() )
- {
- return;
- }
-
- if ( !outputDirectory.exists() )
- {
- outputDirectory.mkdirs();
- }
-
- copyDirectory( resourcesDirectory, outputDirectory );
- }
-
- /**
- * Copy content of a directory, excluding scm-specific files.
- *
- * @param source directory that contains the files and sub-directories to be copied.
- * @param destination destination folder.
- * @throws java.io.IOException if any.
- */
- protected void copyDirectory( File source, File destination )
- throws IOException
- {
- if ( source.isDirectory() && destination.isDirectory() )
- {
- DirectoryScanner scanner = new DirectoryScanner();
-
- String[] includedResources = {"**/**"};
-
- scanner.setIncludes( includedResources );
-
- scanner.addDefaultExcludes();
-
- scanner.setBasedir( source );
-
- scanner.scan();
-
- List<String> includedFiles = Arrays.asList( scanner.getIncludedFiles() );
-
- for ( String name : includedFiles )
- {
- File sourceFile = new File( source, name );
-
- File destinationFile = new File( destination, name );
-
- FileUtils.copyFile( sourceFile, destinationFile );
- }
- }
- }
-
- /**
- * @param documentModel not null
- * @return the output name defined in the documentModel without the output extension. If the output name is not
- * defined, return target by default.
- * @since 1.1.1
- * @see org.apache.maven.doxia.document.DocumentModel#getOutputName()
- * @see #getOutputExtension()
- */
- protected String getOutputName( DocumentModel documentModel )
- {
- String outputName = documentModel.getOutputName();
- if ( outputName == null )
- {
- getLogger().info( "No outputName is defined in the document descriptor. Using 'target'" );
-
- documentModel.setOutputName( "target" );
- }
-
- outputName = outputName.trim();
- if ( outputName.toLowerCase( Locale.ENGLISH ).endsWith( "." + getOutputExtension() ) )
- {
- outputName =
- outputName.substring( 0, outputName.toLowerCase( Locale.ENGLISH )
- .lastIndexOf( "." + getOutputExtension() ) );
- }
- documentModel.setOutputName( outputName );
-
- return documentModel.getOutputName();
- }
-
- /**
- * TODO: DOXIA-111: we need a general filter here that knows how to alter the context
- *
- * @param f the file to process, not null
- * @param encoding the wanted encoding, not null
- * @param context the current render document context not null
- * @return a reader with
- * @throws DocumentRendererException
- */
- private Reader getVelocityReader( File f, String encoding, DocumentRendererContext context )
- throws DocumentRendererException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Velocity render for " + f.getAbsolutePath() );
- }
-
- SiteResourceLoader.setResource( f.getAbsolutePath() );
-
- Context velocityContext = new VelocityContext();
-
- if ( context.getKeys() != null )
- {
- for ( int i = 0; i < context.getKeys().length; i++ )
- {
- String key = (String) context.getKeys()[i];
-
- velocityContext.put( key, context.get( key ) );
- }
- }
-
- StringWriter sw = new StringWriter();
- try
- {
- velocity.getEngine().mergeTemplate( f.getAbsolutePath(), encoding, velocityContext, sw );
- }
- catch ( Exception e )
- {
- throw new DocumentRendererException( "Error whenn parsing Velocity file " + f.getAbsolutePath() + ": "
- + e.getMessage(), e );
- }
-
- return new StringReader( sw.toString() );
- }
-
- /**
- * @param f not null
- * @return <code>true</code> if file has a vm extension, <code>false</false> otherwise.
- */
- private static boolean isVelocityFile( File f )
- {
- return FileUtils.getExtension( f.getAbsolutePath() ).toLowerCase( Locale.ENGLISH ).endsWith( "vm" );
- }
-
- private Reader validate( Reader source, String resource )
- throws ParseException, IOException
- {
- getLogger().debug( "Validating: " + resource );
-
- try
- {
- String content = IOUtil.toString( new BufferedReader( source ) );
-
- new XmlValidator( new PlexusLoggerWrapper( getLogger() ) ).validate( content );
-
- return new StringReader( content );
- }
- finally
- {
- IOUtil.close( source );
- }
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocRenderer.java
deleted file mode 100644
index c953867..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocRenderer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Base renderer interface for the <code>document</code>
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated Since 1.1, use {@link DocumentRenderer} instead.
- */
-@Deprecated
-public interface DocRenderer
-{
- /** Plexus lookup. */
- String ROLE = DocRenderer.class.getName();
-
- /**
- * Render all files from a site directory to an output directory
- *
- * @param siteDirectory the input directory contains files to be generated
- * @param outputDirectory the output directory where files are generated
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- void render( File siteDirectory, File outputDirectory )
- throws DocumentRendererException, IOException;
-
- /**
- * Render a document depending a context and a document descriptor
- *
- * @param siteDirectory the input directory contains files to be generated
- * @param outputDirectory the output directory where file are generated
- * @param documentDescriptor the document descriptor
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- void render( File siteDirectory, File outputDirectory, File documentDescriptor )
- throws DocumentRendererException, IOException;
-
- /**
- * Get the output extension supported
- *
- * @return the ouput extension supported
- */
- String getOutputExtension();
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRenderer.java
deleted file mode 100644
index b8c9ec2..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRenderer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.maven.doxia.document.DocumentModel;
-
-/**
- * Base interface for rendering documents from a set of input files.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public interface DocumentRenderer
-{
- /** Plexus lookup role. */
- String ROLE = DocumentRenderer.class.getName();
-
- /**
- * Render a document from a set of files, depending on a rendering context.
- *
- * @param files the path name Strings (relative to a common base directory)
- * of files to include in the document generation.
- * @param outputDirectory the output directory where the document should be generated.
- * @param documentModel the document model, containing all the metadata, etc.
- * If the model contains a TOC, only the files found in this TOC are rendered,
- * otherwise all files from the Collection of files will be processed.
- * If the model is null, render all files individually.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any.
- * @throws java.io.IOException if any.
- */
- void render( Collection<String> files, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException;
-
- /**
- * Render a document from the files found in a source directory, depending on a rendering context.
- *
- * @param baseDirectory the directory containing the source files.
- * This should follow the standard Maven convention, ie containing all the site modules.
- * @param outputDirectory the output directory where the document should be generated.
- * @param documentModel the document model, containing all the metadata, etc.
- * If the model contains a TOC, only the files found in this TOC are rendered,
- * otherwise all files found under baseDirectory will be processed.
- * If the model is null, render all files from baseDirectory individually.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- void render( File baseDirectory, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException;
-
-// /**
-// * Render a document from the files found in a source directory, depending on a rendering context.
-// *
-// * @param baseDirectory the directory containing the source files.
-// * This should follow the standard Maven convention, ie containing all the site modules.
-// * @param outputDirectory the output directory where the document should be generated.
-// * @param documentModel the document model, containing all the metadata, etc.
-// * If the model contains a TOC, only the files found in this TOC are rendered,
-// * otherwise all files found under baseDirectory will be processed.
-// * If the model is null, render all files from baseDirectory individually.
-// * @param context the rendering context when processing files.
-// * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
-// * @throws java.io.IOException if any
-// * @since 1.1.2
-// */
-// void render( File baseDirectory, File outputDirectory, DocumentModel documentModel,
-// DocumentRendererContext context )
-// throws DocumentRendererException, IOException;
-
- /**
- * Read a document model from a file.
- *
- * @param documentDescriptor a document descriptor file that contains the document model.
- * @return the document model, containing all the metadata, etc.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- DocumentModel readDocumentModel( File documentDescriptor )
- throws DocumentRendererException, IOException;
-
- /**
- * Get the output extension associated with this DocumentRenderer.
- *
- * @return the ouput extension.
- */
- String getOutputExtension();
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererContext.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererContext.java
deleted file mode 100644
index c381727..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererContext.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.codehaus.plexus.util.ReaderFactory;
-
-/**
- * Context when processing Velocity files using a {@link java.util.HashMap} for data storage.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.1.2
- */
-@Deprecated
-public class DocumentRendererContext
-{
- private String inputEncoding = ReaderFactory.UTF_8;
-
- /**
- * Storage for key/value pairs.
- */
- private final Map<String, Object> context;
-
- /**
- * Default constructor.
- */
- public DocumentRendererContext()
- {
- context = new HashMap<String, Object>();
- }
-
- /**
- * @return The input encoding when processing files.
- */
- public String getInputEncoding()
- {
- return inputEncoding;
- }
-
- /**
- * @param inputEncoding new input encoding value when processing files.
- */
- public void setInputEncoding( String inputEncoding )
- {
- this.inputEncoding = inputEncoding;
- }
-
- /**
- * Adds a name/value pair to the context.
- *
- * @param key The name to key the provided value with.
- * @param value The corresponding value.
- * @return Object that was replaced in the the Context if applicable or null if not.
- */
- public Object put( String key, Object value )
- {
- if ( key == null )
- {
- return null;
- }
-
- return context.put( key, value );
- }
-
- /**
- * Gets the value corresponding to the provided key from the context.
- *
- * @param key The name of the desired value.
- * @return The value corresponding to the provided key or null if the key param is null.
- */
- public Object get( String key )
- {
- if ( key == null )
- {
- return null;
- }
-
- return context.get( key );
- }
-
- /**
- * Indicates whether the specified key is in the context.
- *
- * @param key The key to look for.
- * @return true if the key is in the context, false if not.
- */
- public boolean containsKey( Object key )
- {
- if ( !( key instanceof String ) ) // this includes null check
- {
- return false;
- }
-
- return context.containsKey( key.toString() );
- }
-
- /**
- * Get all the keys for the values in the context
- *
- * @return Object[] of keys in the Context.
- */
- public Object[] getKeys()
- {
- return context.keySet().toArray();
- }
-
- /**
- * Removes the value associated with the specified key from the context.
- *
- * @param key The name of the value to remove.
- * @return The value that the key was mapped to, or <code>null</code> if unmapped.
- */
- public Object remove( Object key )
- {
- if ( !( key instanceof String ) ) // this includes null check
- {
- return null;
- }
-
- return context.remove( key.toString() );
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererException.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererException.java
deleted file mode 100644
index 33b8da0..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/DocumentRendererException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * 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.
- */
-
-/**
- * A <code>document</code> renderer exception
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.1
- */
-@Deprecated
-public class DocumentRendererException
- extends Exception
-{
- /** serialVersionUID */
- static final long serialVersionUID = 295967936746221567L;
-
- /**
- * Default constructor.
- *
- * @param message An error message.
- */
- public DocumentRendererException( String message )
- {
- super( message );
- }
-
- /**
- * Other constructor.
- *
- * @param message An error message.
- * @param t The cause.
- */
- public DocumentRendererException( String message, Throwable t )
- {
- super( message, t );
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/AbstractITextRender.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/AbstractITextRender.java
deleted file mode 100644
index 50151e0..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/AbstractITextRender.java
+++ /dev/null
@@ -1,516 +0,0 @@
-package org.apache.maven.doxia.docrenderer.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.maven.doxia.Doxia;
-import org.apache.maven.doxia.docrenderer.DocRenderer;
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.apache.maven.doxia.document.DocumentTOCItem;
-import org.apache.maven.doxia.document.io.xpp3.DocumentXpp3Reader;
-import org.apache.maven.doxia.module.itext.ITextSink;
-import org.apache.maven.doxia.module.itext.ITextSinkFactory;
-import org.apache.maven.doxia.module.itext.ITextUtil;
-import org.apache.maven.doxia.parser.module.ParserModule;
-import org.apache.maven.doxia.parser.module.ParserModuleManager;
-import org.apache.maven.doxia.parser.ParseException;
-import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
-import org.apache.xml.utils.DefaultErrorHandler;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.XmlUtil;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-import com.lowagie.text.ElementTags;
-
-/**
- * Abstract <code>document</code> render with the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated since 1.1, use an implementation of {@link org.apache.maven.doxia.docrenderer.DocumentRenderer}.
- */
-public abstract class AbstractITextRender
- extends AbstractLogEnabled
- implements DocRenderer
-{
- private static final String XSLT_RESOURCE = "org/apache/maven/doxia/docrenderer/pdf/itext/TOC.xslt";
-
- private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
-
- private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
-
- @Requirement
- protected ParserModuleManager parserModuleManager;
-
- @Requirement
- protected Doxia doxia;
-
- static
- {
- TRANSFORMER_FACTORY.setErrorListener( new DefaultErrorHandler() );
- }
-
- private List<String> getModuleFileNames( ParserModule module, File moduleBasedir )
- throws IOException
- {
- StringBuilder includes = new StringBuilder();
-
- for ( String extension: module.getExtensions() )
- {
- if ( includes.length() > 0 )
- {
- includes.append( ',' );
- }
- includes.append( "**/*." );
- includes.append( extension );
- }
-
- return FileUtils.getFileNames( moduleBasedir, includes.toString(), null, false );
- }
-
- /** {@inheritDoc} */
- public void render( File siteDirectory, File outputDirectory )
- throws DocumentRendererException, IOException
- {
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- File moduleBasedir = new File( siteDirectory, module.getSourceDirectory() );
-
- if ( moduleBasedir.exists() )
- {
- List<String> docs = getModuleFileNames( module, moduleBasedir );
-
- for ( String doc : docs )
- {
- String fullPathDoc = new File( moduleBasedir, doc ).getPath();
-
- String outputITextName = doc.substring( 0, doc.indexOf( '.' ) + 1 ) + "xml";
- File outputITextFile = new File( outputDirectory, outputITextName );
- if ( !outputITextFile.getParentFile().exists() )
- {
- outputITextFile.getParentFile().mkdirs();
- }
- String iTextOutputName = doc.substring( 0, doc.indexOf( '.' ) + 1 ) + getOutputExtension();
- File iTextOutputFile = new File( outputDirectory, iTextOutputName );
- if ( !iTextOutputFile.getParentFile().exists() )
- {
- iTextOutputFile.getParentFile().mkdirs();
- }
-
- parse( fullPathDoc, module, outputITextFile );
-
- generateOutput( outputITextFile, iTextOutputFile );
- }
- }
- }
- }
-
- /** {@inheritDoc} */
- public void render( File siteDirectory, File outputDirectory, File documentDescriptor )
- throws DocumentRendererException, IOException
- {
- if ( ( documentDescriptor == null ) || ( !documentDescriptor.exists() ) )
- {
- if ( getLogger().isInfoEnabled() )
- {
- getLogger().info( "No documentDescriptor is found. Generate all documents." );
- }
- render( siteDirectory, outputDirectory );
- return;
- }
-
- DocumentModel documentModel;
- Reader reader = null;
- try
- {
- reader = ReaderFactory.newXmlReader( documentDescriptor );
- documentModel = new DocumentXpp3Reader().read( reader );
- }
- catch ( XmlPullParserException e )
- {
- throw new DocumentRendererException( "Error parsing document descriptor", e );
- }
- catch ( IOException e )
- {
- throw new DocumentRendererException( "Error reading document descriptor", e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
- if ( documentModel.getOutputName() == null )
- {
- if ( getLogger().isInfoEnabled() )
- {
- getLogger().info( "No outputName is defined in the document descriptor. Using 'generated_itext'" );
- }
- documentModel.setOutputName( "generated_itext" );
- }
-
- if ( ( documentModel.getToc() == null ) || ( documentModel.getToc().getItems() == null ) )
- {
- if ( getLogger().isInfoEnabled() )
- {
- getLogger().info( "No TOC is defined in the document descriptor. Merging all documents." );
- }
- }
-
- List<File> iTextFiles = new LinkedList<File>();
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- File moduleBasedir = new File( siteDirectory, module.getSourceDirectory() );
-
- if ( moduleBasedir.exists() )
- {
- @SuppressWarnings ( "unchecked" )
- List<String> docs = getModuleFileNames( module, moduleBasedir );
-
- for ( String doc : docs )
- {
- String fullPathDoc = new File( moduleBasedir, doc ).getPath();
-
- String outputITextName = doc.substring( 0, doc.lastIndexOf( '.' ) + 1 ) + "xml";
- File outputITextFile = new File( outputDirectory, outputITextName );
-
- if ( ( documentModel.getToc() == null ) || ( documentModel.getToc().getItems() == null ) )
- {
- iTextFiles.add( outputITextFile );
-
- if ( !outputITextFile.getParentFile().exists() )
- {
- outputITextFile.getParentFile().mkdirs();
- }
-
- parse( fullPathDoc, module, outputITextFile );
- }
- else
- {
- for ( Iterator<DocumentTOCItem> k = documentModel.getToc().getItems().iterator(); k.hasNext(); )
- {
- DocumentTOCItem tocItem = k.next();
-
- if ( tocItem.getRef() == null )
- {
- if ( getLogger().isInfoEnabled() )
- {
- getLogger().info( "No ref defined for an tocItem in the document descriptor." );
- }
- continue;
- }
-
- String outTmp = StringUtils.replace( outputITextFile.getAbsolutePath(), "\\", "/" );
- outTmp = outTmp.substring( 0, outTmp.lastIndexOf( '.' ) );
-
- String outRef = StringUtils.replace( tocItem.getRef(), "\\", "/" );
- if ( outRef.lastIndexOf( '.' ) != -1 )
- {
- outRef = outRef.substring( 0, outRef.lastIndexOf( '.' ) );
- }
- else
- {
- outRef = outRef.substring( 0, outRef.length() );
- }
-
- if ( outTmp.indexOf( outRef ) != -1 )
- {
- iTextFiles.add( outputITextFile );
-
- if ( !outputITextFile.getParentFile().exists() )
- {
- outputITextFile.getParentFile().mkdirs();
- }
-
- parse( fullPathDoc, module, outputITextFile );
- }
- }
- }
- }
- }
- }
-
- File iTextFile = new File( outputDirectory, documentModel.getOutputName() + ".xml" );
- File iTextOutput = new File( outputDirectory, documentModel.getOutputName() + "." + getOutputExtension() );
- Document document = generateDocument( iTextFiles );
- transform( documentModel, document, iTextFile );
- generateOutput( iTextFile, iTextOutput );
- }
-
- /**
- * Generate an output file from the contents of an input with the iText framework
- *
- * @param iTextFile input file
- * @param iTextOutput output file
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- public abstract void generateOutput( File iTextFile, File iTextOutput )
- throws DocumentRendererException, IOException;
-
- /**
- * Parse a sink
- *
- * @param fullPathDoc
- * @param module
- * @param outputITextFile
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException
- * @throws java.io.IOException
- */
- private void parse( String fullPathDoc, ParserModule module, File outputITextFile )
- throws DocumentRendererException, IOException
- {
- Writer writer = WriterFactory.newXmlWriter( outputITextFile );
- ITextSink sink = (ITextSink) new ITextSinkFactory().createSink( writer );
-
- sink.setClassLoader( new URLClassLoader( new URL[] { outputITextFile.getParentFile().toURI().toURL() } ) );
-
- Reader reader = null;
- try
- {
- File f = new File( fullPathDoc );
- if ( XmlUtil.isXml( f ) )
- {
- reader = ReaderFactory.newXmlReader( f );
- }
- else
- {
- // TODO Platform dependent?
- reader = ReaderFactory.newPlatformReader( f );
- }
-
- System.setProperty( "itext.basedir", outputITextFile.getParentFile().getAbsolutePath() );
-
- doxia.parse( reader, module.getParserId(), sink );
- }
- catch ( ParserNotFoundException e )
- {
- throw new DocumentRendererException( "Error getting a parser for '"
- + fullPathDoc + "': " + e.getMessage() );
- }
- catch ( ParseException e )
- {
- throw new DocumentRendererException( "Error parsing '"
- + fullPathDoc + "': line [" + e.getLineNumber() + "] " + e.getMessage(), e );
- }
- finally
- {
- IOUtil.close( reader );
-
- sink.flush();
-
- sink.close();
-
- IOUtil.close( writer );
-
- System.getProperties().remove( "itext.basedir" );
- }
- }
-
- /**
- * Merge all iTextFiles to a single one
- *
- * @param iTextFiles
- * @return a document
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- * @throws java.io.IOException if any
- */
- private Document generateDocument( List<File> iTextFiles )
- throws DocumentRendererException, IOException
- {
- Document document;
- try
- {
- document = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder().newDocument();
- }
- catch ( ParserConfigurationException e )
- {
- throw new DocumentRendererException( "Error building document :" + e.getMessage() );
- }
- document.appendChild( document.createElement( ElementTags.ITEXT ) ); // Used only to set a root
-
- for ( File iTextFile : iTextFiles )
- {
- Document iTextDocument;
- try
- {
- iTextDocument = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder().parse( iTextFile );
- }
- catch ( SAXException e )
- {
- throw new DocumentRendererException( "SAX Error : " + e.getMessage() );
- }
- catch ( ParserConfigurationException e )
- {
- throw new DocumentRendererException( "Error parsing configuration : " + e.getMessage() );
- }
-
- // Only one chapter per doc
- Node chapter = iTextDocument.getElementsByTagName( ElementTags.CHAPTER ).item( 0 );
- try
- {
- document.getDocumentElement().appendChild( document.importNode( chapter, true ) );
- }
- catch ( DOMException e )
- {
- throw new DocumentRendererException( "Error appending chapter for "
- + iTextFile + " : " + e.getMessage() );
- }
- }
-
- return document;
- }
-
- /**
- * Init the transformer object
- *
- * @return an instanced transformer object
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
- */
- private Transformer initTransformer()
- throws DocumentRendererException
- {
- try
- {
- Transformer transformer = TRANSFORMER_FACTORY.newTransformer( new StreamSource( DefaultPdfRenderer.class
- .getResourceAsStream( "/" + XSLT_RESOURCE ) ) );
- transformer.setErrorListener( TRANSFORMER_FACTORY.getErrorListener() );
-
- transformer.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "false" );
- transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
- transformer.setOutputProperty( OutputKeys.METHOD, "xml" );
- transformer.setOutputProperty( OutputKeys.ENCODING, "UTF-8" );
-
- return transformer;
- }
- catch ( TransformerConfigurationException e )
- {
- throw new DocumentRendererException( "Error configuring Transformer for " + XSLT_RESOURCE + ": "
- + e.getMessage() );
- }
- catch ( IllegalArgumentException e )
- {
- throw new DocumentRendererException( "Error configuring Transformer for " + XSLT_RESOURCE + ": "
- + e.getMessage() );
- }
- }
-
- /**
- * Add transformer parameters
- *
- * @param transformer
- * @param documentModel
- */
- private void addTransformerParameters( Transformer transformer, DocumentModel documentModel )
- {
- if ( documentModel.getMeta().getTitle() != null )
- {
- transformer.setParameter( "title", documentModel.getMeta().getTitle() );
- }
- if ( documentModel.getMeta().getAuthor() != null )
- {
- transformer.setParameter( "author", documentModel.getMeta().getAuthor() );
- }
- transformer.setParameter( "creationdate", new Date().toString() );
- if ( documentModel.getMeta().getSubject() != null )
- {
- transformer.setParameter( "subject", documentModel.getMeta().getSubject() );
- }
- if ( documentModel.getMeta().getKeywords() != null )
- {
- transformer.setParameter( "keywords", documentModel.getMeta().getKeywords() );
- }
- transformer.setParameter( "producer", "Generated with Doxia by " + System.getProperty( "user.name" ) );
- if ( ITextUtil.isPageSizeSupported( documentModel.getMeta().getTitle() ) )
- {
- transformer.setParameter( "pagesize", documentModel.getMeta().getPageSize() );
- }
- else
- {
- transformer.setParameter( "pagesize", "A4" );
- }
-
- transformer.setParameter( "frontPageHeader", "" );
- if ( documentModel.getMeta().getTitle() != null )
- {
- transformer.setParameter( "frontPageTitle", documentModel.getMeta().getTitle() );
- }
- transformer.setParameter( "frontPageFooter", "Generated date " + new Date().toString() );
- }
-
- /**
- * Transform a document to an iTextFile
- *
- * @param documentModel
- * @param document
- * @param iTextFile
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any.
- */
- private void transform( DocumentModel documentModel, Document document, File iTextFile )
- throws DocumentRendererException
- {
- Transformer transformer = initTransformer();
-
- addTransformerParameters( transformer, documentModel );
-
- try
- {
- transformer.transform( new DOMSource( document ), new StreamResult( iTextFile ) );
- }
- catch ( TransformerException e )
- {
- throw new DocumentRendererException( "Error transformer Document from "
- + document + ": " + e.getMessage() );
- }
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultPdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultPdfRenderer.java
deleted file mode 100644
index 35a1efb..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultPdfRenderer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.maven.doxia.docrenderer.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.module.itext.ITextUtil;
-import org.codehaus.plexus.component.annotations.Component;
-
-/**
- * PDF render with the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated since 1.1, use {@link org.apache.maven.doxia.docrenderer.pdf.itext.ITextPdfRenderer}.
- */
-@Component( role = PdfRenderer.class, hint = "itext.pdf" )
-public class DefaultPdfRenderer
- extends AbstractITextRender
- implements PdfRenderer
-{
- /** {@inheritDoc} */
- public String getOutputExtension()
- {
- return "pdf";
- }
-
- /** {@inheritDoc} */
- public void generateOutput( File iTextFile, File iTextOutput )
- throws DocumentRendererException, IOException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Writing : " + iTextOutput );
- }
- try
- {
- ITextUtil.writePdf( new FileInputStream( iTextFile ), new FileOutputStream( iTextOutput ) );
- }
- catch ( RuntimeException e )
- {
- throw new DocumentRendererException( "Error writing PDF from " + iTextOutput + ": " + e.getMessage() );
- }
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultRtfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultRtfRenderer.java
deleted file mode 100644
index 5f788b2..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/DefaultRtfRenderer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.maven.doxia.docrenderer.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.module.itext.ITextUtil;
-import org.codehaus.plexus.component.annotations.Component;
-
-/**
- * RTF render with the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated since 1.1, use {@link org.apache.maven.doxia.docrenderer.pdf.itext.ITextPdfRenderer}.
- */
-@Component( role = RtfRenderer.class, hint = "itext.rtf" )
-public class DefaultRtfRenderer
- extends AbstractITextRender
- implements RtfRenderer
-{
- /** {@inheritDoc} */
- public String getOutputExtension()
- {
- return "rtf";
- }
-
- /** {@inheritDoc} */
- public void generateOutput( File iTextFile, File iTextOutput )
- throws DocumentRendererException, IOException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Writing : " + iTextOutput );
- }
- try
- {
- ITextUtil.writeRtf( new FileInputStream( iTextFile ), new FileOutputStream( iTextOutput ) );
- }
- catch ( RuntimeException e )
- {
- throw new DocumentRendererException( "Error writing RTF from " + iTextOutput + ": " + e.getMessage() );
- }
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/PdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/PdfRenderer.java
deleted file mode 100644
index e3773ee..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/PdfRenderer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.doxia.docrenderer.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.doxia.docrenderer.DocRenderer;
-
-/**
- * PDF renderer interface for the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated since 1.1, use an implementation of {@link org.apache.maven.doxia.docrenderer.DocumentRenderer}.
- */
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface PdfRenderer
- extends DocRenderer
-{
- String ROLE = PdfRenderer.class.getName();
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/RtfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/RtfRenderer.java
deleted file mode 100644
index 2a28a8f..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/itext/RtfRenderer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.doxia.docrenderer.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.doxia.docrenderer.DocRenderer;
-
-/**
- * RTF renderer interface for the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @deprecated since 1.1, use an implementation of {@link org.apache.maven.doxia.docrenderer.DocumentRenderer}.
- */
-@SuppressWarnings( "checkstyle:interfaceistype" )
-public interface RtfRenderer
- extends DocRenderer
-{
- String ROLE = RtfRenderer.class.getName();
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/AbstractPdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/AbstractPdfRenderer.java
deleted file mode 100644
index 503bf77..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/AbstractPdfRenderer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.doxia.docrenderer.pdf;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.maven.doxia.docrenderer.AbstractDocumentRenderer;
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.apache.maven.doxia.parser.module.ParserModule;
-
-/**
- * Abstract pdf renderer, this doesn't depend on the framework.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public abstract class AbstractPdfRenderer
- extends AbstractDocumentRenderer
- implements PdfRenderer
-{
- /** {@inheritDoc} */
- public String getOutputExtension()
- {
- return "pdf";
- }
-
- /** {@inheritDoc} */
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException
- {
- render( filesToProcess, outputDirectory, documentModel, null );
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/PdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/PdfRenderer.java
deleted file mode 100644
index 7bb48ad..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/PdfRenderer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.apache.maven.doxia.docrenderer.pdf;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-
-import org.apache.maven.doxia.docrenderer.DocumentRenderer;
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-
-/**
- * PDF renderer interface.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public interface PdfRenderer
- extends DocumentRenderer
-{
- /** Plexus lookup role. */
- String ROLE = PdfRenderer.class.getName();
-
- /**
- * Generate a final pdf ouput file from an intermediate format file.
- *
- * @param inputFile eg a fo or an itext file.
- * @param pdfFile the pdf file to generate.
- * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any.
- */
- void generatePdf( File inputFile, File pdfFile )
- throws DocumentRendererException;
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
deleted file mode 100644
index b614384..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package org.apache.maven.doxia.docrenderer.pdf.fo;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.maven.doxia.docrenderer.DocumentRendererContext;
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.docrenderer.pdf.AbstractPdfRenderer;
-import org.apache.maven.doxia.docrenderer.pdf.PdfRenderer;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.apache.maven.doxia.document.DocumentTOC;
-import org.apache.maven.doxia.document.DocumentTOCItem;
-import org.apache.maven.doxia.module.fo.FoAggregateSink;
-import org.apache.maven.doxia.module.fo.FoSink;
-import org.apache.maven.doxia.module.fo.FoSinkFactory;
-import org.apache.maven.doxia.module.fo.FoUtils;
-import org.apache.maven.doxia.parser.module.ParserModule;
-
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.WriterFactory;
-
-import org.xml.sax.SAXParseException;
-
-/**
- * PDF renderer that uses Doxia's FO module.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-@Component( role = PdfRenderer.class, hint = "fo" )
-public class FoPdfRenderer
- extends AbstractPdfRenderer
-{
- /**
- * {@inheritDoc}
- * @see org.apache.maven.doxia.module.fo.FoUtils#convertFO2PDF(File, File, String)
- */
- public void generatePdf( File inputFile, File pdfFile )
- throws DocumentRendererException
- {
- // Should take care of the document model for the metadata...
- generatePdf( inputFile, pdfFile, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException
- {
- render( filesToProcess, outputDirectory, documentModel, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- // copy resources, images, etc.
- copyResources( outputDirectory );
-
- if ( documentModel == null )
- {
- getLogger().debug( "No document model, generating all documents individually." );
-
- renderIndividual( filesToProcess, outputDirectory, context );
- return;
- }
-
- String outputName = getOutputName( documentModel );
-
- File outputFOFile = new File( outputDirectory, outputName + ".fo" );
- if ( !outputFOFile.getParentFile().exists() )
- {
- outputFOFile.getParentFile().mkdirs();
- }
-
- File pdfOutputFile = new File( outputDirectory, outputName + ".pdf" );
- if ( !pdfOutputFile.getParentFile().exists() )
- {
- pdfOutputFile.getParentFile().mkdirs();
- }
-
- Writer writer = null;
- try
- {
- writer = WriterFactory.newXmlWriter( outputFOFile );
-
- FoAggregateSink sink = new FoAggregateSink( writer );
-
- File fOConfigFile = new File( outputDirectory, "pdf-config.xml" );
-
- if ( fOConfigFile.exists() )
- {
- sink.load( fOConfigFile );
- getLogger().debug( "Loaded pdf config file: " + fOConfigFile.getAbsolutePath() );
- }
-
- String generateTOC =
- ( context != null && context.get( "generateTOC" ) != null )
- ? context.get( "generateTOC" ).toString().trim()
- : "start";
- int tocPosition = 0;
- if ( "start".equalsIgnoreCase( generateTOC ) )
- {
- tocPosition = FoAggregateSink.TOC_START;
- }
- else if ( "end".equalsIgnoreCase( generateTOC ) )
- {
- tocPosition = FoAggregateSink.TOC_END;
- }
- else
- {
- tocPosition = FoAggregateSink.TOC_NONE;
- }
- sink.setDocumentModel( documentModel, tocPosition );
-
- sink.beginDocument();
-
- sink.coverPage();
-
- if ( tocPosition == FoAggregateSink.TOC_START )
- {
- sink.toc();
- }
-
- if ( ( documentModel.getToc() == null ) || ( documentModel.getToc().getItems() == null ) )
- {
- getLogger().info( "No TOC is defined in the document descriptor. Merging all documents." );
-
- mergeAllSources( filesToProcess, sink, context );
- }
- else
- {
- getLogger().debug( "Using TOC defined in the document descriptor." );
-
- mergeSourcesFromTOC( documentModel.getToc(), sink, context );
- }
-
- if ( tocPosition == FoAggregateSink.TOC_END )
- {
- sink.toc();
- }
-
- sink.endDocument();
- }
- finally
- {
- IOUtil.close( writer );
- }
-
- generatePdf( outputFOFile, pdfOutputFile, documentModel );
- }
-
- /** {@inheritDoc} */
- @Override
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory )
- throws DocumentRendererException, IOException
- {
- renderIndividual( filesToProcess, outputDirectory, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- for ( Map.Entry<String, ParserModule> entry : filesToProcess.entrySet() )
- {
- String key = entry.getKey();
- ParserModule module = entry.getValue();
-
- File fullDoc = new File( getBaseDir(), module.getSourceDirectory() + File.separator + key );
-
- String output = key;
- for ( String extension : module.getExtensions() )
- {
- String lowerCaseExtension = extension.toLowerCase( Locale.ENGLISH );
- if ( output.toLowerCase( Locale.ENGLISH ).indexOf( "." + lowerCaseExtension ) != -1 )
- {
- output =
- output.substring( 0, output.toLowerCase( Locale.ENGLISH ).indexOf( "." + lowerCaseExtension ) );
- }
- }
-
- File outputFOFile = new File( outputDirectory, output + ".fo" );
- if ( !outputFOFile.getParentFile().exists() )
- {
- outputFOFile.getParentFile().mkdirs();
- }
-
- File pdfOutputFile = new File( outputDirectory, output + ".pdf" );
- if ( !pdfOutputFile.getParentFile().exists() )
- {
- pdfOutputFile.getParentFile().mkdirs();
- }
-
- FoSink sink =
- (FoSink) new FoSinkFactory().createSink( outputFOFile.getParentFile(), outputFOFile.getName() );
- sink.beginDocument();
- parse( fullDoc.getAbsolutePath(), module.getParserId(), sink, context );
- sink.endDocument();
-
- generatePdf( outputFOFile, pdfOutputFile, null );
- }
- }
-
- private void mergeAllSources( Map<String, ParserModule> filesToProcess, FoAggregateSink sink,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- for ( Map.Entry<String, ParserModule> entry : filesToProcess.entrySet() )
- {
- String key = entry.getKey();
- ParserModule module = entry.getValue();
- sink.setDocumentName( key );
- File fullDoc = new File( getBaseDir(), module.getSourceDirectory() + File.separator + key );
-
- parse( fullDoc.getAbsolutePath(), module.getParserId(), sink, context );
- }
- }
-
- private void mergeSourcesFromTOC( DocumentTOC toc, FoAggregateSink sink, DocumentRendererContext context )
- throws IOException, DocumentRendererException
- {
- parseTocItems( toc.getItems(), sink, context );
- }
-
- private void parseTocItems( List<DocumentTOCItem> items, FoAggregateSink sink, DocumentRendererContext context )
- throws IOException, DocumentRendererException
- {
- for ( DocumentTOCItem tocItem : items )
- {
- if ( tocItem.getRef() == null )
- {
- if ( getLogger().isInfoEnabled() )
- {
- getLogger().info( "No ref defined for tocItem " + tocItem.getName() );
- }
-
- continue;
- }
-
- String href = StringUtils.replace( tocItem.getRef(), "\\", "/" );
- if ( href.lastIndexOf( '.' ) != -1 )
- {
- href = href.substring( 0, href.lastIndexOf( '.' ) );
- }
-
- renderModules( href, sink, tocItem, context );
-
- if ( tocItem.getItems() != null )
- {
- parseTocItems( tocItem.getItems(), sink, context );
- }
- }
- }
-
- private void renderModules( String href, FoAggregateSink sink, DocumentTOCItem tocItem,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- File moduleBasedir = new File( getBaseDir(), module.getSourceDirectory() );
-
- if ( moduleBasedir.exists() )
- {
- for ( String extension : module.getExtensions() )
- {
- String doc = href + "." + extension;
- File source = new File( moduleBasedir, doc );
-
- // Velocity file?
- if ( !source.exists() )
- {
- if ( href.indexOf( "." + extension ) != -1 )
- {
- doc = href + ".vm";
- }
- else
- {
- doc = href + "." + extension + ".vm";
- }
- source = new File( moduleBasedir, doc );
- }
-
- if ( source.exists() )
- {
- sink.setDocumentName( doc );
- sink.setDocumentTitle( tocItem.getName() );
-
- parse( source.getPath(), module.getParserId(), sink, context );
- }
- }
- }
- }
- }
-
- /**
- * @param inputFile
- * @param pdfFile
- * @param documentModel could be null
- * @throws DocumentRendererException if any
- * @since 1.1.1
- */
- private void generatePdf( File inputFile, File pdfFile, DocumentModel documentModel )
- throws DocumentRendererException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Generating: " + pdfFile );
- }
-
- try
- {
- FoUtils.convertFO2PDF( inputFile, pdfFile, null, documentModel );
- }
- catch ( TransformerException e )
- {
- if ( ( e.getCause() != null ) && ( e.getCause() instanceof SAXParseException ) )
- {
- SAXParseException sax = (SAXParseException) e.getCause();
-
- StringBuilder sb = new StringBuilder();
- sb.append( "Error creating PDF from " ).append( inputFile.getAbsolutePath() ).append( ":" )
- .append( sax.getLineNumber() ).append( ":" ).append( sax.getColumnNumber() ).append( "\n" );
- sb.append( e.getMessage() );
-
- throw new DocumentRendererException( sb.toString() );
- }
-
- throw new DocumentRendererException( "Error creating PDF from " + inputFile + ": " + e.getMessage() );
- }
- }
-}
diff --git a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java b/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
deleted file mode 100644
index 4259405..0000000
--- a/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
+++ /dev/null
@@ -1,690 +0,0 @@
-package org.apache.maven.doxia.docrenderer.pdf.itext;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.maven.doxia.docrenderer.DocumentRendererContext;
-import org.apache.maven.doxia.docrenderer.DocumentRendererException;
-import org.apache.maven.doxia.docrenderer.pdf.AbstractPdfRenderer;
-import org.apache.maven.doxia.docrenderer.pdf.PdfRenderer;
-import org.apache.maven.doxia.document.DocumentCover;
-import org.apache.maven.doxia.document.DocumentMeta;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.apache.maven.doxia.document.DocumentTOCItem;
-import org.apache.maven.doxia.module.itext.ITextSink;
-import org.apache.maven.doxia.module.itext.ITextSinkFactory;
-import org.apache.maven.doxia.module.itext.ITextUtil;
-import org.apache.maven.doxia.parser.module.ParserModule;
-import org.apache.xml.utils.DefaultErrorHandler;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.WriterFactory;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-import com.lowagie.text.ElementTags;
-
-/**
- * Abstract <code>document</code> render with the <code>iText</code> framework
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-@Component( role = PdfRenderer.class, hint = "itext" )
-public class ITextPdfRenderer
- extends AbstractPdfRenderer
-{
- /** The xslt style sheet used to transform a Document to an iText file. */
- private static final String XSLT_RESOURCE = "TOC.xslt";
-
- /** The TransformerFactory. */
- private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
-
- /** The DocumentBuilderFactory. */
- private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
-
- /** The DocumentBuilder. */
- private static final DocumentBuilder DOCUMENT_BUILDER;
-
- static
- {
- TRANSFORMER_FACTORY.setErrorListener( new DefaultErrorHandler() );
-
- try
- {
- DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder();
- }
- catch ( ParserConfigurationException e )
- {
- throw new RuntimeException( "Error building document :" + e.getMessage() );
- }
- }
-
- /** {@inheritDoc} */
- public void generatePdf( File inputFile, File pdfFile )
- throws DocumentRendererException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Generating : " + pdfFile );
- }
-
- try
- {
- ITextUtil.writePdf( new FileInputStream( inputFile ), new FileOutputStream( pdfFile ) );
- }
- catch ( IOException e )
- {
- throw new DocumentRendererException( "Cannot create PDF from " + inputFile + ": " + e.getMessage(), e );
- }
- catch ( RuntimeException e )
- {
- throw new DocumentRendererException( "Error creating PDF from " + inputFile + ": " + e.getMessage(), e );
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel )
- throws DocumentRendererException, IOException
- {
- render( filesToProcess, outputDirectory, documentModel, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void render( Map<String, ParserModule> filesToProcess, File outputDirectory, DocumentModel documentModel,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- // copy resources, images, etc.
- copyResources( outputDirectory );
-
- if ( documentModel == null )
- {
- getLogger().debug( "No document model, generating all documents individually." );
-
- renderIndividual( filesToProcess, outputDirectory, context );
- return;
- }
-
- String outputName = getOutputName( documentModel );
-
- File outputITextFile = new File( outputDirectory, outputName + ".xml" );
- if ( !outputITextFile.getParentFile().exists() )
- {
- outputITextFile.getParentFile().mkdirs();
- }
-
- File pdfOutputFile = new File( outputDirectory, outputName + ".pdf" );
- if ( !pdfOutputFile.getParentFile().exists() )
- {
- pdfOutputFile.getParentFile().mkdirs();
- }
-
- List<File> iTextFiles;
- if ( ( documentModel.getToc() == null ) || ( documentModel.getToc().getItems() == null ) )
- {
- getLogger().info( "No TOC is defined in the document descriptor. Merging all documents." );
-
- iTextFiles = parseAllFiles( filesToProcess, outputDirectory, context );
- }
- else
- {
- getLogger().debug( "Using TOC defined in the document descriptor." );
-
- iTextFiles = parseTOCFiles( outputDirectory, documentModel, context );
- }
-
- String generateTOC =
- ( context != null && context.get( "generateTOC" ) != null ? context.get( "generateTOC" ).toString()
- : "start" );
-
- File iTextFile = new File( outputDirectory, outputName + ".xml" );
- File iTextOutput = new File( outputDirectory, outputName + "." + getOutputExtension() );
- Document document = generateDocument( iTextFiles );
- transform( documentModel, document, iTextFile, generateTOC );
- generatePdf( iTextFile, iTextOutput );
- }
-
- /** {@inheritDoc} */
- @Override
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory )
- throws DocumentRendererException, IOException
- {
- renderIndividual( filesToProcess, outputDirectory, null );
- }
-
- /** {@inheritDoc} */
- @Override
- public void renderIndividual( Map<String, ParserModule> filesToProcess, File outputDirectory,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- for ( Map.Entry<String, ParserModule> entry : filesToProcess.entrySet() )
- {
- String key = entry.getKey();
- ParserModule module = entry.getValue();
- File fullDoc = new File( getBaseDir(), module.getSourceDirectory() + File.separator + key );
-
- String output = key;
- for ( String extension : module.getExtensions() )
- {
- String lowerCaseExtension = extension.toLowerCase( Locale.ENGLISH );
- if ( output.toLowerCase( Locale.ENGLISH ).indexOf( "." + lowerCaseExtension ) != -1 )
- {
- output =
- output.substring( 0, output.toLowerCase( Locale.ENGLISH ).indexOf( "." + lowerCaseExtension ) );
- }
- }
-
- File outputITextFile = new File( outputDirectory, output + ".xml" );
- if ( !outputITextFile.getParentFile().exists() )
- {
- outputITextFile.getParentFile().mkdirs();
- }
-
- File pdfOutputFile = new File( outputDirectory, output + ".pdf" );
- if ( !pdfOutputFile.getParentFile().exists() )
- {
- pdfOutputFile.getParentFile().mkdirs();
- }
-
- parse( fullDoc, module, outputITextFile, context );
-
- generatePdf( outputITextFile, pdfOutputFile );
- }
- }
-
- //--------------------------------------------
- //
- //--------------------------------------------
-
-
- /**
- * Parse a source document and emit results into a sink.
- *
- * @param fullDocPath file to the source document.
- * @param module the site module associated with the source document (determines the parser to use).
- * @param iTextFile the resulting iText xml file.
- * @throws DocumentRendererException in case of a parsing problem.
- * @throws IOException if the source and/or target document cannot be opened.
- */
- private void parse( File fullDoc, ParserModule module, File iTextFile, DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "Parsing file " + fullDoc.getAbsolutePath() );
- }
-
- System.setProperty( "itext.basedir", iTextFile.getParentFile().getAbsolutePath() );
-
- Writer writer = null;
- ITextSink sink = null;
- try
- {
- writer = WriterFactory.newXmlWriter( iTextFile );
- sink = (ITextSink) new ITextSinkFactory().createSink( writer );
-
- sink.setClassLoader( new URLClassLoader( new URL[] { iTextFile.getParentFile().toURI().toURL() } ) );
-
- parse( fullDoc.getAbsolutePath(), module.getParserId(), sink, context );
- }
- finally
- {
- if ( sink != null )
- {
- sink.flush();
- sink.close();
- }
- IOUtil.close( writer );
- System.getProperties().remove( "itext.basedir" );
- }
- }
-
- /**
- * Merge all iTextFiles to a single one.
- *
- * @param iTextFiles list of iText xml files.
- * @return Document.
- * @throws DocumentRendererException if any.
- * @throws IOException if any.
- */
- private Document generateDocument( List<File> iTextFiles )
- throws DocumentRendererException, IOException
- {
- Document document = DOCUMENT_BUILDER.newDocument();
- document.appendChild( document.createElement( ElementTags.ITEXT ) ); // Used only to set a root
-
- for ( File iTextFile : iTextFiles )
- {
- Document iTextDocument;
-
- try
- {
- iTextDocument = DOCUMENT_BUILDER.parse( iTextFile );
- }
- catch ( SAXException e )
- {
- throw new DocumentRendererException( "SAX Error : " + e.getMessage() );
- }
-
- // Only one chapter per doc
- Node chapter = iTextDocument.getElementsByTagName( ElementTags.CHAPTER ).item( 0 );
-
- try
- {
- document.getDocumentElement().appendChild( document.importNode( chapter, true ) );
- }
- catch ( DOMException e )
- {
- throw new DocumentRendererException( "Error appending chapter for "
- + iTextFile + " : " + e.getMessage() );
- }
- }
-
- return document;
- }
-
- /**
- * Initialize the transformer object.
- *
- * @return an instance of a transformer object.
- * @throws DocumentRendererException if any.
- */
- private Transformer initTransformer()
- throws DocumentRendererException
- {
- try
- {
- Transformer transformer = TRANSFORMER_FACTORY.newTransformer( new StreamSource( ITextPdfRenderer.class
- .getResourceAsStream( XSLT_RESOURCE ) ) );
-
- transformer.setErrorListener( TRANSFORMER_FACTORY.getErrorListener() );
-
- transformer.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "false" );
-
- transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
-
- transformer.setOutputProperty( OutputKeys.METHOD, "xml" );
-
- transformer.setOutputProperty( OutputKeys.ENCODING, "UTF-8" );
-
- // No doctype since itext doctype is not up to date!
-
- return transformer;
- }
- catch ( TransformerConfigurationException e )
- {
- throw new DocumentRendererException( "Error configuring Transformer for " + XSLT_RESOURCE + ": "
- + e.getMessage() );
- }
- catch ( IllegalArgumentException e )
- {
- throw new DocumentRendererException( "Error configuring Transformer for " + XSLT_RESOURCE + ": "
- + e.getMessage() );
- }
- }
-
- /**
- * Add transformer parameters from a DocumentModel.
- *
- * @param transformer the Transformer to set the parameters.
- * @param documentModel the DocumentModel to take the parameters from, could be null.
- * @param iTextFile the iTextFile not null for the relative paths.
- * @param generateTOC not null, possible values are: 'none', 'start' and 'end'.
- */
- private void addTransformerParameters( Transformer transformer, DocumentModel documentModel, File iTextFile,
- String generateTOC )
- {
- if ( documentModel == null )
- {
- return;
- }
-
- // TOC
- addTransformerParameter( transformer, "toc.position", generateTOC );
-
- // Meta parameters
- boolean hasNullMeta = false;
- if ( documentModel.getMeta() == null )
- {
- hasNullMeta = true;
- documentModel.setMeta( new DocumentMeta() );
- }
- addTransformerParameter( transformer, "meta.author", documentModel.getMeta().getAllAuthorNames(),
- System.getProperty( "user.name", "null" ) );
- addTransformerParameter( transformer, "meta.creator", documentModel.getMeta().getCreator(),
- System.getProperty( "user.name", "null" ) );
- // see com.lowagie.text.Document#addCreationDate()
- SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
- addTransformerParameter( transformer, "meta.creationdate", documentModel.getMeta().getCreationdate(),
- sdf.format( new Date() ) );
- addTransformerParameter( transformer, "meta.keywords", documentModel.getMeta().getAllKeyWords() );
- addTransformerParameter( transformer, "meta.pagesize", documentModel.getMeta().getPageSize(),
- ITextUtil.getPageSize( ITextUtil.getDefaultPageSize() ) );
- addTransformerParameter( transformer, "meta.producer", documentModel.getMeta().getGenerator(),
- "Apache Doxia iText" );
- addTransformerParameter( transformer, "meta.subject", documentModel.getMeta().getSubject(),
- ( documentModel.getMeta().getTitle() != null ? documentModel.getMeta().getTitle()
- : "" ) );
- addTransformerParameter( transformer, "meta.title", documentModel.getMeta().getTitle() );
- if ( hasNullMeta )
- {
- documentModel.setMeta( null );
- }
-
- // cover parameter
- boolean hasNullCover = false;
- if ( documentModel.getCover() == null )
- {
- hasNullCover = true;
- documentModel.setCover( new DocumentCover() );
- }
- addTransformerParameter( transformer, "cover.author", documentModel.getCover().getAllAuthorNames(),
- System.getProperty( "user.name", "null" ) );
- String companyLogo = getLogoURL( documentModel.getCover().getCompanyLogo(), iTextFile.getParentFile() );
- addTransformerParameter( transformer, "cover.companyLogo", companyLogo );
- addTransformerParameter( transformer, "cover.companyName", documentModel.getCover().getCompanyName() );
- if ( documentModel.getCover().getCoverdate() == null )
- {
- documentModel.getCover().setCoverDate( new Date() );
- addTransformerParameter( transformer, "cover.date", documentModel.getCover().getCoverdate() );
- documentModel.getCover().setCoverDate( null );
- }
- else
- {
- addTransformerParameter( transformer, "cover.date", documentModel.getCover().getCoverdate() );
- }
- addTransformerParameter( transformer, "cover.subtitle", documentModel.getCover().getCoverSubTitle() );
- addTransformerParameter( transformer, "cover.title", documentModel.getCover().getCoverTitle() );
- addTransformerParameter( transformer, "cover.type", documentModel.getCover().getCoverType() );
- addTransformerParameter( transformer, "cover.version", documentModel.getCover().getCoverVersion() );
- String projectLogo = getLogoURL( documentModel.getCover().getProjectLogo(), iTextFile.getParentFile() );
- addTransformerParameter( transformer, "cover.projectLogo", projectLogo );
- addTransformerParameter( transformer, "cover.projectName", documentModel.getCover().getProjectName() );
- if ( hasNullCover )
- {
- documentModel.setCover( null );
- }
- }
-
- /**
- * @param transformer not null
- * @param name not null
- * @param value could be empty
- * @param defaultValue could be empty
- * @since 1.1.1
- */
- private void addTransformerParameter( Transformer transformer, String name, String value, String defaultValue )
- {
- if ( StringUtils.isEmpty( value ) )
- {
- addTransformerParameter( transformer, name, defaultValue );
- }
- else
- {
- addTransformerParameter( transformer, name, value );
- }
- }
-
- /**
- * @param transformer not null
- * @param name not null
- * @param value could be empty
- * @since 1.1.1
- */
- private void addTransformerParameter( Transformer transformer, String name, String value )
- {
- if ( StringUtils.isEmpty( value ) )
- {
- return;
- }
-
- transformer.setParameter( name, value );
- }
-
- /**
- * Transform a document to an iTextFile.
- *
- * @param documentModel the DocumentModel to take the parameters from, could be null.
- * @param document the Document to transform.
- * @param iTextFile the resulting iText xml file.
- * @param generateTOC not null, possible values are: 'none', 'start' and 'end'.
- * @throws DocumentRendererException in case of a transformation error.
- */
- private void transform( DocumentModel documentModel, Document document, File iTextFile, String generateTOC )
- throws DocumentRendererException
- {
- Transformer transformer = initTransformer();
-
- addTransformerParameters( transformer, documentModel, iTextFile, generateTOC );
-
- // need a writer for StreamResult to prevent FileNotFoundException when iTextFile contains spaces
- Writer writer = null;
- try
- {
- writer = WriterFactory.newXmlWriter( iTextFile );
- transformer.transform( new DOMSource( document ), new StreamResult( writer ) );
- }
- catch ( TransformerException e )
- {
- throw new DocumentRendererException(
- "Error transforming Document " + document + ": " + e.getMessage(),
- e );
- }
- catch ( IOException e )
- {
- throw new DocumentRendererException(
- "Error transforming Document " + document + ": " + e.getMessage(),
- e );
- }
- finally
- {
- IOUtil.close( writer );
- }
- }
-
- /**
- * @param filesToProcess not null
- * @param outputDirectory not null
- * @return a list of all parsed files.
- * @throws DocumentRendererException if any
- * @throws IOException if any
- * @since 1.1.1
- */
- private List<File> parseAllFiles( Map<String, ParserModule> filesToProcess, File outputDirectory,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- List<File> iTextFiles = new LinkedList<File>();
- for ( Map.Entry<String, ParserModule> entry : filesToProcess.entrySet() )
- {
- String key = entry.getKey();
- ParserModule module = entry.getValue();
- File fullDoc = new File( getBaseDir(), module.getSourceDirectory() + File.separator + key );
-
- String outputITextName = key.substring( 0, key.lastIndexOf( '.' ) + 1 ) + "xml";
- File outputITextFileTmp = new File( outputDirectory, outputITextName );
- outputITextFileTmp.deleteOnExit();
- if ( !outputITextFileTmp.getParentFile().exists() )
- {
- outputITextFileTmp.getParentFile().mkdirs();
- }
-
- iTextFiles.add( outputITextFileTmp );
- parse( fullDoc, module, outputITextFileTmp, context );
- }
-
- return iTextFiles;
- }
-
- /**
- * @param filesToProcess not null
- * @param outputDirectory not null
- * @return a list of all parsed files.
- * @throws DocumentRendererException if any
- * @throws IOException if any
- * @since 1.1.1
- */
- private List<File> parseTOCFiles( File outputDirectory, DocumentModel documentModel,
- DocumentRendererContext context )
- throws DocumentRendererException, IOException
- {
- List<File> iTextFiles = new LinkedList<File>();
- for ( Iterator<DocumentTOCItem> it = documentModel.getToc().getItems().iterator(); it.hasNext(); )
- {
- DocumentTOCItem tocItem = it.next();
-
- if ( tocItem.getRef() == null )
- {
- getLogger().debug(
- "No ref defined for the tocItem '" + tocItem.getName()
- + "' in the document descriptor. IGNORING" );
- continue;
- }
-
- String href = StringUtils.replace( tocItem.getRef(), "\\", "/" );
- if ( href.lastIndexOf( '.' ) != -1 )
- {
- href = href.substring( 0, href.lastIndexOf( '.' ) );
- }
-
- Collection<ParserModule> modules = parserModuleManager.getParserModules();
- for ( ParserModule module : modules )
- {
- File moduleBasedir = new File( getBaseDir(), module.getSourceDirectory() );
-
- if ( moduleBasedir.exists() )
- {
- for ( String extension : module.getExtensions() )
- {
- String doc = href + "." + extension;
- File source = new File( moduleBasedir, doc );
-
- // Velocity file?
- if ( !source.exists() )
- {
- if ( href.indexOf( "." + extension ) != -1 )
- {
- doc = href + ".vm";
- }
- else
- {
- doc = href + "." + extension + ".vm";
- }
- source = new File( moduleBasedir, doc );
- }
-
- if ( source.exists() )
- {
- String outputITextName = doc.substring( 0, doc.lastIndexOf( '.' ) + 1 ) + "xml";
- File outputITextFileTmp = new File( outputDirectory, outputITextName );
- outputITextFileTmp.deleteOnExit();
- if ( !outputITextFileTmp.getParentFile().exists() )
- {
- outputITextFileTmp.getParentFile().mkdirs();
- }
-
- iTextFiles.add( outputITextFileTmp );
- parse( source, module, outputITextFileTmp, context );
- }
- }
- }
- }
- }
-
- return iTextFiles;
- }
-
- /**
- * @param logo
- * @param parentFile
- * @return the logo url or null if unable to create it.
- * @since 1.1.1
- */
- private String getLogoURL( String logo, File parentFile )
- {
- if ( logo == null )
- {
- return null;
- }
-
- try
- {
- return new URL( logo ).toString();
- }
- catch ( MalformedURLException e )
- {
- try
- {
- File f = new File( parentFile, logo );
- if ( !f.exists() )
- {
- getLogger().warn( "The logo " + f.getAbsolutePath() + " doesnt exist. IGNORING" );
- }
- else
- {
- return f.toURI().toURL().toString();
- }
- }
- catch ( MalformedURLException e1 )
- {
- getLogger().debug( "Failed to convert to URL: " + logo, e1 );
- }
- }
-
- return null;
- }
-}
diff --git a/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html b/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html
deleted file mode 100644
index 7dc901f..0000000
--- a/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html
+++ /dev/null
@@ -1,27 +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.
--->
-
-<body>
- <h1><b>DEPRECATED</b>.</h1>
- <p>Since 1.1, the <i>org.apache.maven.doxia.docrenderer.itext</i> package is all deprecated and is unmaintained.
- It will be removed in the future. You could use an implementation of
- <a href="../DocumentRenderer.html">DocumentRenderer</a> interface.</p>
-</body>
diff --git a/doxia-doc-renderer/src/main/resources/org/apache/maven/doxia/docrenderer/pdf/itext/TOC.xslt b/doxia-doc-renderer/src/main/resources/org/apache/maven/doxia/docrenderer/pdf/itext/TOC.xslt
deleted file mode 100644
index 85753f7..0000000
--- a/doxia-doc-renderer/src/main/resources/org/apache/maven/doxia/docrenderer/pdf/itext/TOC.xslt
+++ /dev/null
@@ -1,243 +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.
--->
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <!-- TOC Parameters -->
- <xsl:param name="toc.position" />
-
- <!-- MetaData Parameters -->
- <xsl:param name="meta.author" />
- <xsl:param name="meta.creator" />
- <xsl:param name="meta.creationdate" />
- <xsl:param name="meta.keywords" />
- <xsl:param name="meta.pagesize" />
- <xsl:param name="meta.producer" />
- <xsl:param name="meta.subject" />
- <xsl:param name="meta.title" />
-
- <!-- FrontPage Parameters -->
- <xsl:param name="cover.author" />
- <xsl:param name="cover.companyLogo" />
- <xsl:param name="cover.companyName" />
- <xsl:param name="cover.date" />
- <xsl:param name="cover.subtitle" />
- <xsl:param name="cover.title" />
- <xsl:param name="cover.type" />
- <xsl:param name="cover.version" />
- <xsl:param name="cover.projectLogo" />
- <xsl:param name="cover.projectName" />
-
- <xsl:template match="/itext">
- <itext
- author="{$meta.author}"
- creator="{$meta.creator}"
- creationdate="{$meta.creationdate}"
- keywords="{$meta.keywords}"
- pagesize="{$meta.pagesize}"
- producer="{$meta.producer}"
- subject="{$meta.subject}"
- title="{$meta.title}">
- <!-- Start Front page -->
- <paragraph>
- <chunk font="Helvetica" size="12.0" fontstyle="normal"
- blue="0" green="0" red="0">
- <table columns="2" left="false" right="false"
- top="false" bottom="false" align="Center" width="100%">
- <row>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="Left" verticalalign="middle">
- <xsl:if test="$cover.companyLogo != ''">
- <image url="{$cover.companyLogo}" />
- </xsl:if>
- </cell>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="Left" verticalalign="middle">
- <xsl:if test="$cover.projectLogo != ''">
- <image url="{$cover.projectLogo}" />
- </xsl:if>
- </cell>
- </row>
- <row>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="Center" verticalalign="middle"
- leading="300" colspan="2">
- <chunk font="Helvetica" size="24.0"
- fontstyle="bold" blue="0" green="0" red="0"><xsl:value-of select="$cover.title"/></chunk>
- </cell>
- </row>
- <row>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="Center" verticalalign="middle"
- colspan="2">
- <chunk font="Helvetica" size="24.0"
- fontstyle="bold" blue="0" green="0" red="0"><xsl:value-of select="$cover.subtitle"/></chunk>
- </cell>
- </row>
- <row>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="Left" verticalalign="middle"
- leading="300">
- <chunk font="Helvetica" size="16.0"
- fontstyle="bold" blue="0" green="0" red="0"><xsl:value-of select="$cover.companyName"/></chunk>
- </cell>
- <cell left="false" right="false" top="false"
- bottom="false" horizontalalign="right" verticalalign="middle"
- leading="300">
- <chunk font="Helvetica" size="16.0"
- fontstyle="bold" blue="0" green="0" red="0"><xsl:value-of select="$cover.date"/></chunk>
- </cell>
- </row>
- </table>
- </chunk>
- </paragraph>
- <!-- End Front page -->
-
- <!-- Start TOC -->
- <xsl:choose>
- <xsl:when test="$toc.position = 'start'">
- <newpage />
- <paragraph align="Center">
- <!-- TODO i18N -->
- <chunk font="Helvetica" size="24" fontstyle="bold" blue="0"
- green="0" red="0">Table Of Contents</chunk>
- </paragraph>
- <paragraph align="Left" leading="24.0">
- <newline />
- <xsl:apply-templates select="*" mode="toc" />
- </paragraph>
- </xsl:when>
- <xsl:otherwise>
- <newpage />
- </xsl:otherwise>
- </xsl:choose>
- <!-- End TOC -->
-
- <xsl:apply-templates select="*" mode="body" />
-
- <!-- Start TOC -->
- <xsl:choose>
- <xsl:when test="$toc.position = 'end'">
- <newpage />
- <paragraph align="Center">
- <!-- TODO i18N -->
- <chunk font="Helvetica" size="24" fontstyle="bold" blue="0"
- green="0" red="0">Table Of Contents</chunk>
- </paragraph>
- <paragraph align="Left" leading="24.0">
- <newline />
- <xsl:apply-templates select="*" mode="toc" />
- </paragraph>
- </xsl:when>
- <xsl:otherwise>
- <newpage />
- </xsl:otherwise>
- </xsl:choose>
- <!-- End TOC -->
- </itext>
- </xsl:template>
-
- <!-- Add TOC -->
- <xsl:template match="chapter|section" mode="toc">
- <xsl:if test="./title/chunk != ''">
- <chunk font="Helvetica" size="16.0" fontstyle="normal"
- blue="255" green="0" red="0"
- localgoto="{generate-id(./title/chunk)}">
- <xsl:number level="multiple" format="1.1.1.1.1."
- count="section|chapter" />
- <xsl:text> </xsl:text>
- <xsl:value-of select="title/chunk" />
- </chunk>
- </xsl:if>
- <xsl:if test="./title/anchor != ''">
- <xsl:if test="./title/anchor/@name != ''">
- <chunk font="Helvetica" size="16.0" fontstyle="normal"
- blue="255" green="0" red="0" localgoto="{./title/anchor/@name}">
- <xsl:number level="multiple" format="1.1.1.1.1."
- count="section|chapter" />
- <xsl:text> </xsl:text>
- <xsl:value-of select="title/anchor/chunk" />
- </chunk>
- </xsl:if>
- <xsl:if test="./title/anchor/@name = ''">
- <chunk font="Helvetica" size="16.0" fontstyle="normal"
- blue="0" green="0" red="0">
- <xsl:number level="multiple" format="1.1.1.1.1."
- count="section|chapter" />
- <xsl:text> </xsl:text>
- <xsl:value-of select="title/anchor/chunk" />
- </chunk>
- </xsl:if>
- </xsl:if>
-
- <newline />
- <xsl:apply-templates select="child::*[name() = 'section']"
- mode="toc" />
- </xsl:template>
-
- <xsl:template match="chapter/title/chunk|section/title/chunk"
- mode="body">
- <xsl:copy>
- <xsl:attribute name="localdestination">
- <xsl:value-of select="generate-id(.)" />
- </xsl:attribute>
- <xsl:apply-templates select="text()|*" mode="body" />
- </xsl:copy>
- </xsl:template>
-
- <xsl:template
- match="chapter/title/anchor/chunk|section/title/anchor/chunk"
- mode="body">
- <xsl:copy>
- <xsl:apply-templates select="@*" mode="body" />
- <xsl:apply-templates select="text()|*" mode="body" />
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="*|text()|@*" mode="body">
- <xsl:copy>
- <xsl:apply-templates select="*|text()|@*" mode="body" />
- </xsl:copy>
- </xsl:template>
-
- <!-- Update depth and numberdepth -->
- <xsl:template match="chapter" mode="body">
- <xsl:copy>
- <xsl:attribute name="depth">1</xsl:attribute>
- <xsl:attribute name="numberdepth">1</xsl:attribute>
- <xsl:apply-templates select="text()|*" mode="body" />
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="section" mode="body">
- <xsl:copy>
- <xsl:variable name="depth.from.context"
- select="count(ancestor::*)" />
- <xsl:attribute name="depth">
- <xsl:value-of select="$depth.from.context" />
- </xsl:attribute>
- <xsl:attribute name="numberdepth">
- <xsl:value-of select="$depth.from.context" />
- </xsl:attribute>
- <xsl:apply-templates select="text()|*" mode="body" />
- </xsl:copy>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/doxia-doc-renderer/src/site/apt/index.apt b/doxia-doc-renderer/src/site/apt/index.apt
deleted file mode 100644
index 82b38e2..0000000
--- a/doxia-doc-renderer/src/site/apt/index.apt
+++ /dev/null
@@ -1,27 +0,0 @@
- --------------
- Maven Doxia Sitetools Doc Renderer
- --------------
-
- ~~ 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Deprecation Notice
-
- This Doxia Sitetools module is deprecated and will be removed in version 2.0.0.
diff --git a/doxia-doc-renderer/src/site/site.xml b/doxia-doc-renderer/src/site/site.xml
deleted file mode 100644
index 9ea2c6e..0000000
--- a/doxia-doc-renderer/src/site/site.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- -->
-
-<project name="Doc Renderer" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
-
- <body>
-
- <menu ref="parent"/>
-
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="reports"/>
-
- </body>
-
-</project>
\ No newline at end of file
diff --git a/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java b/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
deleted file mode 100644
index dcb1a5b..0000000
--- a/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.maven.doxia.docrenderer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.doxia.docrenderer.pdf.PdfRenderer;
-import org.apache.maven.doxia.document.DocumentModel;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.1.1
- */
-public class DocumentRendererTest
- extends PlexusTestCase
-{
- private PdfRenderer docRenderer;
-
- private File siteDirectoryFile;
-
- /** @throws java.lang.Exception */
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- siteDirectoryFile = getTestFile( "src/test/resources/site" );
- }
-
- /** @throws java.lang.Exception */
- @Override
- protected void tearDown()
- throws Exception
- {
- release( docRenderer );
- super.tearDown();
- }
-
- /** @throws java.lang.Exception */
- public void testFo()
- throws Exception
- {
- renderImpl( "fo" );
- }
-
- /** @throws java.lang.Exception */
- public void testFoAggregate()
- throws Exception
- {
- renderAggregatedImpl( "fo" );
- }
-
- /** @throws java.lang.Exception */
- public void testIText()
- throws Exception
- {
- renderImpl( "itext" );
- }
-
- /** @throws java.lang.Exception */
- public void testITextAggregate()
- throws Exception
- {
- renderAggregatedImpl( "itext" );
- }
-
- private void renderImpl( String implementation )
- throws Exception
- {
- File outputDirectory = getTestFile( "target/output/" + implementation );
- if ( outputDirectory.exists() )
- {
- FileUtils.deleteDirectory( outputDirectory );
- }
- outputDirectory.mkdirs();
-
- docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
- assertNotNull( docRenderer );
-
- docRenderer.render( siteDirectoryFile, outputDirectory, null );
-
- List<String> files =
- FileUtils.getFileNames( new File( siteDirectoryFile, "apt" ), "**/*.apt",
- FileUtils.getDefaultExcludesAsString(), false );
- files.addAll( FileUtils.getFileNames( new File( siteDirectoryFile, "fml" ), "**/*.fml",
- FileUtils.getDefaultExcludesAsString(), false ) );
- files.addAll( FileUtils.getFileNames( new File( siteDirectoryFile, "xdoc" ), "**/*.xml",
- FileUtils.getDefaultExcludesAsString(), false ) );
-
- for ( String relativeFile : files )
- {
- String relativePdf = StringUtils.replace( relativeFile, FileUtils.getExtension( relativeFile ), "pdf" );
- File pdf = new File( outputDirectory, relativePdf );
-
- assertTrue( pdf.exists() );
- assertTrue( pdf.length() > 0 );
- }
- }
-
- private void renderAggregatedImpl( String implementation )
- throws Exception
- {
- File outputDirectory = getTestFile( "target/output/" + implementation + "-aggregated" );
- if ( outputDirectory.exists() )
- {
- FileUtils.deleteDirectory( outputDirectory );
- }
- outputDirectory.mkdirs();
-
- docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
- assertNotNull( docRenderer );
-
- DocumentModel descriptor = docRenderer.readDocumentModel( new File( siteDirectoryFile, "pdf.xml" ) );
- assertNotNull( descriptor );
-
- docRenderer.render( siteDirectoryFile, outputDirectory, descriptor );
-
- File pdf = new File( outputDirectory, descriptor.getOutputName() + ".pdf" );
-
- assertTrue( pdf.exists() );
- assertTrue( pdf.length() > 0 );
- }
-}
diff --git a/doxia-doc-renderer/src/test/resources/site/apt/index.apt b/doxia-doc-renderer/src/test/resources/site/apt/index.apt
deleted file mode 100644
index 5a9b461..0000000
--- a/doxia-doc-renderer/src/test/resources/site/apt/index.apt
+++ /dev/null
@@ -1,66 +0,0 @@
- -----
- Doxia
- -----
- Jason van Zyl
- Vincent Siveton
- ------
- July 2007
- ------
-
-~~ 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.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Maven Doxia
-
- Doxia is a content generation framework which aims to provide its users with powerful
- techniques for generating static and dynamic content: Doxia can be used in web-based
- publishing context to generate static sites, in addition to being incorporated into
- dynamic content generation systems like blogs, wikis and content management systems.
-
- Doxia supports markup languages with simple syntaxes. Lightweight markup languages
- are used by people who might be expected to read the document source as well as the rendered output.
-
- Doxia is used extensively by Maven and it powers the entire documentation system of Maven.
- It gives Maven the ability to take any document that Doxia supports and output it any format.
-
-* Brief History
-
- Based on the {{{http://www.xmlmind.com/aptconvert.html}Aptconvert}} project developed by
- {{{http://www.xmlmind.com/}Xmlmind}} company, Doxia was initially hosted by Codehaus, to become
- a sub-project of Maven early in 2006.
-
-* Main Features
-
- * Developed in Java
-
- * Support of several markup formats: APT (Almost Plain Text), Confluence, DocBook,
- FML (FAQ Markup Language), LaTeX, RTF, TWiki, XDoc (popular in Apache land), XHTML
-
-~~ iText should be replaced by FOP
-
- * Easy to learn the syntax of the supported markup formats
-
- * Macro support
-
- * No need to have a corporate infrastructure (like wiki) to host your documentation
-
- * Extensible framework
-
- []
diff --git a/doxia-doc-renderer/src/test/resources/site/apt/overview.apt b/doxia-doc-renderer/src/test/resources/site/apt/overview.apt
deleted file mode 100644
index 5360991..0000000
--- a/doxia-doc-renderer/src/test/resources/site/apt/overview.apt
+++ /dev/null
@@ -1,104 +0,0 @@
- -----
- Overview Of The Doxia Framework
- -----
- Vincent Siveton
- ------
- July 2007
- ------
-
-~~ 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.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Overview Of The Doxia Framework
-
- The following figure represents the main components of the Doxia Framework.
-
-[images/architecture.png] Doxia Framework
-
- <<Note>>: Just like Maven, Doxia uses {{{http://plexus.codehaus.org/}Plexus}} extensively.
-
-*Sink API
-
- The <Sink> interface is a generic markup language interface. It contains several methods that
- encapsulate common text syntax. A start tag is denoted by <xxxx()> method
- and a end of tag by <xxxx_()> method.
-
- For instance, you could do things like:
-
------
- sink.paragraph();
- sink.text( "my text" );
- sink.paragraph_();
------
-
- similar to this HTML markup:
-
------
-<p>my text</p>
------
-
- To find out more about the Sink API, you could read the Javadoc
- {{{http://maven.apache.org/doxia/doxia-sink-api/apidocs/org/apache/maven/doxia/sink/Sink.html}here}}.
-
-*Doxia Core
-
- The <Core> is the API to parse a source and populate it in a <Sink> object. The <Parser> interface
- contains only one method:
-
------
-void parse( Reader source, Sink sink )
- throws ParseException;
------
-
- The <ParseException> class has the responsibility to catch all parsing exceptions. It provides an
- helper method, <getLineNumber()>, which helps to find where an error occurred.
-
- The <AbstractParser> class is an abstract implementation of the <Parser>. It provides a macro mechanism
- to give dynamic functionalities for the parsing. For more information on macros, read the
- {{{./macros/index.html}Doxia Macro Guide}}.
-
- Finally, the <SiteModule> interface is the last part of the puzzle. It provides main definitions of a
- given Doxia module and it is used by the <doxia-site-renderer> site tools.
-
-*Doxia Modules
-
- A Doxia module is an implementation of a given markup language like APT or Xdoc. Each module should
- implement these interfaces:
-
- * <Parser> interface, more specifically the <AbstractParser> class
-
- * <SiteModule> interface
-
- []
-
- Several modules provide also a <Sink> implementation to handle a specific markup language.
-
- For more information on modules, read the {{{./modules/index.html}Doxia Module Guide}}.
-
-*Doxia Sitetools
-
- The <Sitetools> are a collection of tools to renderer an output. The main tool used by Maven,
- specifically the {{{http://maven.apache.org/plugins/maven-site-plugin/}Maven Site Plugin}}, is the
- <doxia-site-renderer> which renders in HTML any documents wrote with supported markup syntax. It used
- {{{http://velocity.apache.org/}Velocity templates}} to customize the renderer and the
- <site-decoration-model> tool to decorate the renderer. This component describes the layout of the site
- defined in the <site.xml> file.
-
- The <doxia-doc-renderer> tool is used to renderer any document in another document.
diff --git a/doxia-doc-renderer/src/test/resources/site/apt/resources.apt b/doxia-doc-renderer/src/test/resources/site/apt/resources.apt
deleted file mode 100644
index 9c606ec..0000000
--- a/doxia-doc-renderer/src/test/resources/site/apt/resources.apt
+++ /dev/null
@@ -1,49 +0,0 @@
- -----
- External Resources
- -----
- Vincent Siveton
- ------
- July 2007
- ------
-
-~~ 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.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/doxia/references/apt-format.html
-
-External Resources
-
-*Articles
-
-*-----------+--------------+--------------+
-|| Title || Publisher || Author
-*-----------+--------------+--------------+
-| {{{http://software.newsforge.com/article.pl?sid=04/04/16/1428219}Quick and dirty typesetting with APT}} | newsforge.com | Scott Nesbitt
-*-----------+--------------+--------------+
-| {{{http://en.wikipedia.org/wiki/Lightweight_markup_language}Lightweight markup language}} | wikipedia.org | ?
-*-----------+--------------+--------------+
-| {{{http://project.knowledgeforge.net/kforge/trac/wiki/TextProcessing}Simple (Ascii-Based) Text Formats}} | project.knowledgeforge.net | ?
-*-----------+--------------+--------------+
-
-*Tools
-
-*-----------+--------------+
-|| Name || Author
-*-----------+--------------+
-| {{{http://apteditor.sourceforge.net/}APT Editor (Eclipse plugin)}} | Mathieu Avoine
-*-----------+--------------+
diff --git a/doxia-doc-renderer/src/test/resources/site/fml/faq.fml b/doxia-doc-renderer/src/test/resources/site/fml/faq.fml
deleted file mode 100644
index 94ec21d..0000000
--- a/doxia-doc-renderer/src/test/resources/site/fml/faq.fml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-
-<!--
-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.
--->
-
-<faqs xmlns="http://maven.apache.org/FML/1.0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 file:../../../../../../../doxia/doxia-modules/doxia-module-fml/src/main/resources/fml-1.0.1.xsd"
- title="Frequently Asked Questions">
- <part id="General">
- <faq id="How_to_handle_style_in_the_APT_markup_language">
- <question>How to handle style in the APT markup language?</question>
- <answer>
- <p>
- APT doesn't currently support style. It is in the roadmap.
- </p>
- </answer>
- </faq>
- <faq id="How_to_export_in_PDF">
- <question>How to export in PDF?</question>
- <answer>
- <p>
- An <a href="http://www.lowagie.com/iText/">iText</a> module exists using the iText XML document.
- Unfortunately, the iText team discontinued the XML to PDF functionalities.
- </p>
- <p>
- A <a href="http://xmlgraphics.apache.org/fop/">FOP</a> module is currently in development in the
- Doxia sandbox. You can get the source
- <a href="http://svn.apache.org/repos/asf/maven/sandbox/trunk/doxia/doxia-module-fo/">here</a>.
- </p>
- </answer>
- </faq>
- <faq id="Is_it_possible_to_create_a_book">
- <question>Is it possible to create a book?</question>
- <answer>
- <p>
- Doxia also has a fairly simple tool for writing books. It comes complete with a Maven plugin
- to produce PDFs, LaTeX documents and Xdoc for direct integration in your Maven site.
- </p>
- <p>
- The Doxia Book code is still in the
- <a href="http://svn.apache.org/repos/asf/maven/sandbox/trunk/doxia/doxia-book/">Doxia sandbox</a>,
- but it is fully functional allthough limited.
- </p>
- <p>
- See <a href="./book/index.html">Writing Books in Doxia</a> for more information.
- </p>
- </answer>
- </faq>
- </part>
-</faqs>
\ No newline at end of file
diff --git a/doxia-doc-renderer/src/test/resources/site/pdf.xml b/doxia-doc-renderer/src/test/resources/site/pdf.xml
deleted file mode 100644
index 4b9180e..0000000
--- a/doxia-doc-renderer/src/test/resources/site/pdf.xml
+++ /dev/null
@@ -1,57 +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.
- */
- -->
-<document xmlns="http://maven.apache.org/DOCUMENT/1.0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DOCUMENT/1.0.1 file:../../../../../../doxia/doxia-core/target/generated-site/xsd/document-1.0.1.xsd"
- outputName="doxia-1.1.1">
-
- <meta>
- <title>Apache Maven Doxia</title>
- <author>The Apache Maven Project</author>
- <keyWords>
- <keyWord>Content generation framework</keyWord>
- <keyWord>Lightweight markup language</keyWord>
- <keyWord>APT</keyWord>
- <keyWord>FML</keyWord>
- <keyWord>XDOC</keyWord>
- </keyWords>
- </meta>
-
- <toc name="Table of Contents">
- <item name="What is Doxia?" ref="index.html"/>
- <item name="Overview" ref="overview.html"/>
- <item name="FAQ" ref="faq.html"/>
- <item name="Resources" ref="resources.html"/>
- <item name="FML Format" ref="references/fml-format.html"/>
- <item name="XDoc Format" ref="references/xdoc-format.html"/>
- </toc>
-
- <cover>
- <coverTitle>Apache Maven Doxia Test</coverTitle>
- <coverSubTitle>v. 1.1.1-SNAPSHOT</coverSubTitle>
- <coverType>User Guide</coverType>
- <companyName>The Apache Software Foundation</companyName>
- <companyLogo>./images/asf_logo_wide.png</companyLogo>
- <projectLogo>./images/doxia-logo.png</projectLogo>
- </cover>
-</document>
diff --git a/doxia-doc-renderer/src/test/resources/site/resources/css/site.css b/doxia-doc-renderer/src/test/resources/site/resources/css/site.css
deleted file mode 100644
index 0310f30..0000000
--- a/doxia-doc-renderer/src/test/resources/site/resources/css/site.css
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
- background: none;
- padding-right: 0;
-}
-
-body ul {
- list-style-type: square;
-}
-
-#downloadbox {
- float: right;
- margin-left: 2em;
- padding-left: 1em;
- padding-right: 1em;
- padding-bottom: 1em;
- border: 1px solid #999;
- background-color: #eee;
- width: 17.5em;
-}
-
-#downloadbox h5 {
- color: #000;
- margin: 0;
- border-bottom: 1px solid #aaaaaa;
- font-size: smaller;
- padding: 0;
- margin-top: 1em;
-}
-
-#downloadbox p {
- margin-top: 1em;
- margin-bottom: 0;
-}
-
-#downloadbox li {
- text-indent: inherit;
-}
-
diff --git a/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.odg b/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.odg
deleted file mode 100644
index 6a8ae41..0000000
Binary files a/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.odg and /dev/null differ
diff --git a/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.png b/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.png
deleted file mode 100644
index f37791d..0000000
Binary files a/doxia-doc-renderer/src/test/resources/site/resources/images/architecture.png and /dev/null differ
diff --git a/doxia-doc-renderer/src/test/resources/site/resources/images/asf_logo_wide.png b/doxia-doc-renderer/src/test/resources/site/resources/images/asf_logo_wide.png
deleted file mode 100644
index c584eba..0000000
Binary files a/doxia-doc-renderer/src/test/resources/site/resources/images/asf_logo_wide.png and /dev/null differ
diff --git a/doxia-doc-renderer/src/test/resources/site/resources/images/doxia-logo.png b/doxia-doc-renderer/src/test/resources/site/resources/images/doxia-logo.png
deleted file mode 100644
index 8c15655..0000000
Binary files a/doxia-doc-renderer/src/test/resources/site/resources/images/doxia-logo.png and /dev/null differ
diff --git a/doxia-doc-renderer/src/test/resources/site/site.xml b/doxia-doc-renderer/src/test/resources/site/site.xml
deleted file mode 100644
index a28856f..0000000
--- a/doxia-doc-renderer/src/test/resources/site/site.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- -->
-
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 file:../../../../../doxia-decoration-model/target/generated-site/xsd/decoration-1.0.0.xsd"
- name="Doxia">
- <bannerLeft>
- <name>Doxia</name>
- <src>images/apache-maven-project-2.png</src>
- </bannerLeft>
- <bannerRight>
- <src>images/maven-logo-2.gif</src>
- </bannerRight>
- <publishDate format="dd MMM yyyy" position="right" />
- <skin>
- <groupId>org.apache.maven.skins</groupId>
- <artifactId>maven-stylus-skin</artifactId>
- <version>1.0.1</version>
- </skin>
- <body>
- <head>
- <![CDATA[
- <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
- </script>
- <script type="text/javascript">
- _uacct = "UA-140879-1";
- urchinTracker();
- </script>
- ]]>
- </head>
-
- <links>
- <item name="Apache" href="http://www.apache.org/"/>
- <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
- <item name="Maven 2.x" href="http://maven.apache.org/"/>
- <item name="SCM" href="http://maven.apache.org/scm"/>
- <item name="Wagon" href="http://maven.apache.org/wagon"/>
- <item name="JXR" href="http://maven.apache.org/jxr"/>
- <item name="Doxia" href="http://maven.apache.org/doxia"/>
- </links>
-
- <menu name="About Doxia">
- <item name="What is Doxia?" href="index.html"/>
- <item name="Overview" href="overview.html"/>
- <item name="FAQ" href="faq.html"/>
- </menu>
-
- <menu name="Documentation">
- <item name="References" href="references/index.html">
- <item name="Apt Format" href="references/apt-format.html"/>
- <item name="FML Format" href="references/fml-format.html"/>
- <item name="Xdoc Format" href="references/xdoc-format.html"/>
- </item>
- <item name="Doxia Modules Guide" href="modules/index.html"/>
- <item name="Doxia Macros Guide" href="macros/index.html"/>
- <item name="Writing Books" href="book/index.html"/>
- <item name="Developer Centre" href="developers/index.html"/>
- <item name="External Resources" href="resources.html"/>
- </menu>
-
- <menu ref="reports"/>
- </body>
-</project>
diff --git a/doxia-doc-renderer/src/test/resources/site/xdoc/references/fml-format.xml b/doxia-doc-renderer/src/test/resources/site/xdoc/references/fml-format.xml
deleted file mode 100644
index f089794..0000000
--- a/doxia-doc-renderer/src/test/resources/site/xdoc/references/fml-format.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- -->
-<document xmlns="http://maven.apache.org/XDOC/2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../../../../../../../doxia/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd">
- <properties>
- <title>The FML (FAQ Markup Language) format</title>
- <author email="ltheussl_AT_apache_DOT_org">Lukas Theussl</author>
- </properties>
-
- <body>
-
- <section name="The FML format">
-
- <subsection name="Overview">
-
- <p>
- An 'fml' is an XML document conforming to a small and simple set of tags.
- The format was first used in the <a href="http://maven.apache.org/maven-1.x/">Maven 1</a>,
- version of the <a href="http://maven.apache.org/maven-1.x/plugins/faq/">FAQ plugin</a>.
- </p>
-
- </subsection>
-
- <subsection name="The FML format2">
-
- <p>
- The following is a sample FML document:
- </p>
- <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-
-<faqs title="Frequently Asked Questions" toplink="false">
-
- <part id="general">
- <title>General</title>
-
- <faq id="whats-foo">
- <question>
- What is Foo?
- </question>
- <answer>
- <p>some markup goes here</p>
-
- <source>some source code</source>
-
- <p>some markup goes here</p>
- </answer>
- </faq>
-
- <faq id="whats-bar">
- <question>
- What is Bar?
- </question>
- <answer>
- <p>some markup goes here</p>
- </answer>
- </faq>
- </part>
-
- <part id="install">
-
- <title>Installation</title>
-
- <faq id="how-install">
- <question>
- How do I install Foo?
- </question>
- <answer>
- <p>some markup goes here</p>
- </answer>
- </faq>
-
- </part>
-
-</faqs>
-]]></source>
-
- </subsection>
-
- </section>
-
- </body>
-
-</document>
diff --git a/doxia-doc-renderer/src/test/resources/site/xdoc/references/xdoc-format.xml b/doxia-doc-renderer/src/test/resources/site/xdoc/references/xdoc-format.xml
deleted file mode 100644
index ff935e6..0000000
--- a/doxia-doc-renderer/src/test/resources/site/xdoc/references/xdoc-format.xml
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- -->
-<document xmlns="http://maven.apache.org/XDOC/2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 file:../../../../../../../../doxia/doxia-modules/doxia-module-xdoc/src/main/resources/xdoc-2.0.xsd">
- <properties>
- <title>The Xdoc format</title>
- <author email="ltheussl_AT_apache_DOT_org">Lukas Theussl</author>
- </properties>
-
- <body>
-
- <section name="The XDoc format">
-
- <subsection name="Overview">
-
- <p>
- An 'xdoc' is an XML document conforming to a small and simple set of tags.
- Xdoc was the primary documentation format in <a href="http://maven.apache.org/maven-1.x/">Maven 1</a>,
- Maven 2 largely replaced this by <a href="apt-format.html">Apt</a>, but xdoc is still supported.
- </p>
-
- <p>
- Historically, the xdoc format can be traced back to the
- <a href="http://jakarta.apache.org/site/jakarta-site2.html">Anakia</a> format, as once used by the
- <a href="http://jakarta.apache.org/">Apache Jakarta</a> project.
- </p>
-
- <p>
- The Maven 1 Xdoc plugin introduced a few additions to the Anakia format, they are highlighted in the
- <a href="http://maven.apache.org/maven-1.x/plugins/xdoc/reference/xdocs.html">plugin</a> documentation.
- </p>
-
- </subsection>
-
- <subsection name="The XDoc format2">
-
- <p>
- The following is a sample XDoc document:
- </p>
- <source><![CDATA[
-<document>
-
- <properties>
- <title>Page Title</title>
- <author email="user@company.com">John Doe</author>
- </properties>
-
- <!-- Optional HEAD element, which is copied as is into the XHTML <head> element -->
- <head>
- <meta ... />
- </head>
-
- <body>
-
- <!-- The body of the document contains a number of sections -->
- <section name="section 1">
-
- <!-- Within sections, any XHTML can be used -->
- <p>Hi!</p>
-
- <!-- in addition to XHTML, any number of subsections can be within a section -->
- <subsection name="subsection 1">
- <p>Subsection!</p>
- </subsection>
-
- </section>
-
- <section name="other section">
-
- <!-- You can also include preformatted source blocks in the document -->
- <source>
-code line 1
-code line 2
- </source>
-
- </section>
-
- </body>
-
-</document>]]></source>
-
- </subsection>
-
- <subsection name="Additional sectioning">
-
- <p>
- Doxia will produce <code><h2></code> and
- <code><h3></code> headings for <code><section></code>
- and <code><subsection></code> elements, respectively.
- It is therefore perfectly valid to put some sub-headings
- (<code><h4></code>, <code><h5></code>,
- <code><h6></code>) inside a subsection. For instance,
- </p>
-
- <source><![CDATA[<h4>A subsubsection</h4>]]></source>
-
- <p>
- will produce:
- </p>
-
- </subsection>
-
- <subsection name="Referencing sections and subsections">
-
- <p>
- The core doxia modules do <b>not</b> construct anchors from
- section/subsection names. If you want to reference a section,
- you have to provide an explicit anchor:
- </p>
-
- <source><![CDATA[<a name="Section1"/>
-<section name="Section">
-
- <a name="SubSection1"/>
- <subsection name="SubSection">
- </subsection>
-
-</section>]]></source>
-
- <p>
- <b>Note</b> that this differs from previous behavior, where anchors
- were constructed from section/subsection names, replacing special
- characters by underscores. This behavior presents two shortcomings:
- </p>
-
- <ul>
-
- <li>
- If two sections or subsections have identical names
- (within one source document), you will get an ambiguity when
- referencing them. Also the resulting html document will not be
- valid XHTML. For other output formats (eg pdf), it might even be impossible
- to generate the target document.
- </li>
-
- <li>
- For long section titles, this leads to rather cumbersome anchor names.
- </li>
-
- </ul>
-
- <p>
- If automatic anchor generation is desired for a particular output format,
- it should be implemented / overridden by the corresponding low-level Sink.
- </p>
-
- </subsection>
-
- </section>
-
- <section name="Validation">
-
- <p>
- Doxia is currently not able to validate your xdoc files as no schema or DTD
- exists yet (however this is planned before the 1.0 release).
- It is therefore necessary to check manually whether your source files are valid xdocs,
- this should ensure that the generated html files are valid
- <a href="http://www.w3.org/TR/xhtml1/">XHTML1-transitional</a>.
- </p>
-
- <p>
- Here is a list of common mistakes to be aware of:
- </p>
-
- <subsection name="Don't nest block level elements">
-
- <p>Wrong:</p>
-
- <source><![CDATA[<p>
- Here's a list:
- <ul>
- <li>item 1</li>
- <li>item 2</li>
- </ul>
- of things to do.
-</p>]]></source>
-
- <p>Correct:</p>
-
- <source><![CDATA[<p>
- Here's a list:
-</p>
-<ul>
- <li>item 1</li>
- <li>item 2</li>
-</ul>
-<p>
- of things to do.
-</p>]]></source>
-
- <p>
- Typical block level elements are list elements,
- <code><table></code>, <code><source></code>,
- <code><div></code>, <code><p></code> and
- <code><pre></code>.
- </p>
-
- </subsection>
-
- <subsection name="Put inline elements inside block level elements">
-
- <p>Wrong:</p>
-
- <source><![CDATA[<section name="Downloads">
- <a href="downloads.html">Downloads</a>
-</section>]]></source>
-
- <p>Correct:</p>
-
- <source><![CDATA[<section name="Downloads">
- <p>
- <a href="downloads.html">Downloads</a>
- </p>
-</section>]]></source>
-
- <p>
- Typical inline elements are
- <code><a></code>, <code><strong></code>,
- <code><code></code>, <code><font></code>,
- <code><br></code> and <code><img></code>.
- </p>
-
- </subsection>
-
- <subsection name="Right order of elements in <properties>">
-
- <p>
- The <code><title></code> element has to come before
- <code><author></code>.
- </p>
-
- </subsection>
-
- <subsection name="Dont put <source> inside paragraphs">
-
- <p>Wrong:</p>
-
- <source><![CDATA[<p>
- The following command executes the program:
- <source>java -jar CoolApp.jar</source>
-</p>]]></source>
-
- <p>Correct:</p>
-
- <source><![CDATA[<p>
- The following command executes the program:
-</p>
-<source>java -jar CoolApp.jar</source>]]></source>
-
- <p>
- However, you may put <code><source></code> elements inside
- list items or table rows.
- </p>
-
- </subsection>
-
- </section>
-
- </body>
-
-</document>
diff --git a/pom.xml b/pom.xml
index d3b864e..f3f1984 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,6 @@ under the License.
<module>doxia-skin-model</module>
<module>doxia-integration-tools</module>
<module>doxia-site-renderer</module>
- <module>doxia-doc-renderer</module>
</modules>
<scm>
@@ -346,10 +345,6 @@ under the License.
<title>Doxia Integration Tools</title>
<packages>org.apache.maven.doxia.tools*</packages>
</group>
- <group>
- <title>Doxia Document Renderer</title>
- <packages>org.apache.maven.doxia.docrenderer*</packages>
- </group>
</groups>
</configuration>
<reportSets>
diff --git a/src/site/resources/images/doxia-sitetools-deps.png b/src/site/resources/images/doxia-sitetools-deps.png
index 410e33a..1578614 100644
Binary files a/src/site/resources/images/doxia-sitetools-deps.png and b/src/site/resources/images/doxia-sitetools-deps.png differ
diff --git a/src/site/xdoc/doxia-sitetools-deps.odg b/src/site/xdoc/doxia-sitetools-deps.odg
index af3825b..b39d34e 100644
Binary files a/src/site/xdoc/doxia-sitetools-deps.odg and b/src/site/xdoc/doxia-sitetools-deps.odg differ
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 818a2a6..66ef671 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -32,28 +32,22 @@
<section name="Doxia Sitetools">
- <p>Doxia Sitetools is an extension of <a href="../doxia">base Doxia component</a> that generates:</p>
- <ul>
- <li>either <b>HTML sites</b>, adding decoration (header, footer, navigation bar, menu, ...) to content that was generated by Doxia:
- a decoration is defined in a <b>site skin</b>,</li>
- <li>or <b>documents</b> like RTF or PDF.</li>
- </ul>
+ <p>Doxia Sitetools is an extension of <a href="../doxia">base Doxia component</a> that generates:
+ <b>HTML sites</b>, adding decoration (header, footer, navigation bar, menu, ...) to content that was generated by Doxia:
+ a decoration is defined in a <b>site skin</b>.</p>
<p>In addition, Doxia Sitetools processes files with extra <code>.vm</code> extension with <a href="http://velocity.apache.org/">Velocity</a>.</p>
<p>
- <img src="images/doxia-sitetools-deps.png" width="670" height="370" border="0" usemap="#Doxia_sitetools_dependencies" alt="Doxia Sitetools Dependencies"/>
+ <img src="images/doxia-sitetools-deps.png" border="0" usemap="#Doxia_sitetools_dependencies" alt="Doxia Sitetools Dependencies"/>
<map name="Doxia_sitetools_dependencies" id="Doxia_sitetools_dependencies">
<area shape="rect" coords="133,63,274,97" href="doxia-site-renderer/index.html" alt="Doxia Site Renderer"/>
<area shape="rect" coords="2,119,162,153" href="doxia-integration-tools/index.html" alt="Doxia Integration Tools"/>
<area shape="rect" coords="32,232,199,267" href="doxia-decoration-model/index.html" alt="Doxia Decoration Model"/>
<area shape="rect" coords="207,232,324,267" href="doxia-skin-model/index.html" alt="Doxia Skin Model"/>
- <area shape="rect" coords="459,63,596,97" href="doxia-doc-renderer/index.html" alt="Doxia Document Renderer"/>
<area shape="rect" coords="288,123,444,159" href="http://codehaus-plexus.github.io/plexus-velocity/" alt="Plexus Velocity"/>
<area shape="rect" coords="318,180,414,214" href="http://velocity.apache.org" alt="Velocity"/>
<area shape="rect" coords="134,301,274,337" href="/doxia/doxia/doxia-modules/doxia-module-xhtml/index.html" alt="Doxia Module XHTML"/>
- <area shape="rect" coords="409,301,524,336" href="/doxia/doxia/doxia-modules/doxia-module-fo/index.html" alt="Doxia Module FO"/>
- <area shape="rect" coords="527,302,663,337" href="/doxia/doxia/doxia-modules/doxia-module-itext/index.html" alt="Doxia Module iText"/>
- <area shape="rect" coords="126,297,669,369" href="/doxia/doxia/doxia-modules/index.html" alt="Doxia Modules"/>
+ <area shape="rect" coords="114,288,252,353" href="/doxia/doxia/doxia-modules/index.html" alt="Doxia Modules"/>
</map>
</p>