r675 - in branches/jrst-docutils-jython: . docutils doxia-module-jrst doxia-module-jrst/src/license doxia-module-jrst/src/main/java/org/nuiton/jrst doxia-module-jrst/src/test/java/org/nuiton/jrst jrst jrst/src/license jrst/src/main/java/org/dom4j jrst/src/main/java/org/nuiton/jrst jrst/src/main/java/org/nuiton/jrst/convertisor jrst/src/test/java/org/nuiton/jrst jrst/src/test/java/org/nuiton/jrst/bugs jrst-doc jrst-doc/src/site
Author: sletellier Date: 2012-05-25 11:30:55 +0200 (Fri, 25 May 2012) New Revision: 675 Url: http://nuiton.org/repositories/revision/jrst/675 Log: - Up to mavenpom 3.3.1 - Up all dependencies versions - Optimize imports - Remove unused dependencies - Remove unused classes - Update third party - Refactor JRST generate methods - Fill some javadoc Removed: branches/jrst-docutils-jython/docutils/docutils.iml branches/jrst-docutils-jython/jrst/src/main/java/org/dom4j/io/ Modified: branches/jrst-docutils-jython/doxia-module-jrst/pom.xml branches/jrst-docutils-jython/doxia-module-jrst/src/license/THIRD-PARTY.properties branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java branches/jrst-docutils-jython/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java branches/jrst-docutils-jython/jrst-doc/pom.xml branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml branches/jrst-docutils-jython/jrst/pom.xml branches/jrst-docutils-jython/jrst/src/license/THIRD-PARTY.properties branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/DocumentWalker.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTGenerator.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTResourceResolver.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTUserAgent.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/convertisor/DocUtils2RST.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java branches/jrst-docutils-jython/pom.xml Deleted: branches/jrst-docutils-jython/docutils/docutils.iml =================================================================== --- branches/jrst-docutils-jython/docutils/docutils.iml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/docutils/docutils.iml 2012-05-25 09:30:55 UTC (rev 675) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/target/classes" /> - <output-test url="file://$MODULE_DIR$/target/test-classes" /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources/docutils" isTestSource="false" /> - <excludeFolder url="file://$MODULE_DIR$/target" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> - Modified: branches/jrst-docutils-jython/doxia-module-jrst/pom.xml =================================================================== --- branches/jrst-docutils-jython/doxia-module-jrst/pom.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/doxia-module-jrst/pom.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -79,11 +79,6 @@ </dependency> <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <scope>runtime</scope> Modified: branches/jrst-docutils-jython/doxia-module-jrst/src/license/THIRD-PARTY.properties =================================================================== --- branches/jrst-docutils-jython/doxia-module-jrst/src/license/THIRD-PARTY.properties 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/doxia-module-jrst/src/license/THIRD-PARTY.properties 2012-05-25 09:30:55 UTC (rev 675) @@ -4,27 +4,30 @@ # - Apache License # - BSD License # - BSD style +# - Bouncy Castle Licence +# - Bouncy Castle License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 # - Common Public License Version 1.0 +# - GNU Lesser General Public License (LGPL), version 2.1 # - Indiana University Extreme! Lab Software License, vesion 1.1.1 # - Lesser General Public License (LGPL) v 3.0 # - Lesser General Public License (LPGL) # - Lesser General Public License (LPGL) v 2.1 # - MIT License +# - Mozilla Public License # - Mozilla Public License Version 1.0 -# - Mozilla Public License version 1.1 # - The Apache Software License, Version 2.0 +# - The Jython License +# - The Werken Company License # - X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) # - http://classworlds.codehaus.org/license.html -# - http://jaxen.codehaus.org/license.html #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Fri Dec 16 17:05:07 CET 2011 +#Fri May 25 10:28:45 CEST 2012 com.ibm.icu--icu4j--2.6.1=X License (http\://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.html) commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD -jaxen--jaxen--1.1.1=http\://jaxen.codehaus.org/license.html jdom--jdom--1.0=The Apache Software License, Version 2.0 org.codehaus.plexus--plexus-classworlds--1.2-alpha-9=http\://classworlds.codehaus.org/license.html Modified: branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java =================================================================== --- branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,19 +25,15 @@ package org.nuiton.jrst; -import java.io.*; -import java.net.URL; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import java.io.File; +import java.io.FileWriter; +import java.io.Reader; +import java.io.StringReader; import org.apache.maven.doxia.module.xdoc.XdocParser; import org.apache.maven.doxia.parser.ParseException; import org.apache.maven.doxia.sink.Sink; import org.codehaus.plexus.util.IOUtil; import org.dom4j.Document; -import org.nuiton.util.FileUtil; -import org.nuiton.util.Resource; -import sun.nio.ch.FileKey; /** * Parse an RST model, transform it into xdoc model and emit events into the @@ -60,7 +56,7 @@ IOUtil.copy(source, fileWriter); // Generation of the xml file - Document doc = JRST.generateXML(sourceFile, JRST.TYPE_XDOC); + Document doc = JRST.generateDocutils(sourceFile); // Give xsl result to XDoc parser Reader reader = new StringReader(doc.asXML()); Modified: branches/jrst-docutils-jython/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java =================================================================== --- branches/jrst-docutils-jython/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,14 +25,13 @@ package org.nuiton.jrst; +import java.io.Reader; +import java.io.StringWriter; import org.apache.maven.doxia.AbstractModuleTest; import org.apache.maven.doxia.module.xdoc.XdocSink; import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.Sink; -import java.io.Reader; -import java.io.StringWriter; - /** * @author chatellier * @version $Revision : 1$ Modified: branches/jrst-docutils-jython/jrst/pom.xml =================================================================== --- branches/jrst-docutils-jython/jrst/pom.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/pom.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -50,26 +50,20 @@ </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> + <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> - <!--dependency> - <groupId>commons-primitives</groupId> - <artifactId>commons-primitives</artifactId> - </dependency--> <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> + <dependency> <groupId>org.nuiton.i18n</groupId> <artifactId>nuiton-i18n</artifactId> @@ -79,42 +73,39 @@ <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> </dependency> + <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <scope>runtime</scope> </dependency> - <!-- Apache FOP (Formatting Objects Processor) XSL-FO --> + <dependency> - <groupId>org.apache.xmlgraphics</groupId> - <artifactId>fop</artifactId> - </dependency> - <dependency> <groupId>net.sourceforge.saxon</groupId> <artifactId>saxon</artifactId> <scope>runtime</scope> </dependency> - <!-- <dependency> - <artifactId>xalan</artifactId> - <groupId>xalan</groupId> - </dependency> --> + <dependency> <groupId>net.sf.docbook</groupId> <artifactId>docbook-xsl</artifactId> <type>zip</type> <classifier>resources</classifier> </dependency> + <!-- Test librairies --> <dependency> <groupId>xmlunit</groupId> <artifactId>xmlunit</artifactId> <scope>test</scope> </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> + <dependency> <groupId>org.nuiton.thirdparty</groupId> <artifactId>sdoc</artifactId> @@ -210,7 +201,7 @@ <configuration> <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> <includeGroupIds>net.sf.docbook</includeGroupIds> - <includeArtifacIds>docbook-xsl</includeArtifacIds> + <includeArtifactIds>docbook-xsl</includeArtifactIds> <includeTypes>zip</includeTypes> <includeClassifiers>resources</includeClassifiers> <excludeTransitive>true</excludeTransitive> Modified: branches/jrst-docutils-jython/jrst/src/license/THIRD-PARTY.properties =================================================================== --- branches/jrst-docutils-jython/jrst/src/license/THIRD-PARTY.properties 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/license/THIRD-PARTY.properties 2012-05-25 09:30:55 UTC (rev 675) @@ -2,28 +2,31 @@ #------------------------------------------------------------------------------- # Already used licenses in project : # - BSD License +# - BSD style +# - Bouncy Castle License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 # - Common Public License Version 1.0 +# - GNU Lesser General Public License (LGPL), version 2.1 # - Indiana University Extreme! Lab Software License, vesion 1.1.1 # - Lesser General Public License (LGPL) v 3.0 # - Lesser General Public License (LPGL) # - Lesser General Public License (LPGL) v 2.1 # - MIT License # - MIT/X Consortium License +# - Mozilla Public License # - Mozilla Public License Version 1.0 -# - Mozilla Public License version 1.1 # - The Apache Software License, Version 2.0 +# - The Jython License +# - The Werken Company License # - X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) -# - http://jaxen.codehaus.org/license.html #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Thu Aug 18 07:17:49 CEST 2011 +#Fri May 25 10:25:29 CEST 2012 com.ibm.icu--icu4j--2.6.1=X License (http\://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.html) commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD -jaxen--jaxen--1.1.1=http\://jaxen.codehaus.org/license.html jdom--jdom--1.0=The Apache Software License, Version 2.0 net.sf.docbook--docbook-xsl--1.76.1=MIT/X Consortium License org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl=Lesser General Public License (LGPL) v 3.0 Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/DocumentWalker.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/DocumentWalker.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/DocumentWalker.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,6 +25,7 @@ package org.nuiton.jrst; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; @@ -32,8 +33,6 @@ import org.dom4j.Node; import org.dom4j.Text; -import java.util.List; - /** * DocumentWalker. * Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-05-25 09:30:55 UTC (rev 675) @@ -26,20 +26,27 @@ import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; -import java.io.*; +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.OutputStream; +import java.io.OutputStreamWriter; import java.net.URL; -import java.util.*; - +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.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; -import org.dom4j.io.MyDocumentInputSource; import org.nuiton.i18n.I18n; import org.nuiton.i18n.init.ClassPathI18nInitializer; import org.nuiton.jrst.convertisor.DocUtils2RST; @@ -77,7 +84,7 @@ public static final String BANG = "!"; - public static final String FILE_PREFIX = "file:"; + public static final String FILE_URI_PREFIX = "file:"; public enum Overwrite { NEVER, IFNEWER, ALLTIME @@ -87,23 +94,28 @@ protected static Log log = LogFactory.getLog(JRST.class); /** XSL Stylesheet to transform RST into HTML. */ - protected static final String rst2xhtml = "/xsl/rst2xhtml.xsl"; + protected static final String RST_2_XHTML = "/xsl/rst2xhtml.xsl"; + /** XSL Stylesheet to transform RST into HTML (but only inner body fragment). */ - protected static final String rst2xhtmlInnerBody = "/xsl/rst2xhtmlInnerBody.xsl"; + protected static final String XSL_RST_2_XHTML_INNER_BODY_XSL = "/xsl/rst2xhtmlInnerBody.xsl"; + /** XSL Stylesheet to transform RST into Xdoc. */ - protected static final String rst2xdoc = "/xsl/rst2xdoc.xsl"; + protected static final String RST_2_XDOC = "/xsl/rst2xdoc.xsl"; + /** XSL Stylesheet to transform RST into Docbook. */ - protected static final String rst2docbook = "/xsl/dn2dbk.xsl"; + protected static final String RST_2_DOCBOOK = "/xsl/dn2dbk.xsl"; /** XSL Stylesheet to transform Docbook into xHTML. */ - protected static final String docbook2xhtml = "/docbook/xhtml/docbook.xsl"; + protected static final String DOCBOOK_2_XHTML = "/docbook/xhtml/docbook.xsl"; + /** XSL Stylesheet to transform Docbook into javahelp. */ - protected static final String docbook2javahelp = "/docbook/javahelp/javahelp.xsl"; + protected static final String DOCBOOK_2_JAVAHELP = "/docbook/javahelp/javahelp.xsl"; + /** XSL Stylesheet to transform Docbook into htmlhelp. */ - protected static final String docbook2htmlhelp = "/docbook/htmlhelp/htmlhelp.xsl"; + protected static final String DOCBOOK_2_HTMLHELP = "/docbook/htmlhelp/htmlhelp.xsl"; /** XSL Stylesheet to transform Docbook into PDF. */ - protected static final String docbook2fo = "/docbook/fo/docbook.xsl"; + protected static final String DOCBOOK_2_FO = "/docbook/fo/docbook.xsl"; public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|htmlInnerBody|xdoc|rst|fo|pdf|odt|rtf"; @@ -154,17 +166,16 @@ static { stylesheets = new HashMap<String, String>(); - stylesheets.put(TYPE_HTML, rst2xhtml); - stylesheets.put(TYPE_HTML_INNER_BODY, rst2xhtmlInnerBody); - stylesheets.put(TYPE_XDOC, rst2xdoc); - stylesheets.put(TYPE_DOCBOOK, rst2docbook); - stylesheets.put(TYPE_XHTML, rst2docbook + "," + docbook2xhtml); - stylesheets.put(TYPE_JAVAHELP, rst2docbook + "," + docbook2javahelp); - stylesheets.put(TYPE_HTMLHELP, rst2docbook + "," + docbook2htmlhelp); + stylesheets.put(TYPE_HTML, RST_2_XHTML); + stylesheets.put(TYPE_HTML_INNER_BODY, XSL_RST_2_XHTML_INNER_BODY_XSL); + stylesheets.put(TYPE_XDOC, RST_2_XDOC); + stylesheets.put(TYPE_DOCBOOK, RST_2_DOCBOOK); + stylesheets.put(TYPE_XHTML, RST_2_DOCBOOK + "," + DOCBOOK_2_XHTML); + stylesheets.put(TYPE_JAVAHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_JAVAHELP); + stylesheets.put(TYPE_HTMLHELP, RST_2_DOCBOOK + "," + DOCBOOK_2_HTMLHELP); stylesheets.put(TYPE_RST, ""); - //stylesheets.put(TYPE_ODT, rst2docbook + "," + docbook2odf); - stylesheets.put(TYPE_FO, rst2docbook + "," + docbook2fo); - stylesheets.put(TYPE_PDF, rst2xhtml); + stylesheets.put(TYPE_FO, RST_2_DOCBOOK + "," + DOCBOOK_2_FO); + stylesheets.put(TYPE_PDF, RST_2_XHTML); mimeType = new HashMap<String, String>(); mimeType.put(TYPE_HTML, "text/html"); @@ -225,15 +236,14 @@ overwrite = Overwrite.ALLTIME; } - generateDocutils(xslList, inputFile, ouputFile, overwrite); + generate(xslList, inputFile, ouputFile, overwrite); } private static String[] askOption() throws SecurityException, - NoSuchMethodException, IOException { + NoSuchMethodException, IOException { String[] result = null; try { - GraphicsEnvironment ge = GraphicsEnvironment - .getLocalGraphicsEnvironment(); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); if (!(gs == null)) { if (gs.length > 0) { @@ -245,18 +255,17 @@ } return result; - } /** * Graphical user interface * - * @return + * @return command as string * @throws SecurityException * @throws NoSuchMethodException */ protected static String[] askOptionGraph() throws SecurityException, - NoSuchMethodException { + NoSuchMethodException { JRSTInterface graph = new JRSTInterface(PATTERN_TYPE); @@ -272,82 +281,112 @@ * @param overwrite The rule to overwrite file (NEVER, IFNEWER or ALLTIME ) * @throws Exception */ - public static void generateDocutils(String outputType, File fileIn, + public static void generate(String outputType, File fileIn, File fileOut, Overwrite overwrite) throws Exception { if (fileOut != null && fileOut.exists() && (overwrite == Overwrite.NEVER || (overwrite == Overwrite.IFNEWER && FileUtil .isNewer(fileIn, fileOut)))) { + log.info("Don't generate file " + fileOut + ", because already exists"); } else { - // Out - OutputStream outputStream = new FileOutputStream(fileOut); - // Generate XML - Document doc = generateXML(fileIn, outputType); + // Transformation to XML + Document doc = generateDocutils(fileIn); + // Application of xsl stylesheets + doc = generateXml(doc, outputType); + // generation PDF if (outputType.equals("pdf")) { - generatePdf(doc, fileIn, outputStream); + generatePdf(doc, fileIn, fileOut); } else { - generateFile(doc, outputStream); + generateFile(doc, fileOut); } } } + /** + * TODO ! + * + * + * @param in + * @return + * @throws Exception + */ + public static Document generateDocutils(File in) throws Exception { - public static void generateFile(Document doc, OutputStream outputStream) throws IOException { - // If the output file type si not "pdf", we can write in the final file - OutputStreamWriter writer = null; + ByteArrayOutputStream out = null; + try { - writer = new OutputStreamWriter(outputStream, UTF_8); + // Transformation to XML + out = new ByteArrayOutputStream(); - // write generated document - writer.write(doc.asXML()); - }catch (Exception eee) { - log.error("Failed to write file", eee); - } finally { - if (writer != null) { - writer.close(); + // 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); - public static void generatePdf(Document result, File fileIn, OutputStream outputStream) throws Exception { - try { - // Creation of the document builder - DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - builder.setEntityResolver(result.getEntityResolver()); + // Execution of the docutils script to transform rst to xml + String commandExec = String.format("__run__.exec_docutils('%s', '%s', '%s')", + docutilsPath, TYPE_XML, filePath); + interp.exec(commandExec); - // We must redifine our own DocumentInputSource because of the visibility - MyDocumentInputSource source = new MyDocumentInputSource(result); - org.w3c.dom.Document doc = builder.parse(source); + // Cleans the python interpreter to avoid problems if they are multiple execution of this method + interp.cleanup(); - ITextRenderer renderer = new ITextRenderer(); + // Transforms the output stream to a document + String xmlString = new String(out.toByteArray(), UTF_8); - // Settings to resolve paths with the JRST User Agent - String absolutePath = fileIn.getParentFile().getAbsolutePath(); - JRSTUserAgent jrstUserAgent = new JRSTUserAgent(absolutePath); - jrstUserAgent.setBaseURL(absolutePath); - renderer.getSharedContext().setUserAgentCallback(jrstUserAgent); - jrstUserAgent.setSharedContext(renderer.getSharedContext()); + Document doc = null; + try { + doc = DocumentHelper.parseText(xmlString); + } catch (DocumentException e) { + log.error("Error during the creation of the document", e); + } - // Generation of the pdf file - renderer.setDocument(doc, null); - renderer.layout(); - renderer.createPDF(outputStream); - } catch (Exception eee) { - log.error("Failed to write PDF", eee); + return doc; } finally { - outputStream.close(); + if (out != null) { + out.close(); + } } } + /** + * TODO ! + * + * @param doc + * @param xslListOrOutType + * @return + * @throws IOException + * @throws TransformerException + */ + public static Document generateXml(Document doc, String xslListOrOutType) throws IOException, TransformerException { - private static Document applyXsls(Document doc, String xslListOrOutType) throws IOException, TransformerException { - // search xsl file list to apply String xslList = stylesheets.get(xslListOrOutType); if (xslListOrOutType == null) { @@ -358,7 +397,7 @@ JRSTGenerator gen = new JRSTGenerator(); String[] xsls = StringUtil.split(xslList, ","); for (String xsl : xsls) { - URL stylesheet = null; + URL stylesheet; File file = new File(xsl); if (file.exists()) { stylesheet = file.toURI().toURL(); @@ -379,76 +418,90 @@ return doc; } - public static Document generateXML(File in, String outputType) throws Exception { - ByteArrayOutputStream out = null; - Document doc = null; + /** + * TODO ! + * + * @param doc + * @param fileOut + * @throws IOException + */ + public static void generateFile(Document doc, File fileOut) throws IOException { + // Out + OutputStreamWriter writer = null; + try { - // Transformation to XML - out = new ByteArrayOutputStream(); - doc = generateDocument(TYPE_XML, in, out); + OutputStream outputStream = new FileOutputStream(fileOut); - // Application of xsl stylesheets - doc = applyXsls(doc, outputType); + // If the output file type si not "pdf", we can write in the final file + writer = new OutputStreamWriter(outputStream, UTF_8); + + // write generated document + writer.write(doc.asXML()); + }catch (Exception eee) { + log.error("Failed to write file", eee); } finally { - if ( out != null) { - out.close(); + if (writer != null) { + writer.close(); } } - - return doc; } + /** + * TODO ! + * + * @param result + * @param fileIn + * @param fileOut + * @throws Exception + */ + public static void generatePdf(Document result, File fileIn, File fileOut) throws Exception { - public static Document generateDocument(String outputType, File in, ByteArrayOutputStream out) throws Exception { - /* 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_PREFIX, ""); + // Out + OutputStream outputStream = null; - // Import of the main script to use docutils ( __run__ ) - PythonInterpreter interp = new PythonInterpreter(); - String commandImport = IMPORT_SCRIPT; - interp.exec(commandImport); + try { + outputStream = new FileOutputStream(fileOut); - // 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("\\\\", "\\\\\\\\"); - } + // Creation of the document builder + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + builder.setEntityResolver(result.getEntityResolver()); - // Sets an output stream in the python interpreter and executes the code - interp.setOut(out); + // We must redifine our own DocumentInputSource because of the visibility + ByteArrayInputStream inputStream = new ByteArrayInputStream(result.asXML().getBytes()); + org.w3c.dom.Document doc = builder.parse(inputStream); - // Execution of the docutils script to transform rst to xml - String commandExec = String.format("__run__.exec_docutils('%s', '%s', '%s')", - docutilsPath, outputType, filePath); - interp.exec(commandExec); + ITextRenderer renderer = new ITextRenderer(); - // Cleans the python interpreter to avoid problems if they are multiple execution of this method - interp.cleanup(); + // Settings to resolve paths with the JRST User Agent + String absolutePath = fileIn.getParentFile().getAbsolutePath(); + JRSTUserAgent jrstUserAgent = new JRSTUserAgent(absolutePath); + jrstUserAgent.setBaseURL(absolutePath); + renderer.getSharedContext().setUserAgentCallback(jrstUserAgent); + jrstUserAgent.setSharedContext(renderer.getSharedContext()); - // Transforms the output stream to a document - String xmlString = new String(out.toByteArray(), UTF_8); - Document doc = null; - try { - doc = DocumentHelper.parseText(xmlString); - } catch (DocumentException e) { - log.error("Error during the creation of the document", e); + // Generation of the pdf file + renderer.setDocument(doc, null); + renderer.layout(); + renderer.createPDF(outputStream); + } catch (Exception eee) { + log.error("Failed to write PDF", eee); + } finally { + if (outputStream != null) { + outputStream.close(); + } } - - return doc; } - + /** + * Method used to generate rst document + * <br/> + * <b>WARN : don't work !</b> + * + * @param doc docutils document to generate + * @return rst document + * @throws IOException + */ public static String generateRST(Document doc) throws IOException { // Creation d'un visitor qui convertie de l'xml vers le rst DocUtilsVisitor visitor = new DocUtils2RST(); Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java 2012-05-25 09:30:55 UTC (rev 675) @@ -26,7 +26,6 @@ package org.nuiton.jrst; import java.util.Properties; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.ApplicationConfig; Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,11 +25,11 @@ package org.nuiton.jrst; +import org.nuiton.util.ApplicationConfig.ActionDef; + import static org.nuiton.i18n.I18n._; import static org.nuiton.i18n.I18n.n_; -import org.nuiton.util.ApplicationConfig.ActionDef; - /** * JRST actions. * Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,14 +25,13 @@ package org.nuiton.jrst; -import static org.nuiton.i18n.I18n._; -import static org.nuiton.i18n.I18n.n_; - import java.io.File; - import org.nuiton.util.ApplicationConfig; import org.nuiton.util.ApplicationConfig.OptionDef; +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + /** * JRST options enum. * Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTGenerator.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTGenerator.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTGenerator.java 2012-05-25 09:30:55 UTC (rev 675) @@ -26,6 +26,28 @@ package org.nuiton.jrst; +import java.io.IOException; +import java.io.Writer; +import java.net.URL; +import java.util.LinkedList; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.URIResolver; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.Text; +import org.dom4j.io.DocumentResult; +import org.dom4j.io.DocumentSource; +import org.nuiton.util.FasterCachedResourceResolver; +import org.xml.sax.ContentHandler; + import static org.nuiton.jrst.ReStructuredText.ADDRESS; import static org.nuiton.jrst.ReStructuredText.AUTHOR; import static org.nuiton.jrst.ReStructuredText.AUTHORS; @@ -57,30 +79,6 @@ import static org.nuiton.jrst.ReStructuredText.TRANSITION; import static org.nuiton.jrst.ReStructuredText.VERSION; -import java.io.IOException; -import java.io.Writer; -import java.net.URL; -import java.util.LinkedList; - -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.URIResolver; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.dom4j.Document; -import org.dom4j.Element; -import org.dom4j.Node; -import org.dom4j.Text; -import org.dom4j.io.DocumentResult; -import org.dom4j.io.DocumentSource; -import org.nuiton.util.FasterCachedResourceResolver; -import org.xml.sax.ContentHandler; - /** * Cette classe contient plusieurs methodes pour générer, soit en utilisant une * feuille de style {@link #generate(Document, URL, Writer)}, soit un @@ -90,7 +88,7 @@ * cas il faut passer un {@link Writer} en parametre du constructeur. * <p> * On peut aussi transformer le {@link Document} en un autre {@link Document} - * avec {@link #transform(Document, URL, String...)} + * avec {@link #transform(Document, URL)} * * Created: 30 oct. 06 00:14:18 * @@ -140,8 +138,8 @@ /** * Generate using this class as handler, this generate RST text to out * passed in constructor - * - * @param doc + * + * @param doc document to transform * @throws IOException */ public void generate(Document doc) throws IOException { @@ -156,8 +154,8 @@ /** * Generate using handler passed in argument * - * @param doc - * @param handler + * @param doc document + * @param handler saxon content handler * @throws IOException * @throws TransformerException */ @@ -178,9 +176,9 @@ /** * Used writer passed in construction class - * - * @param doc - * @param stylesheet + * + * @param doc document to transform + * @param stylesheet to apply * @throws IOException * @throws TransformerException */ @@ -191,10 +189,10 @@ /** * Generate out from document using stylesheet - * - * @param doc - * @param stylesheet - * @param out + * + * @param doc document to transform + * @param stylesheet to apply + * @param out output * @throws IOException * @throws TransformerException */ @@ -221,14 +219,13 @@ /** * Transform doc in another XML document. * - * @param doc - * @param stylesheet - * @param args + * @param doc document to transform + * @param stylesheet to apply * @return the transformed document * @throws TransformerException * @throws IOException */ - public Document transform(Document doc, URL stylesheet, String... args) + public Document transform(Document doc, URL stylesheet) throws TransformerException, IOException { if (log.isInfoEnabled()) { @@ -292,7 +289,7 @@ * Determine la longueur du text dans l'element * <emphasis<>toto</emphasis<> qui donne *toto* retournera 6 * - * @param e + * @param e element * @return la longueur du text dans l'element. */ @SuppressWarnings("unchecked") Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,8 +25,6 @@ package org.nuiton.jrst; -import static org.nuiton.i18n.I18n._; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; @@ -36,7 +34,6 @@ import java.awt.event.ActionListener; import java.io.File; import java.util.LinkedList; - import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; @@ -51,9 +48,10 @@ import javax.swing.JTextField; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; - import org.nuiton.util.Resource; +import static org.nuiton.i18n.I18n._; + /** * JRST main interface. * @@ -127,7 +125,7 @@ /** * le parametre initialise les options disponibles * - * @param o + * @param o option */ public JRSTInterface(String o) { @@ -529,14 +527,12 @@ } else { if (!ecrase) { File file = new File(getSaveText().getText()); - if (file != null) { - if (file.exists()) { - int choix = askEcraser(); - if (choix == JOptionPane.YES_OPTION) - ecrase = true; - else if (choix == JOptionPane.NO_OPTION) - exit = true; - } + if (file.exists()) { + int choix = askEcraser(); + if (choix == JOptionPane.YES_OPTION) + ecrase = true; + else if (choix == JOptionPane.NO_OPTION) + exit = true; } } if (!exit) { Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTResourceResolver.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTResourceResolver.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTResourceResolver.java 2012-05-25 09:30:55 UTC (rev 675) @@ -24,6 +24,16 @@ */ package org.nuiton.jrst; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.Source; +import javax.xml.transform.sax.SAXSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.FasterCachedResourceResolver; @@ -33,17 +43,6 @@ import org.xml.sax.SAXException; import org.xml.sax.XMLReader; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.Source; -import javax.xml.transform.sax.SAXSource; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - /** * @author sletellier <letellier@codelutin.com> * @since 1.5 @@ -79,7 +78,7 @@ } try { - InputStream stream = null; + InputStream stream; File file = new File(resouceFullName); if (file.exists()) { stream = new FileInputStream(file); Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTUserAgent.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTUserAgent.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/JRSTUserAgent.java 2012-05-25 09:30:55 UTC (rev 675) @@ -1,6 +1,34 @@ +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2012 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 com.lowagie.text.Image; +import java.io.File; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.xhtmlrenderer.extend.UserAgentCallback; @@ -10,19 +38,12 @@ import org.xhtmlrenderer.resource.ImageResource; import org.xhtmlrenderer.resource.XMLResource; import org.xhtmlrenderer.swing.NaiveUserAgent; -import org.xhtmlrenderer.util.XRLog; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; - /** - * Created with IntelliJ IDEA. - * User: jpages - * Date: 22/05/12 - * Time: 17:38 - * To change this template use File | Settings | File Templates. + * Class used to resolv images path for JRST documents for itext PDF generation + * + * @author jerome pages <jpages@codelutin.com> + * @since 1.6 */ public class JRSTUserAgent implements UserAgentCallback { Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/convertisor/DocUtils2RST.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/convertisor/DocUtils2RST.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/convertisor/DocUtils2RST.java 2012-05-25 09:30:55 UTC (rev 675) @@ -29,10 +29,9 @@ import org.apache.commons.logging.LogFactory; import org.dom4j.Element; -import static org.nuiton.jrst.ReStructuredText.TITLE_CHAR; - import static org.nuiton.jrst.ReStructuredText.PARAGRAPH; import static org.nuiton.jrst.ReStructuredText.TITLE; +import static org.nuiton.jrst.ReStructuredText.TITLE_CHAR; /** * Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -25,29 +25,17 @@ package org.nuiton.jrst; -import java.io.*; +import java.io.File; import java.util.Arrays; import java.util.List; - import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Fop; -import org.apache.fop.apps.FopFactory; -import org.apache.fop.apps.MimeConstants; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.nuiton.util.Resource; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamSource; - /** * * @author chemit @@ -64,15 +52,15 @@ */ @Test public void testResources() { - Assert.assertNotNull(Resource.getURL(JRST.rst2xhtml)); - Assert.assertNotNull(Resource.getURL(JRST.rst2xdoc)); - Assert.assertNotNull(Resource.getURL(JRST.rst2docbook)); - Assert.assertNotNull(Resource.getURL(JRST.docbook2xhtml)); - Assert.assertNotNull(Resource.getURL(JRST.docbook2javahelp)); - Assert.assertNotNull(Resource.getURL(JRST.docbook2htmlhelp)); + Assert.assertNotNull(Resource.getURL(JRST.RST_2_XHTML)); + Assert.assertNotNull(Resource.getURL(JRST.RST_2_XDOC)); + Assert.assertNotNull(Resource.getURL(JRST.RST_2_DOCBOOK)); + Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_XHTML)); + Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_JAVAHELP)); + Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_HTMLHELP)); //FIXME echatellier 20110217 following assert fails //Assert.assertNotNull(Resource.getURL(JRST.docbook2odf)); - Assert.assertNotNull(Resource.getURL(JRST.docbook2fo)); + Assert.assertNotNull(Resource.getURL(JRST.DOCBOOK_2_FO)); } @Ignore @@ -114,7 +102,7 @@ File out = new File(testWorkDir, "toRst1-out.rst"); - JRST.generateDocutils(JRST.TYPE_RST, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_RST, in, out, JRST.Overwrite.ALLTIME); List<?> readLines = FileUtils.readLines(out); log.info(OUT_LINES); @@ -133,6 +121,6 @@ File in = getTestFile("text.rst"); File out = getOutputTestFile("jrst-RstToXml.xml"); - JRST.generateDocutils(JRST.TYPE_XML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_XML, in, out, JRST.Overwrite.ALLTIME); } } \ No newline at end of file Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -56,7 +56,7 @@ File in = getBugTestFile("testAdminitionInList1787.rst"); File out = getOutputTestFile("jrst-testAdminitionInList1787.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); // Must contains <div class="note"> Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -54,7 +54,7 @@ File in = getBugTestFile("testImages21.rst"); File out = getOutputTestFile("jrst-testImages.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("alt=\"alternate text\"") > 0); @@ -76,7 +76,7 @@ File in = getBugTestFile("testContent877.rst"); File out = getOutputTestFile("jrst-testContent.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("Table des matières") > 0); @@ -92,7 +92,7 @@ File in = getBugTestFile("testContents.rst"); File out = getOutputTestFile("jrst-testContents.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("<b>") > 0); Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -52,7 +52,7 @@ public void testOptionArgumentSizeInList() throws Exception { File in = getBugTestFile("testOptionArgumentSize1788.rst"); File out = getOutputTestFile("jrst-testOptionArgumentSize1788.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); } } Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -54,7 +54,7 @@ File in = getBugTestFile("testTable1290.rst"); File out = getOutputTestFile("jrst-tables.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("Annee|Trait|Espece") > 0); @@ -71,7 +71,7 @@ File in = getBugTestFile("testTable1375.rst"); File out = getOutputTestFile("jrst-tables.html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("<em>légérs</em>") > 0); Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -56,7 +56,7 @@ File in = getBugTestFile("testLinks.rst"); File out = getOutputTestFile("jrst-testLinks.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("href=\"http://labs.libre-entreprise.org/tracker/?atid=113&group_id=8&func=browse\"") > 0); @@ -75,7 +75,7 @@ File in = getBugTestFile("testLinks1380.rst"); File out = getOutputTestFile("jrst-testLinks.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("nuiton's forge") > 0); @@ -93,7 +93,7 @@ File in = getBugTestFile("testTab1378.rst"); File out = getOutputTestFile("jrst-testTab1378.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); Pattern pattern = Pattern.compile(".*<blockquote>.*du bla bla \u00E9l\u00E9mentaire.*</blockquote>.*", Pattern.DOTALL); @@ -110,7 +110,7 @@ File in = getBugTestFile("testOptionsList644.rst"); File out = getOutputTestFile("jrst-testOptionList644.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("<span class=\"option\">-a</span>") > 0); @@ -133,7 +133,7 @@ File in = getBugTestFile("testLinks.rst"); File out = getOutputTestFile("jrst-testLinks.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.indexOf("echapement de lien1_") > 0); @@ -148,7 +148,7 @@ File in = getBugTestFile("testEmbeddedURIs.rst"); File out = getOutputTestFile("jrst-testEmbeddedURIs.html"); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); assertTrue(content.contains("href=\"http://www.python.org\"")); Modified: branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java 2012-05-25 09:30:55 UTC (rev 675) @@ -1,23 +1,21 @@ /* * #%L - * - * * $Id$ * $HeadURL$ * %% * Copyright (C) 2011 Codelutin, Chatellier Eric * %% * 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 + * 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 + * + * 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% @@ -54,7 +52,7 @@ File in = new File("src/test/resources/bugs/testNoSubtitle.rst"); File out = File.createTempFile("jrst-RstToHtml2", ".html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); } /** @@ -68,7 +66,7 @@ File in = new File("src/test/resources/bugs/testNoContentSubtitles.rst"); File out = File.createTempFile("jrst-testNoContentSubtitles", ".html"); // out.deleteOnExit(); - JRST.generateDocutils(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out, JRST.UTF_8); Assert.assertTrue(content.indexOf("<h2>Prérequis</h2>") > 0); Modified: branches/jrst-docutils-jython/jrst-doc/pom.xml =================================================================== --- branches/jrst-docutils-jython/jrst-doc/pom.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst-doc/pom.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -78,27 +78,7 @@ </executions> </plugin> </plugins> - <!--pluginManagement> - <plugins> - <plugin> - <artifactId>maven-site-plugin</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>doxia-module-jrst</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <executions> - <execution> - <id>default-site</id> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement--> - </build> <!-- ************************************************************* --> Modified: branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml =================================================================== --- branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst-doc/src/site/site_en.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -26,19 +26,19 @@ <project name="${project.name}"> <skin> - <groupId>org.apache.maven.skins</groupId> - <artifactId>maven-fluido-skin</artifactId> - <version>1.2.1</version> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>1.2.1</version> </skin> <custom> - <fluidoSkin> - <topBarEnabled>true</topBarEnabled> - <googleSearch/> - <sideBarEnabled>false</sideBarEnabled> - <searchEnabled>true</searchEnabled> - <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> - </fluidoSkin> + <fluidoSkin> + <topBarEnabled>true</topBarEnabled> + <googleSearch/> + <sideBarEnabled>false</sideBarEnabled> + <searchEnabled>true</searchEnabled> + <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> + </fluidoSkin> </custom> <poweredBy> Modified: branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml =================================================================== --- branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/jrst-doc/src/site/site_fr.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -27,19 +27,19 @@ <project name="${project.name}"> <skin> - <groupId>org.apache.maven.skins</groupId> - <artifactId>maven-fluido-skin</artifactId> - <version>1.2.1</version> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>1.2.1</version> </skin> <custom> - <fluidoSkin> - <topBarEnabled>true</topBarEnabled> - <googleSearch/> - <sideBarEnabled>false</sideBarEnabled> - <searchEnabled>true</searchEnabled> - <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> - </fluidoSkin> + <fluidoSkin> + <topBarEnabled>true</topBarEnabled> + <googleSearch/> + <sideBarEnabled>false</sideBarEnabled> + <searchEnabled>true</searchEnabled> + <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> + </fluidoSkin> </custom> <poweredBy> Modified: branches/jrst-docutils-jython/pom.xml =================================================================== --- branches/jrst-docutils-jython/pom.xml 2012-05-24 16:06:42 UTC (rev 674) +++ branches/jrst-docutils-jython/pom.xml 2012-05-25 09:30:55 UTC (rev 675) @@ -33,7 +33,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom4redmineAndCentral</artifactId> - <version>3.2</version> + <version>3.3.1</version> </parent> <artifactId>jrst</artifactId> @@ -236,7 +236,7 @@ <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> - <version>1.1.1</version> + <version>1.1.3</version> <scope>runtime</scope> <exclusions> <exclusion> @@ -248,9 +248,17 @@ <artifactId>xmlParserAPIs</artifactId> </exclusion> <exclusion> + <groupId>xalan</groupId> <artifactId>xalan</artifactId> - <groupId>xalan</groupId> </exclusion> + <exclusion> + <groupId>maven-plugins</groupId> + <artifactId>maven-cobertura-plugin</artifactId> + </exclusion> + <exclusion> + <groupId>maven-plugins</groupId> + <artifactId>maven-findbugs-plugin</artifactId> + </exclusion> </exclusions> </dependency> @@ -322,7 +330,7 @@ <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> - <version>2.0.8</version> + <version>2.1.7</version> </dependency> @@ -396,8 +404,8 @@ <siteSourcesType>apt</siteSourcesType> - <doxiaVersion>1.1.4</doxiaVersion> - <nuitonUtilsVersion>2.2</nuitonUtilsVersion> + <doxiaVersion>1.3</doxiaVersion> + <nuitonUtilsVersion>2.4.8</nuitonUtilsVersion> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> <xalanVersion>2.7.1</xalanVersion>
participants (1)
-
sletellier@users.nuiton.org