Author: tchemit Date: 2012-06-30 01:21:25 +0200 (Sat, 30 Jun 2012) New Revision: 726 Url: http://nuiton.org/repositories/revision/jrst/726 Log: fixes #2151: Introduce strategies of transform rst to xml (legacy, docutils) fixes #2139: Improve RST generation mecanism Added: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/AbstractJrstParser.java trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteModule.java trunk/jrst-site-util/src/main/plexus/ trunk/jrst-site-util/src/main/plexus/components.xml trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategy.java trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyDocutils.java trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyJRSTReader.java Removed: trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml Modified: trunk/doxia-module-jrst-legacy/pom.xml trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java trunk/doxia-module-jrst/pom.xml trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java trunk/jrst-site-util/pom.xml trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java trunk/jrst/pom.xml trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java trunk/pom.xml Modified: trunk/doxia-module-jrst/pom.xml =================================================================== --- trunk/doxia-module-jrst/pom.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst/pom.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -84,28 +84,12 @@ </dependency> <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-site-renderer</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-doxia-tools</artifactId> - </dependency> - - <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <scope>runtime</scope> </dependency> <dependency> - <groupId>dom4j</groupId> - <artifactId>dom4j</artifactId> - <!--<scope>runtime</scope>--> - </dependency> - - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> @@ -115,11 +99,6 @@ <artifactId>plexus-component-annotations</artifactId> </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - </dependencies> <!-- ************************************************************* --> Modified: trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java =================================================================== --- trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 23:21:25 UTC (rev 726) @@ -25,17 +25,10 @@ package org.nuiton.jrst; -import org.apache.maven.doxia.module.xdoc.XdocParser; -import org.apache.maven.doxia.parser.ParseException; import org.apache.maven.doxia.parser.Parser; -import org.apache.maven.doxia.sink.Sink; import org.codehaus.plexus.component.annotations.Component; -import org.dom4j.Document; +import org.codehaus.plexus.component.annotations.Requirement; -import java.io.File; -import java.io.Reader; -import java.io.StringReader; - /** * Parse an RST model, transform it into xdoc model and emit events into the * specified doxia Sink. @@ -48,30 +41,14 @@ description = "Parse an RST model (using python + docutils), " + "transform it into xdoc model and emit events " + "into the specified doxia Sink.") -public class JrstParser extends XdocParser { +public class JrstParser extends AbstractJrstParser { - @Override - public void parse(Reader source, Sink sink) throws ParseException { + @Requirement(optional = false, hint = "docutils") + protected JRSTToXmlStrategy jrstStrategy; - try { - // Write the source in a file to use it with JRST - File sourceFile = JrstDoxiaTool.prepareSourceFile(getLog(), source); - - // Generation of the xml file - Document doc = JRST.generateDocutils(sourceFile); - - // Application of xsl stylesheets - doc = JRST.generateXml(doc, JRST.TYPE_XDOC); - - // Give xsl result to XDoc parser - Reader reader = new StringReader(doc.asXML()); - super.parse(reader, sink); - } catch (Exception e) { - throw new ParseException("Can't parse rst file", e); - } finally { - - JrstDoxiaTool.clear(); - } - + @Override + public JRSTToXmlStrategy getStrategy() { + return jrstStrategy; } + } Deleted: trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java =================================================================== --- trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 23:21:25 UTC (rev 726) @@ -1,56 +0,0 @@ -/* - * #%L - * JRst :: Doxia module - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -package org.nuiton.jrst; - -import org.apache.maven.doxia.module.site.AbstractSiteModule; -import org.apache.maven.doxia.module.site.SiteModule; -import org.codehaus.plexus.component.annotations.Component; - -/** - * JrstSiteModule. - * - * @author jpages (pages@codelutin.com) - * @version $Id$ - * @since 2.0 - */ -@Component(role = SiteModule.class, hint = JrstDoxiaTool.JRST_PARSER_ID, - description = "Jrst doxia site mdule using python + docutils for rst.") -public class JrstSiteModule extends AbstractSiteModule { - @Override - public String getSourceDirectory() { - return "rst"; - } - - @Override - public String getExtension() { - return "rst"; - } - - @Override - public String getParserId() { - return JrstDoxiaTool.JRST_PARSER_ID; - } -} Modified: trunk/doxia-module-jrst-legacy/pom.xml =================================================================== --- trunk/doxia-module-jrst-legacy/pom.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst-legacy/pom.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -96,12 +96,6 @@ </dependency> <dependency> - <groupId>dom4j</groupId> - <artifactId>dom4j</artifactId> - <!--<scope>runtime</scope>--> - </dependency> - - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> @@ -111,11 +105,6 @@ <artifactId>plexus-component-annotations</artifactId> </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - </dependencies> <!-- ************************************************************* --> Modified: trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java =================================================================== --- trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 23:21:25 UTC (rev 726) @@ -25,17 +25,10 @@ package org.nuiton.jrst; -import org.apache.maven.doxia.module.xdoc.XdocParser; -import org.apache.maven.doxia.parser.ParseException; import org.apache.maven.doxia.parser.Parser; -import org.apache.maven.doxia.sink.Sink; import org.codehaus.plexus.component.annotations.Component; -import org.dom4j.Document; +import org.codehaus.plexus.component.annotations.Requirement; -import java.io.File; -import java.io.Reader; -import java.io.StringReader; - /** * Parse an RST model, transform it into xdoc model and emit events into the * specified doxia Sink. @@ -44,36 +37,18 @@ * @version $Id: JrstParser.java 685 2012-05-29 15:37:18Z jpages $ * @since 0.9.0 */ -@Component(role = Parser.class, hint = JrstDoxiaTool.JRST_PARSER_ID, +@Component(role = Parser.class, hint = AbstractJrstParser.JRST_PARSER_ID, description = "Parse an RST model (using jrst java api), " + "transform it into xdoc model and emit events into" + " the specified doxia Sink.") -public class JrstParser extends XdocParser { +public class JrstParser extends AbstractJrstParser { - @Override - public void parse(Reader source, Sink sink) throws ParseException { + @Requirement(optional = false, hint = "legacy") + protected JRSTToXmlStrategy jrstStrategy; - try { - // Write the source in a file to use it with JRST - File sourceFile = JrstDoxiaTool.prepareSourceFile(getLog(), source); -// File sourceFile = File.createTempFile("source", ".rst"); -// FileWriter fileWriter = new FileWriter(sourceFile); -// IOUtil.copy(source, fileWriter); - - // Simple generation of the xml file - Document doc = JRST.generateSimpleDoc(sourceFile, JRST.UTF_8); - - // Application of xsl stylesheets - doc = JRST.generateXml(doc, JRST.TYPE_XDOC); - - // Give xsl result to XDoc parser - Reader reader = new StringReader(doc.asXML()); - super.parse(reader, sink); - } catch (Exception e) { - throw new ParseException("Can't parse rst file", e); - } finally { - JrstDoxiaTool.clear(); - } - + @Override + public JRSTToXmlStrategy getStrategy() { + return jrstStrategy; } + } Deleted: trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java =================================================================== --- trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 23:21:25 UTC (rev 726) @@ -1,58 +0,0 @@ -/* - * #%L - * JRst :: Doxia module - * - * $Id: JrstSiteModule.java 608 2011-08-18 09:25:35Z tchemit $ - * $HeadURL: http://svn.nuiton.org/svn/jrst/branches/jrst-docutils-jython/doxia-module-jr... $ - * %% - * Copyright (C) 2009 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -package org.nuiton.jrst; - -import org.apache.maven.doxia.module.site.AbstractSiteModule; -import org.apache.maven.doxia.module.site.SiteModule; -import org.codehaus.plexus.component.annotations.Component; - -/** - * JrstSiteModule. - * - * @author <a href="mailto:chatellier@codelutin.com">Eric Chatellier</a> - * @version $Id: JrstSiteModule.java 608 2011-08-18 09:25:35Z tchemit $ - * @since 0.9.0 - */ -@Component(role = SiteModule.class, hint = JrstDoxiaTool.JRST_PARSER_ID, - description = "Jrst doxia site mdule using jrst for rst.") -public class JrstSiteModule - extends AbstractSiteModule { - - @Override - public String getSourceDirectory() { - return "rst"; - } - - @Override - public String getExtension() { - return "rst"; - } - - @Override - public String getParserId() { - return JrstDoxiaTool.JRST_PARSER_ID; - } -} Modified: trunk/jrst/pom.xml =================================================================== --- trunk/jrst/pom.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst/pom.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -82,21 +82,10 @@ <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-validator</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> <artifactId>jaxx-widgets</artifactId> </dependency> - <!-- swing widgets --> <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-widgets</artifactId> - </dependency> - - <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </dependency> @@ -131,6 +120,12 @@ </dependency> <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-annotations</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <scope>runtime</scope> @@ -280,6 +275,19 @@ </executions> </plugin> + + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-metadata</artifactId> + <executions> + <execution> + <goals> + <goal>generate-metadata</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> <pluginManagement> Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-29 23:21:25 UTC (rev 726) @@ -24,26 +24,6 @@ */ package org.nuiton.jrst; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.net.URL; -import java.util.HashMap; -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.transform.TransformerException; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -62,17 +42,38 @@ import org.python.util.PythonInterpreter; import org.xhtmlrenderer.pdf.ITextRenderer; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.TransformerException; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + /** * FIXME: 'JRST --help' doesn't work, but 'JRST --help toto' work :( FIXME: * 'JRST -c' doesn't work, but 'JRST -c toto' - * + * <p/> * Created: 3 nov. 06 20:56:00 * * @author poussin * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * <p/> + * Last update: $Date$ + * by : $Author$ */ public class JRST { @@ -156,13 +157,10 @@ /** XML output format type */ public static final String TYPE_XML = "xml"; - /** - * key, Out type; value: chain of XSL file to provide wanted file for output - */ + /** key, Out type; value: chain of XSL file to provide wanted file for output */ protected static Map<String, String> stylesheets; - /** - * Mime type associated with type - */ + + /** Mime type associated with type */ protected static Map<String, String> mimeType; static { @@ -197,7 +195,7 @@ * @param args main args * @throws Exception */ - public static void main(String[] args) throws Exception { + public static void main(String... args) throws Exception { I18n.init(new ClassPathI18nInitializer(), Locale.UK); @@ -233,7 +231,7 @@ } private static void askOption() throws SecurityException, - NoSuchMethodException, IOException { + NoSuchMethodException, IOException { try { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); @@ -254,7 +252,7 @@ * @throws NoSuchMethodException */ protected static void askOptionGraph() throws SecurityException, - NoSuchMethodException { + NoSuchMethodException { JRSTView jrstView = new JRSTView(); jrstView.pack(); jrstView.setVisible(true); @@ -264,30 +262,33 @@ * Transforms a Restructured Text (ReST) file to another type ( html, xdoc, pdf, etc... ) * * @param outputType The type of the output file ( html, xdoc, pdf, etc... ) - * @param fileIn The restructured text input file (rst) - * @param fileOut The output file - * @param overwrite The rule to overwrite file (NEVER, IFNEWER or ALLTIME ) + * @param fileIn The restructured text input file (rst) + * @param fileOut The output file + * @param overwrite The rule to overwrite file (NEVER, IFNEWER or ALLTIME ) * @throws Exception */ public static void generate(String outputType, File fileIn, - File fileOut, Overwrite overwrite, boolean simpleGeneration) throws Exception { + File fileOut, Overwrite overwrite, + boolean simpleGeneration) throws Exception { if (fileOut != null - && fileOut.exists() - && (overwrite == Overwrite.NEVER || (overwrite == Overwrite.IFNEWER && FileUtils + && fileOut.exists() + && (overwrite == Overwrite.NEVER || (overwrite == Overwrite.IFNEWER && FileUtils .isFileNewer(fileIn, fileOut)))) { log.info("Don't generate file " + fileOut - + ", because already exists"); + + ", because already exists"); } else { Document doc; + JRSTToXmlStrategy strategy; if (simpleGeneration) { - doc = generateSimpleDoc(fileIn, UTF_8); + strategy = new JRSTToXmlStrategyJRSTReader(); } else { - // Transformation to XML - doc = generateDocutils(fileIn); + strategy = new JRSTToXmlStrategyDocutils(); } + doc = strategy.generateRstToXml(fileIn, UTF_8); + // Application of xsl stylesheets doc = generateXml(doc, outputType); @@ -301,9 +302,37 @@ } /** + * Transforms a Restructured Text (ReST) file to pdf + * + * @param fileIn The restructured text input file (rst) + * @param fileOut The output file + * @param overwrite The rule to overwrite file (NEVER, IFNEWER or ALLTIME ) + * @throws Exception + */ + public static void generatePdf(File fileIn, File fileOut, Overwrite overwrite, + Document doc) throws Exception { + if (fileOut != null + && fileOut.exists() + && (overwrite == Overwrite.NEVER || (overwrite == Overwrite.IFNEWER && FileUtils + .isFileNewer(fileIn, fileOut)))) { + + log.info("Don't generate file " + fileOut + + ", because already exists"); + } else { + + // Application of xsl stylesheets + doc = generateXml(doc, "pdf"); + + // generation PDF + generatePdf(doc, fileIn, fileOut); + + } + } + + /** * Transforms a restructured text file to a XML file using JRST parser (used with option --simple) * - * @param fileIn Input restructured text file (.rst) + * @param fileIn Input restructured text file (.rst) * @param encoding Output file encoding * @return A document which contains XML code * @throws Exception @@ -320,11 +349,12 @@ /** * Transforms a restructured text file to a XML file using Jython interpreter to execute DocUtils scripts. * - * @param in Input restructured text file (.rst) + * @param in Input restructured text file (.rst) + * @param encoding Output file encoding * @return A document which contains XML code * @throws Exception */ - public static Document generateDocutils(File in) throws Exception { + public static Document generateDocutils(File in, String encoding) throws Exception { ByteArrayOutputStream out = null; @@ -361,19 +391,19 @@ // Execution of the docutils script to transform rst to xml String commandExec = String.format("__run__.exec_docutils('%s', '%s', '%s')", - docutilsPath, TYPE_XML, filePath); + docutilsPath, TYPE_XML, filePath); interp.exec(commandExec); // Cleans the python interpreter to avoid problems if they are multiple execution of this method interp.cleanup(); // Transforms the output stream to a document - String xmlString = new String(out.toByteArray(), UTF_8); + String xmlString = new String(out.toByteArray(), encoding); Document doc = null; try { doc = DocumentHelper.parseText(xmlString); - } catch (DocumentException e) { + } catch (DocumentException e) { log.error("Error during the creation of the document", e); } @@ -388,7 +418,7 @@ /** * Applies XSL stylesheet(s) to a XML document * - * @param doc A document which contains XML code + * @param doc A document which contains XML code * @param xslListOrOutType String which describes transformations to apply to the XML document * @return A document which contains XML transformed by XSL stylesheets * @throws IOException @@ -415,7 +445,7 @@ } if (stylesheet == null) { throw new FileNotFoundException("Can't find stylesheet: " - + xsl); + + xsl); } // add entity resolver @@ -430,7 +460,7 @@ /** * Writes the XML content generated in a file * - * @param doc Document which contains XML code + * @param doc Document which contains XML code * @param fileOut Output file * @throws IOException */ @@ -447,7 +477,7 @@ // write generated document writer.write(doc.asXML()); - }catch (Exception eee) { + } catch (Exception eee) { log.error("Failed to write file", eee); } finally { if (writer != null) { @@ -459,8 +489,8 @@ /** * Generates PDF file with IText with an HTML document * - * @param result Document which contains HTML code - * @param fileIn ReST file used to build resources path + * @param result Document which contains HTML code + * @param fileIn ReST file used to build resources path * @param fileOut PDF Output file * @throws Exception */ Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategy.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategy.java (rev 0) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategy.java 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,16 @@ +package org.nuiton.jrst; + +import org.dom4j.Document; + +import java.io.File; + +/** + * To transform a jrst file to an xml format. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0.1 + */ +public interface JRSTToXmlStrategy { + + Document generateRstToXml(File in, String encoding) throws Exception; +} Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyDocutils.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyDocutils.java (rev 0) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyDocutils.java 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,105 @@ +package org.nuiton.jrst; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.plexus.component.annotations.Component; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.nuiton.jrst.legacy.JRSTReader; +import org.python.util.PythonInterpreter; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.net.URL; + +/** + * Old mecanism to transform rst file to xml format using {@link JRSTReader}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0.1 + */ +@Component(role = JRSTToXmlStrategy.class, hint = "docutils", + description = "Transform a RST model (using jython + docutils), " + + "to a xml format.") + +public class JRSTToXmlStrategyDocutils implements JRSTToXmlStrategy { + + private static final String DOCUTILS_LAUNCHER = "__run__.py"; + + private static final String IMPORT_SCRIPT = "import __run__"; + + private static final String WINDOWS_NAME = "win"; + + private static final String OS_NAME = "os.name"; + + private static final String BANG = "!"; + + private static final String FILE_URI_PREFIX = "file:"; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(JRSTToXmlStrategyDocutils.class); + + @Override + public Document generateRstToXml(File in, String encoding) throws Exception { + ByteArrayOutputStream out = null; + + try { + // Transformation to XML + out = new ByteArrayOutputStream(); + + // Transformation of the __run__ URL into a path that python will use + // For example the URL is : + // jar:file:/home/user/.m2/repository/org/nuiton/jrst/docutils/1.6-SNAPSHOT/docutils-1.6-SNAPSHOT.jar!/__run__.py + // and it becomes : + // /home/user/.m2/repository/org/nuiton/jrst/docutils/1.6-SNAPSHOT/docutils-1.6-SNAPSHOT.jar/ + URL resource = JRST.class.getResource("/" + DOCUTILS_LAUNCHER); + String docutilsPath = resource.getPath() + .replaceAll(DOCUTILS_LAUNCHER, ""); + + docutilsPath = docutilsPath.replaceAll(BANG, ""); + docutilsPath = docutilsPath.replaceAll(FILE_URI_PREFIX, ""); + + // Import of the main script to use docutils ( __run__ ) + PythonInterpreter interp = new PythonInterpreter(); + String commandImport = IMPORT_SCRIPT; + interp.exec(commandImport); + + // If the OS is windows, escapes the backslashs in the filepath + String filePath = in.getAbsolutePath(); + String property = System.getProperty(OS_NAME).toLowerCase(); + if (property.contains(WINDOWS_NAME)) { + filePath = filePath.replaceAll("\\\\", "\\\\\\\\"); + } + + // Sets an output stream in the python interpreter and executes the code + interp.setOut(out); + + // Execution of the docutils script to transform rst to xml + String commandExec = String.format("__run__.exec_docutils('%s', '%s', '%s')", + docutilsPath, JRST.TYPE_XML, filePath); + interp.exec(commandExec); + + // Cleans the python interpreter to avoid problems if they are multiple execution of this method + interp.cleanup(); + + // Transforms the output stream to a document + String xmlString = new String(out.toByteArray(), encoding); + + Document doc = null; + try { + doc = DocumentHelper.parseText(xmlString); + } catch (DocumentException e) { + log.error("Error during the creation of the document", e); + } + out.close(); + + return doc; + } finally { + if (out != null) { + out.close(); + } + } + } +} Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyJRSTReader.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyJRSTReader.java (rev 0) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTToXmlStrategyJRSTReader.java 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,32 @@ +package org.nuiton.jrst; + +import org.codehaus.plexus.component.annotations.Component; +import org.dom4j.Document; +import org.nuiton.jrst.legacy.JRSTReader; + +import java.io.File; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.URL; + +/** + * Old mecanism to transform rst file to xml format using {@link JRSTReader}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0.1 + */ +@Component(role = JRSTToXmlStrategy.class, hint = "legacy", + description = "Transform a RST model (using jrst java api), " + + "to a xml format.") +public class JRSTToXmlStrategyJRSTReader implements JRSTToXmlStrategy { + + @Override + public Document generateRstToXml(File fileIn, String encoding) throws Exception { + URL url = fileIn.toURI().toURL(); + Reader in = new InputStreamReader(url.openStream(), encoding); + + // parse rst file + JRSTReader jrst = new JRSTReader(); + return jrst.read(in); + } +} Modified: trunk/jrst-site-util/pom.xml =================================================================== --- trunk/jrst-site-util/pom.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst-site-util/pom.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -56,25 +56,37 @@ </dependency> <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + </dependency> + + <dependency> <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-module-xdoc</artifactId> + <artifactId>doxia-logging-api</artifactId> </dependency> + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-decoration-model</artifactId> + </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-sink-api</artifactId> + <artifactId>doxia-module-xdoc</artifactId> </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-core</artifactId> - <scope>compile</scope> + <artifactId>doxia-sink-api</artifactId> </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> - <type>test-jar</type> </dependency> <dependency> @@ -83,25 +95,23 @@ </dependency> <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-doxia-tools</artifactId> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-api</artifactId> </dependency> <dependency> - <groupId>jaxen</groupId> - <artifactId>jaxen</artifactId> - <scope>runtime</scope> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> </dependency> <dependency> - <groupId>dom4j</groupId> - <artifactId>dom4j</artifactId> - <!--<scope>runtime</scope>--> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-velocity</artifactId> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-i18n</artifactId> </dependency> <dependency> @@ -114,6 +124,44 @@ <artifactId>plexus-utils</artifactId> </dependency> + <dependency> + <groupId>dom4j</groupId> + <artifactId>dom4j</artifactId> + <!--<scope>runtime</scope>--> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> <name>JRst :: Site util</name> @@ -134,4 +182,33 @@ </developer> </developers> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-metadata</artifactId> + <executions> + <execution> + <id>generate</id> + <goals> + <goal>generate-metadata</goal> + </goals> + </execution> + <execution> + <id>merge</id> + <goals> + <goal>merge-metadata</goal> + </goals> + <configuration> + <descriptors> + <descriptor>${basedir}/src/main/plexus/components.xml</descriptor> + <descriptor>${project.build.directory}/components.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </project> Added: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/AbstractJrstParser.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/AbstractJrstParser.java (rev 0) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/AbstractJrstParser.java 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,115 @@ +package org.nuiton.jrst; + +import org.apache.maven.doxia.logging.Log; +import org.apache.maven.doxia.module.xdoc.XdocParser; +import org.apache.maven.doxia.parser.ParseException; +import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.doxia.sink.render.RenderingContext; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.IOUtil; +import org.dom4j.Document; +import org.nuiton.util.FileUtil; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +/** + * Abstract Jrst doxia parser. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0.1 + */ +public abstract class AbstractJrstParser extends XdocParser { + + public static final String JRST_PARSER_ID = "jrst"; + + public abstract JRSTToXmlStrategy getStrategy(); + + protected RenderingContext renderingContext; + + protected MavenProject mavenProject; + + protected boolean verbose; + + @Override + public void parse(Reader source, Sink sink) throws ParseException { + + try { + // Write the source in a file to use it with JRST + File sourceFile = prepareSourceFile(getLog(), source); + + // Generation of the xml file +// Document doc = JRST.generateRstToXml(sourceFile); + Document doc = getStrategy().generateRstToXml(sourceFile, JRST.UTF_8); + + // Application of xsl stylesheets + doc = JRST.generateXml(doc, JRST.TYPE_XDOC); + + // Give xsl result to XDoc parser + Reader reader = new StringReader(doc.asXML()); + super.parse(reader, sink); + } catch (Exception e) { + throw new ParseException("Can't parse rst file", e); + } finally { + + clear(); + } + } + + public void setRenderingContext(RenderingContext renderingContext) { + this.renderingContext = renderingContext; + } + + public void setMavenProject(MavenProject mavenProject) { + this.mavenProject = mavenProject; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + protected File prepareSourceFile(Log log, Reader source) throws IOException { + + File sourceFile; + + if (mavenProject == null) { + sourceFile = File.createTempFile("source", "rst"); + + } else { + File temporayDirectory = new File( + mavenProject.getBasedir(), + "target" + File.separator + "generated-jrst"); + + sourceFile = new File(temporayDirectory, renderingContext.getInputName()); + + FileUtil.createDirectoryIfNecessary(sourceFile.getParentFile()); + +// // Write the source in a file to use it with JRST +// sourceFile = File.createTempFile(renderingContext.getInputName(), ".rst", +// temporayDirectory); + } + + if (verbose) { + log.info("Copy " + renderingContext.getInputName() + + " to " + sourceFile); + } + FileWriter fileWriter = new FileWriter(sourceFile); + try { + IOUtil.copy(source, fileWriter); + } finally { + fileWriter.close(); + } + + return sourceFile; + } + + public void clear() { + renderingContext = null; + mavenProject = null; + verbose = false; + } + +} Deleted: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java 2012-06-29 23:21:25 UTC (rev 726) @@ -1,83 +0,0 @@ -package org.nuiton.jrst; - -import org.apache.maven.doxia.logging.Log; -import org.apache.maven.doxia.sink.render.RenderingContext; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.IOUtil; -import org.nuiton.util.FileUtil; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Reader; - -/** - * Jrst tool used for some - * - * @author tchemit <chemit@codelutin.com> - * @since 2.1 - */ -public class JrstDoxiaTool { - - public static final String JRST_PARSER_ID = "jrst"; - - protected static RenderingContext renderingContext; - - protected static MavenProject mavenProject; - - protected static boolean verbose; - - public static void setRenderingContext(RenderingContext renderingContext) { - JrstDoxiaTool.renderingContext = renderingContext; - } - - public static void setMavenProject(MavenProject mavenProject) { - JrstDoxiaTool.mavenProject = mavenProject; - } - - public static void setVerbose(boolean verbose) { - JrstDoxiaTool.verbose = verbose; - } - - public static File prepareSourceFile(Log log, - Reader source) throws IOException { - - File sourceFile; - - if (JrstDoxiaTool.mavenProject == null) { - sourceFile = File.createTempFile("source", "rst"); - - } else { - File temporayDirectory = new File( - JrstDoxiaTool.mavenProject.getBasedir(), - "target" + File.separator + "generated-jrst"); - - sourceFile = new File(temporayDirectory, JrstDoxiaTool.renderingContext.getInputName()); - - FileUtil.createDirectoryIfNecessary(sourceFile.getParentFile()); - -// // Write the source in a file to use it with JRST -// sourceFile = File.createTempFile(renderingContext.getInputName(), ".rst", -// temporayDirectory); - } - - if (JrstDoxiaTool.verbose) { - log.info("Copy " + JrstDoxiaTool.renderingContext.getInputName() + - " to " + sourceFile); - } - FileWriter fileWriter = new FileWriter(sourceFile); - try { - IOUtil.copy(source, fileWriter); - } finally { - fileWriter.close(); - } - - return sourceFile; - } - - public static void clear() { - renderingContext = null; - mavenProject = null; - verbose = false; - } -} Added: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteModule.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteModule.java (rev 0) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,31 @@ +package org.nuiton.jrst; + +import org.apache.maven.doxia.module.site.AbstractSiteModule; +import org.apache.maven.doxia.module.site.SiteModule; +import org.codehaus.plexus.component.annotations.Component; + +/** + * The jrst site module. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0.1 + */ +@Component(role = SiteModule.class, hint = AbstractJrstParser.JRST_PARSER_ID, + description = "Jrst doxia site mdule using jrst for rst.") +public class JrstSiteModule extends AbstractSiteModule { + + @Override + public String getSourceDirectory() { + return "rst"; + } + + @Override + public String getExtension() { + return "rst"; + } + + @Override + public String getParserId() { + return AbstractJrstParser.JRST_PARSER_ID; + } +} Modified: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java 2012-06-29 23:21:25 UTC (rev 726) @@ -2,6 +2,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.render.RenderingContext; import org.apache.maven.doxia.site.decoration.DecorationModel; import org.apache.maven.doxia.site.decoration.Menu; @@ -16,8 +17,10 @@ import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.context.Context; import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.velocity.VelocityComponent; +import org.dom4j.Document; import java.io.File; import java.io.FileNotFoundException; @@ -39,8 +42,7 @@ * * @author jpages <pages@codelutin.com> * @author tchemit <chemit@codelutin.com> - * @version $Id$ - * @since 1.0 + * @since 2.0 */ @Component(role = Renderer.class, hint = "default") public class JrstSiteRenderer extends DefaultSiteRenderer { @@ -62,6 +64,9 @@ protected boolean verbose; + @Requirement(role = Parser.class, hint = "jrst", optional = true) + protected AbstractJrstParser jrstParser; + @Override public void render(Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, @@ -121,13 +126,13 @@ SiteRenderingContext context) throws RendererException, FileNotFoundException, UnsupportedEncodingException { - if (JrstDoxiaTool.JRST_PARSER_ID.equals(renderingContext.getParserId())) { + if (AbstractJrstParser.JRST_PARSER_ID.equals(renderingContext.getParserId())) { // let's keep the current rendering context into the JrstParser // to be able to have the document name to parse - JrstDoxiaTool.setRenderingContext(renderingContext); - JrstDoxiaTool.setMavenProject(mavenProject); - JrstDoxiaTool.setVerbose(verbose); + jrstParser.setRenderingContext(renderingContext); + jrstParser.setMavenProject(mavenProject); + jrstParser.setVerbose(verbose); } super.renderDocument(writer, renderingContext, context); @@ -197,8 +202,11 @@ // Define the output file File fileOut = new File(outputDirectory, pdfFilename); + Document doc = jrstParser.getStrategy().generateRstToXml( + fileOut, inputEncoding); + // Generate the pdf file - JRST.generate("pdf", pdfDoc, fileOut, JRST.Overwrite.ALLTIME, false); + JRST.generatePdf(pdfDoc, fileOut, JRST.Overwrite.ALLTIME, doc); } } catch (Exception e) { Copied: trunk/jrst-site-util/src/main/plexus/components.xml (from rev 724, trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml) =================================================================== --- trunk/jrst-site-util/src/main/plexus/components.xml (rev 0) +++ trunk/jrst-site-util/src/main/plexus/components.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Maven Nuiton Skin + + $Id$ + $HeadURL: http://svn.nuiton.org/svn/maven-nuiton-skin/trunk/src/main/resources/META-IN... $ + %% + Copyright (C) 2006 - 2011 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<component-set> + <components> + <component> + <role>org.apache.maven.doxia.siterenderer.Renderer</role> + <role-hint>default</role-hint> + <implementation>org.nuiton.jrst.JrstSiteRenderer</implementation> + <requirements> + <!--requirement> + <role>org.apache.maven.doxia.parser.Parser</role> + <field-name>jrstParser</field-name> + <role-hint>jrst</role-hint> + </requirement--> + <requirement> + <role>org.apache.maven.doxia.tools.SiteTool</role> + <field-name>siteTool</field-name> + <role-hint>default</role-hint> + </requirement> + <requirement> + <role>org.codehaus.plexus.velocity.VelocityComponent</role> + <field-name>velocity</field-name> + <role-hint>doxia-default</role-hint> + </requirement> + <requirement> + <role>org.apache.maven.doxia.module.site.manager.SiteModuleManager</role> + <field-name>siteModuleManager</field-name> + </requirement> + <requirement> + <role>org.apache.maven.doxia.Doxia</role> + <field-name>doxia</field-name> + </requirement> + <requirement> + <role>org.codehaus.plexus.i18n.I18N</role> + <field-name>i18n</field-name> + </requirement> + </requirements> + </component> + </components> +</component-set> Property changes on: trunk/jrst-site-util/src/main/plexus/components.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml =================================================================== --- trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - Maven Nuiton Skin - - $Id$ - $HeadURL: http://svn.nuiton.org/svn/maven-nuiton-skin/trunk/src/main/resources/META-IN... $ - %% - Copyright (C) 2006 - 2011 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<component-set> - <components> - <component> - <role>org.apache.maven.doxia.siterenderer.Renderer</role> - <role-hint>default</role-hint> - <implementation>org.nuiton.jrst.JrstSiteRenderer</implementation> - <requirements> - <requirement> - <role>org.apache.maven.doxia.tools.SiteTool</role> - <field-name>siteTool</field-name> - <role-hint>default</role-hint> - </requirement> - <requirement> - <role>org.codehaus.plexus.velocity.VelocityComponent</role> - <field-name>velocity</field-name> - <role-hint>doxia-default</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.doxia.module.site.manager.SiteModuleManager</role> - <field-name>siteModuleManager</field-name> - </requirement> - <requirement> - <role>org.apache.maven.doxia.Doxia</role> - <field-name>doxia</field-name> - </requirement> - <requirement> - <role>org.codehaus.plexus.i18n.I18N</role> - <field-name>i18n</field-name> - </requirement> - </requirements> - </component> - </components> -</component-set> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-06-29 20:13:54 UTC (rev 725) +++ trunk/pom.xml 2012-06-29 23:21:25 UTC (rev 726) @@ -233,6 +233,12 @@ <dependency> <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + <version>${mavenVersion}</version> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> <version>${mavenVersion}</version> <scope>provided</scope> @@ -261,6 +267,57 @@ <dependency> <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-logging-api</artifactId> + <version>${doxiaVersion}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-decoration-model</artifactId> + <version>1.2</version> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-api</artifactId> + <version>1.0-alpha-30</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + <version>1.0-alpha-30</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.5</version> + </dependency> + + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4</version> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-velocity</artifactId> + <version>1.1.7</version> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-i18n</artifactId> + <version>1.0-beta-7</version> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> <type>test-jar</type> <version>${doxiaVersion}</version>