Author: tchemit Date: 2012-06-29 22:05:59 +0200 (Fri, 29 Jun 2012) New Revision: 724 Url: http://nuiton.org/repositories/revision/jrst/724 Log: fixes Evolution #2130: New GUI for JRST with Jaxx fixes Evolution #2139: Improve RST generation mecanism Added: trunk/jrst-site-util/ trunk/jrst-site-util/LICENSE.txt trunk/jrst-site-util/README.txt trunk/jrst-site-util/changelog.txt trunk/jrst-site-util/pom.xml trunk/jrst-site-util/src/ trunk/jrst-site-util/src/license/ trunk/jrst-site-util/src/license/THIRD-PARTY.properties trunk/jrst-site-util/src/main/ trunk/jrst-site-util/src/main/java/ trunk/jrst-site-util/src/main/java/org/ trunk/jrst-site-util/src/main/java/org/nuiton/ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ReflectUtil.java trunk/jrst-site-util/src/main/resources/ trunk/jrst-site-util/src/main/resources/META-INF/ trunk/jrst-site-util/src/main/resources/META-INF/maven/ trunk/jrst-site-util/src/main/resources/META-INF/maven/RstAggregation.vm trunk/jrst-site-util/src/main/resources/META-INF/plexus/ trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml trunk/jrst-site-util/src/main/resources/jrst-site-renderer.properties trunk/jrst-site-util/src/main/resources/jrst-site-renderer_en.properties trunk/jrst-site-util/src/main/resources/jrst-site-renderer_fr.properties trunk/jrst-site-util/src/site/ trunk/jrst-site-util/src/site/apt/ trunk/jrst-site-util/src/site/apt/devel.apt trunk/jrst-site-util/src/site/apt/index.apt trunk/jrst-site-util/src/site/en/ trunk/jrst-site-util/src/site/en/apt/ trunk/jrst-site-util/src/site/en/apt/devel.apt trunk/jrst-site-util/src/site/en/apt/index.apt trunk/jrst-site-util/src/site/site_en.xml trunk/jrst-site-util/src/site/site_fr.xml trunk/jrst-site-util/src/test/ trunk/jrst-site-util/src/test/java/ trunk/jrst-site-util/src/test/java/org/ trunk/jrst-site-util/src/test/java/org/nuiton/ trunk/jrst-site-util/src/test/java/org/nuiton/jrst/ trunk/jrst-site-util/src/test/resources/ Removed: trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/ReflectUtil.java trunk/doxia-module-jrst/src/main/resources/META-INF/ Modified: trunk/docutils/pom.xml trunk/doxia-module-jrst-legacy/pom.xml trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java trunk/doxia-module-jrst/pom.xml trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java trunk/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java trunk/jrst-doc/pom.xml trunk/jrst/pom.xml trunk/pom.xml Modified: trunk/docutils/pom.xml =================================================================== (Binary files differ) Modified: trunk/doxia-module-jrst/pom.xml =================================================================== --- trunk/doxia-module-jrst/pom.xml 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -2,11 +2,8 @@ <!-- #%L JRst :: Doxia module - - $Id$ - $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2012 CodeLutin, Chemit tony %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -24,7 +21,9 @@ #L% --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -57,6 +56,12 @@ </dependency> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jrst-site-util</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-module-xdoc</artifactId> </dependency> @@ -107,6 +112,11 @@ <dependency> <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-annotations</artifactId> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> </dependency> @@ -122,17 +132,6 @@ <developers> <developer> - <name>Eric Chatellier</name> - <id>echatellier</id> - <email>chatellier@codelutin.com - </email> - <organization>CodeLutin</organization> - <timezone>+2</timezone> - <roles> - <role>Développeur</role> - </roles> - </developer> - <developer> <name>Tony Chemit</name> <id>tchemit</id> <email>chemit@codelutin.com @@ -145,27 +144,21 @@ </developer> </developers> - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - <packaging>jar</packaging> - <build> <plugins> - <!-- Fix me merge descriptor --> - <!--plugin> + <plugin> <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-maven-plugin</artifactId> - <version>1.3.8</version> + <artifactId>plexus-component-metadata</artifactId> <executions> <execution> + <id>generate</id> <goals> - <goal>descriptor</goal> + <goal>generate-metadata</goal> </goals> </execution> </executions> - </plugin--> + </plugin> </plugins> </build> 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-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 20:05:59 UTC (rev 724) @@ -25,26 +25,29 @@ package org.nuiton.jrst; -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.parser.Parser; import org.apache.maven.doxia.sink.Sink; -import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.component.annotations.Component; import org.dom4j.Document; +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. - * + * * @author <a href="mailto:chatellier@codelutin.com">Eric Chatellier</a> * @version $Id$ - * @since 0.9.0 - * @plexus.component role="org.apache.maven.doxia.parser.Parser" role-hint="jrst" + * @since 2.0 */ +@Component(role = Parser.class, hint = "jrst", + 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 { @Override @@ -52,10 +55,7 @@ try { // Write the source in a file to use it with JRST - File sourceFile = File.createTempFile("source",".rst"); - // sourceFile.deleteOnExit(); - FileWriter fileWriter = new FileWriter(sourceFile); - IOUtil.copy(source, fileWriter); + File sourceFile = JrstDoxiaTool.prepareSourceFile(getLog(), source); // Generation of the xml file Document doc = JRST.generateDocutils(sourceFile); @@ -68,6 +68,9 @@ super.parse(reader, sink); } catch (Exception e) { throw new ParseException("Can't parse rst file", e); + } finally { + + JrstDoxiaTool.clear(); } } Modified: 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-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 20:05:59 UTC (rev 724) @@ -26,17 +26,19 @@ 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> + * @author jpages (pages@codelutin.com) * @version $Id$ - * @since 0.9.0 - * @plexus.component role="org.apache.maven.doxia.module.site.SiteModule" role-hint="jrst" + * @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"; @@ -49,6 +51,6 @@ @Override public String getParserId() { - return "jrst"; + return JrstDoxiaTool.JRST_PARSER_ID; } } Deleted: trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java =================================================================== --- trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java 2012-06-29 20:05:59 UTC (rev 724) @@ -1,241 +0,0 @@ -package org.nuiton.jrst; - -import java.io.FileNotFoundException; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.maven.doxia.sink.render.RenderingContext; -import org.apache.maven.doxia.site.decoration.DecorationModel; -import org.apache.maven.doxia.site.decoration.Menu; -import org.apache.maven.doxia.site.decoration.MenuItem; -import org.apache.maven.doxia.siterenderer.DefaultSiteRenderer; -import org.apache.maven.doxia.siterenderer.DocumentRenderer; -import org.apache.maven.doxia.siterenderer.RendererException; -import org.apache.maven.doxia.siterenderer.SiteRenderingContext; -import org.apache.maven.project.MavenProject; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.context.Context; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.Locale; -import java.util.Map; -import org.codehaus.plexus.velocity.VelocityComponent; -import org.apache.commons.io.FileUtils; -/** - * Override of the DefaultSiteRenderer to add pdf generation of the site. - * - * @author jpages <j.pages@codelutin.com> - * @version $Id: JrstSiteRenderer.java 663 2012-03-22 09:14:39Z tchemit $ - * @plexus.component role-hint="default" role="org.apache.maven.doxia.siterenderer.Renderer" - * @since 1.0 - */ -public class JrstSiteRenderer extends DefaultSiteRenderer { - - - static public final String DOC_NAME_EN = "JRST documentation"; - static public final String CONTENT_EN = "Table of content"; - static public final String FILE_NAME_EN = "DocumentationJRST.pdf"; - static public final String DOC_NAME_FR = "Documentation JRST"; - static public final String CONTENT_FR = "Sommaire"; - static public final String FILE_NAME_FR = "DocumentationJRST.pdf"; - - protected static Log log = LogFactory.getLog(JrstSiteRenderer.class); - - /** - * SiteTool. - * - * @component - */ - public Locale locale; - - public MavenProject mavenProject; - - public boolean pdfGenerationEnabled; - - public HashMap<String, String> map; - - public void render(Collection<DocumentRenderer> documents, - SiteRenderingContext siteRenderingContext, - File outputDirectory) - throws RendererException, IOException { - - // prepare all common values for a given module - - locale = siteRenderingContext.getLocale(); - - Map<String, ?> templateProperties = siteRenderingContext.getTemplateProperties(); - - super.render(documents, siteRenderingContext, outputDirectory); - - mavenProject = (MavenProject) templateProperties.get("project"); - - map = new HashMap<String, String>(); - - pdfGenerationEnabled = getBooleanProperty( - (String) mavenProject.getProperties().get("pdfGenerationEnabled")); - - if (pdfGenerationEnabled) { - String absolutePath = outputDirectory.getAbsolutePath(); - try { - renderPdf(documents, siteRenderingContext, absolutePath); - } catch (Exception e) { - log.error("Can't find rst resource to generate pdf documentation", e); - } - } - } - - public void renderPdf(Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, - String outputDirectory) - throws RendererException, FileNotFoundException, UnsupportedEncodingException - { - Context vc = new VelocityContext(); - - vc.put( "locale", locale ); - vc.put( "supportedLocales", Collections.unmodifiableList(siteRenderingContext.getSiteLocales()) ); - - try { - StringWriter sw = new StringWriter(); - Field velocityField = ReflectUtil.getField(DefaultSiteRenderer.class, "velocity"); - - VelocityComponent velocity = (VelocityComponent)velocityField.get(this); - VelocityEngine engine = velocity.getEngine(); - String inputEncoding = siteRenderingContext.getInputEncoding(); - - // Set velocity variables - String tableOfContent = CONTENT_EN; - String docName = DOC_NAME_EN; - String filename = FILE_NAME_EN; - if (locale.equals(Locale.FRENCH)) { - tableOfContent = CONTENT_FR; - docName = DOC_NAME_FR; - filename = FILE_NAME_FR; - } - String titleDecoration = StringUtils.rightPad("", docName.length(), '='); - vc.put("titleDecoration", titleDecoration); - vc.put( "docName", docName); - vc.put( "tableContentName", tableOfContent); - - // Build the map of html documents from .rst or .rst.vm files - File basedir = buildDocMap(documents); - vc.put("basedir", basedir.getAbsolutePath()); - vc.put("separator", File.separatorChar); - - // Build the list of item's href - DecorationModel decoration = siteRenderingContext.getDecoration(); - List<Menu> menus = decoration.getMenus(); - Collection<String> paths = new LinkedList<String>(); - for (Menu menu : menus) { - List<MenuItem> items = menu.getItems(); - for (MenuItem item : items) { - buildListPaths(item, paths, siteRenderingContext); - } - } - - // Merge of the map of html file and the list of paths - List<String> documentRefs = mergeListAndMap(paths); - if (documentRefs.size() > 0) { - vc.put("documentRefs", documentRefs); - - // Aggregate all rst file info one file - engine.mergeTemplate("/META-INF/maven/RstAggregation.vm", inputEncoding, vc, sw); - String fileContent = sw.toString(); - String tempFilePath = outputDirectory + File.separatorChar + "pdfDoc.rst"; - File pdfDoc = new File(tempFilePath); - FileUtils.writeStringToFile(pdfDoc, fileContent, "UTF-8"); - String outputFilePath = outputDirectory + File.separatorChar + filename; - log.info(outputFilePath); - - // Define the output file - File fileOut = new File(outputFilePath); - JRST.Overwrite alltime = JRST.Overwrite.ALLTIME; - - // Generate the pdf file - JRST.generate("pdf", pdfDoc, fileOut, alltime, false); - } - - } catch (Exception e) { - log.error("Can't generate pdf documentation of the project", e); - } - } - - public File buildDocMap(Collection<DocumentRenderer> documents) { - File basedir = new File("."); - for (DocumentRenderer doc : documents) { - RenderingContext renderingContext = doc.getRenderingContext(); - String inputName = renderingContext.getInputName(); - String relativeDir = renderingContext.getRelativePath(); - if (inputName.endsWith("rst") || inputName.endsWith("rst.vm")) { - // Change the extension to html - String[] splitName = inputName.split("\\."); - String htmlName = splitName[0] + "." + "html"; - String relativePath = "." + File.separator + htmlName; - log.info("relativePath: " + relativePath); - // Add in a hashmap - map.put(relativePath, inputName); - - if (relativeDir.equals(".") && inputName.startsWith("index")) { - basedir = renderingContext.getBasedir(); - } - } - } - return basedir; - } - - public List<String> mergeListAndMap(Collection<String> paths) { - // Merge the map and the list to obtain a list of rst files we can add in the pdf - List<String> documentRefs = new LinkedList<String>(); - for (String path: paths) { - // Seek in the hashmap if the rst file exists to add it in the doc list - String rstFilename = map.get(path); - if ( rstFilename != null) { - documentRefs.add(rstFilename); - } - } - return documentRefs; - } - - public Collection<String> buildListPaths(MenuItem item, Collection<String> paths, - SiteRenderingContext siteRenderingContext) { - // add hrefs to paths if they don't start with "http" or ".." - String href = item.getHref(); - if (!href.startsWith("http") && !href.startsWith("..")) { - boolean addHref = true; - for (Locale loc : siteRenderingContext.getSiteLocales()) { - if (href.startsWith(loc.toString())) { - addHref = false; - } - } - if (addHref) { - if(!href.startsWith("./")) { - href = "./" + href; - } - log.info("xml: " + href); - paths.add(href); - } - } - // If the item has sub-items, we use recursion to add them to paths - List<MenuItem> subItems = item.getItems(); - if (!subItems.isEmpty()) { - for (MenuItem subItem : subItems) { - paths = buildListPaths(subItem, paths, siteRenderingContext); - } - } - return paths; - } - - protected boolean getBooleanProperty(String value) { - boolean result = StringUtils.isNotEmpty(value) && !"false".equals(value); - return result; - } - -} \ No newline at end of file Deleted: trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/ReflectUtil.java =================================================================== --- trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/ReflectUtil.java 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/src/main/java/org/nuiton/jrst/ReflectUtil.java 2012-06-29 20:05:59 UTC (rev 724) @@ -1,70 +0,0 @@ -/* - * #%L - * Maven Nuiton Skin - * - * $Id: ReflectUtil.java 641 2011-08-19 15:04:21Z tchemit $ - * $HeadURL: http://svn.nuiton.org/svn/maven-nuiton-skin/trunk/src/main/java/org/nuiton/m... $ - * %% - * 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% - */ -package org.nuiton.jrst; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -/** - * Some usefull methods to obtains none accessible fields and method from - * some classes. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0.6 - */ -public class ReflectUtil { - - public static Method getMethod(Class<?> klass, String methodName, Class<?>[] paramTypes) { - try { - Method declaredMethod = klass.getDeclaredMethod(methodName, paramTypes); - declaredMethod.setAccessible(true); - return declaredMethod; - } catch (Exception e) { - throw new IllegalStateException("Could not get method [" + methodName + "] from parent class :(... ", e); - } - - } - - public static Field getField(Class<?> klass, String fieldName) { - try { - Field declaredField = klass.getDeclaredField(fieldName); - declaredField.setAccessible(true); - return declaredField; - } catch (Exception e) { - throw new IllegalStateException("Could not get field [" + fieldName + "] from parent class :(... ", e); - } - - } - - public static <O> O invokeMethod(Method m, Object o, Object... params) { - try { - O result = (O) m.invoke(o, params); - return result; - } catch (Exception e) { - throw new IllegalStateException("Could not invoke method [" + m.getName() + "] from parent class :(... ", e); - } - - } -} Modified: trunk/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java =================================================================== --- trunk/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst/src/test/java/org/nuiton/jrst/JrstParserTest.java 2012-06-29 20:05:59 UTC (rev 724) @@ -25,13 +25,14 @@ 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$ @@ -48,24 +49,23 @@ } public void testParse() throws Exception { - StringWriter output = null; Reader reader = null; try { - output = new StringWriter(); + StringWriter output = new StringWriter(); reader = getTestReader("test", "rst"); - Sink sink = new XdocSink(output){}; + Sink sink = new XdocSink(output) { + }; parser.parse(reader, sink); - assertTrue(output.toString().contains("emphasis")); - assertTrue(output.toString().contains("This is the first item")); - assertTrue(output.toString().contains("Title")); - assertTrue(output.toString().contains("blocks.")); + String outputResult = output.toString(); + + assertTrue(outputResult.contains("emphasis")); + assertTrue(outputResult.contains("This is the first item")); + assertTrue(outputResult.contains("Title")); + assertTrue(outputResult.contains("blocks.")); } finally { - if (output != null) { - output.close(); - } if (reader != null) { reader.close(); } @@ -78,7 +78,7 @@ } @Override - protected String getOutputDir(){ + protected String getOutputDir() { return "parser/"; } Modified: trunk/doxia-module-jrst-legacy/pom.xml =================================================================== --- trunk/doxia-module-jrst-legacy/pom.xml 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst-legacy/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -2,11 +2,8 @@ <!-- #%L JRst :: Doxia module - - $Id$ - $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 CodeLutin, Chemit tony %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -63,7 +60,13 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jrst-site-util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-module-xdoc</artifactId> @@ -105,6 +108,11 @@ <dependency> <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-annotations</artifactId> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> </dependency> @@ -151,14 +159,14 @@ <build> <plugins> + <plugin> <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-maven-plugin</artifactId> - <version>1.3.8</version> + <artifactId>plexus-component-metadata</artifactId> <executions> <execution> <goals> - <goal>descriptor</goal> + <goal>generate-metadata</goal> </goals> </execution> </executions> 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-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstParser.java 2012-06-29 20:05:59 UTC (rev 724) @@ -25,28 +25,29 @@ package org.nuiton.jrst; -import java.io.File; -import java.io.FileWriter; -import java.io.Reader; -import java.io.StringReader; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; 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.util.IOUtil; +import org.codehaus.plexus.component.annotations.Component; import org.dom4j.Document; +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. - * + * * @author <a href="mailto:chatellier@codelutin.com">Eric Chatellier</a> * @version $Id: JrstParser.java 685 2012-05-29 15:37:18Z jpages $ * @since 0.9.0 - * @plexus.component role="org.apache.maven.doxia.parser.Parser" role-hint="jrst" */ +@Component(role = Parser.class, hint = JrstDoxiaTool.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 { @Override @@ -54,9 +55,10 @@ try { // Write the source in a file to use it with JRST - File sourceFile = File.createTempFile("source",".rst"); - FileWriter fileWriter = new FileWriter(sourceFile); - IOUtil.copy(source, fileWriter); + 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); @@ -69,6 +71,8 @@ super.parse(reader, sink); } catch (Exception e) { throw new ParseException("Can't parse rst file", e); + } finally { + JrstDoxiaTool.clear(); } } Modified: 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-19 14:33:14 UTC (rev 723) +++ trunk/doxia-module-jrst-legacy/src/main/java/org/nuiton/jrst/JrstSiteModule.java 2012-06-29 20:05:59 UTC (rev 724) @@ -26,6 +26,8 @@ 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. @@ -33,9 +35,11 @@ * @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 - * @plexus.component role="org.apache.maven.doxia.module.site.SiteModule" role-hint="jrst" */ -public class JrstSiteModule extends AbstractSiteModule { +@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() { @@ -49,6 +53,6 @@ @Override public String getParserId() { - return "jrst"; + return JrstDoxiaTool.JRST_PARSER_ID; } } Modified: trunk/jrst/pom.xml =================================================================== --- trunk/jrst/pom.xml 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/jrst/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -2,11 +2,8 @@ <!-- #%L JRst :: Api - - $Id$ - $HeadURL$ %% - Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric + Copyright (C) 2004 - 2012 CodeLutin, Chatellier Eric, Chemit tony %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/jrst-doc/pom.xml =================================================================== --- trunk/jrst-doc/pom.xml 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/jrst-doc/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -2,11 +2,8 @@ <!-- #%L JRst :: Documentation - - $Id$ - $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2010 CodeLutin, Chemit tony %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Property changes on: trunk/jrst-site-util ___________________________________________________________________ Added: svn:ignore + target *.ipr *.iws *.iml .idea .project .classpath .settings Added: trunk/jrst-site-util/LICENSE.txt =================================================================== --- trunk/jrst-site-util/LICENSE.txt (rev 0) +++ trunk/jrst-site-util/LICENSE.txt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + Property changes on: trunk/jrst-site-util/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/README.txt =================================================================== --- trunk/jrst-site-util/README.txt (rev 0) +++ trunk/jrst-site-util/README.txt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,21 @@ +Doxia Module JRst +================= + +Configuration +------------- + +To use it, put it in your pom.xml : + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>${doxia-module-jrst.version}</version> + </dependency> + </dependencies> + </plugin> + +That it ! Then run "mvn site". Property changes on: trunk/jrst-site-util/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/changelog.txt =================================================================== --- trunk/jrst-site-util/changelog.txt (rev 0) +++ trunk/jrst-site-util/changelog.txt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,15 @@ +doxia-module-jrst (1.6.0) + + * JrstParser use now JRST.java methods to generate the site + +doxia-module-jrst (1.1.0) ? + + * migrate to nuiton + +doxia-module-jrst (1.0.1) chemit 20090511 + + * Bump versions (lutinproject 3.5.4, jrst 0.8.6) + +doxia-module-jrst (1.0.0) chemit + + * Initial release \ No newline at end of file Property changes on: trunk/jrst-site-util/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/pom.xml =================================================================== --- trunk/jrst-site-util/pom.xml (rev 0) +++ trunk/jrst-site-util/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRst :: Site util + %% + Copyright (C) 2012 CodeLutin, Chemit tony + %% + 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% + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>jrst</artifactId> + <version>2.1-SNAPSHOT</version> + </parent> + + <groupId>org.nuiton.jrst</groupId> + <artifactId>jrst-site-util</artifactId> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jrst</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + <!-- There is a pb with xalan --> + <exclusions> + <exclusion> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-module-xdoc</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-sink-api</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-core</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-core</artifactId> + <type>test-jar</type> + </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> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-annotations</artifactId> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + </dependency> + + </dependencies> + + <name>JRst :: Site util</name> + <description>JRst aven site utils used by any jrst doxia module</description> + <inceptionYear>2012</inceptionYear> + + <developers> + <developer> + <name>Tony Chemit</name> + <id>tchemit</id> + <email>chemit@codelutin.com + </email> + <organization>CodeLutin</organization> + <timezone>+2</timezone> + <roles> + <role>Développeur</role> + </roles> + </developer> + </developers> + +</project> Property changes on: trunk/jrst-site-util/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/license/THIRD-PARTY.properties =================================================================== --- trunk/jrst-site-util/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/jrst-site-util/src/license/THIRD-PARTY.properties 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,33 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - 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 +# - 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 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#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 +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 Property changes on: trunk/jrst-site-util/src/license/THIRD-PARTY.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java (rev 0) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstDoxiaTool.java 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,83 @@ +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/JrstSiteRenderer.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java (rev 0) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,288 @@ +package org.nuiton.jrst; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.doxia.sink.render.RenderingContext; +import org.apache.maven.doxia.site.decoration.DecorationModel; +import org.apache.maven.doxia.site.decoration.Menu; +import org.apache.maven.doxia.site.decoration.MenuItem; +import org.apache.maven.doxia.siterenderer.DefaultSiteRenderer; +import org.apache.maven.doxia.siterenderer.DocumentRenderer; +import org.apache.maven.doxia.siterenderer.Renderer; +import org.apache.maven.doxia.siterenderer.RendererException; +import org.apache.maven.doxia.siterenderer.SiteRenderingContext; +import org.apache.maven.project.MavenProject; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.context.Context; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.i18n.I18N; +import org.codehaus.plexus.velocity.VelocityComponent; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.lang.reflect.Field; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** + * Override of the DefaultSiteRenderer to add pdf generation of the site. + * + * @author jpages <pages@codelutin.com> + * @author tchemit <chemit@codelutin.com> + * @version $Id$ + * @since 1.0 + */ +@Component(role = Renderer.class, hint = "default") +public class JrstSiteRenderer extends DefaultSiteRenderer { + + public static final String DEFAULT_PDF_FILENAME = "site"; + + /** All locales used to render sites. */ + protected List<Locale> locales; + + /** Current locale used to render. */ + protected Locale locale; + + /** Current maven project to render. */ + protected MavenProject mavenProject; + + protected boolean pdfGenerationEnabled; + + protected Map<String, String> map; + + protected boolean verbose; + + @Override + public void render(Collection<DocumentRenderer> documents, + SiteRenderingContext siteRenderingContext, + File outputDirectory) + throws RendererException, IOException { + + // prepare all common values for a given module + + locale = siteRenderingContext.getLocale(); + + locales = Collections.unmodifiableList(siteRenderingContext.getSiteLocales()); + + Map<String, ?> templateProperties = siteRenderingContext.getTemplateProperties(); + + mavenProject = (MavenProject) templateProperties.get("project"); + + verbose = getBooleanProperty("site.verbose") || + getLogger().isDebugEnabled(); + + map = new HashMap<String, String>(); + + pdfGenerationEnabled = getBooleanProperty("pdfGenerationEnabled"); + + super.render(documents, siteRenderingContext, outputDirectory); + + if (pdfGenerationEnabled) { + + if (verbose) { + getLogger().info("Will generate the site pdf."); + } + + // get pdfFilename + String pdfFilename = getStringProperty("pdfFilename"); + if (StringUtils.isBlank(pdfFilename)) { + pdfFilename = DEFAULT_PDF_FILENAME; + } + + if (!locales.isEmpty() && !locale.equals(locales.get(0))) { + // not default locale, prefix with locale country. + pdfFilename += "_" + locale.getCountry(); + } + pdfFilename += ".pdf"; + + try { + renderPdf(documents, siteRenderingContext, + outputDirectory, + pdfFilename); + } catch (Exception e) { + getLogger().error("Can't find rst resource to generate pdf documentation", e); + } + } + } + + @Override + public void renderDocument(Writer writer, + RenderingContext renderingContext, + SiteRenderingContext context) + throws RendererException, FileNotFoundException, UnsupportedEncodingException { + + if (JrstDoxiaTool.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); + + } + super.renderDocument(writer, renderingContext, context); + } + + public void renderPdf(Collection<DocumentRenderer> documents, + SiteRenderingContext siteRenderingContext, + File outputDirectory, String pdfFilename) + throws RendererException, FileNotFoundException, UnsupportedEncodingException { + Context vc = new VelocityContext(); + + if (getLogger().isInfoEnabled()) { + getLogger().info("Generate Site Pdf: " + pdfFilename); + } + vc.put("locale", locale); + vc.put("supportedLocales", locales); + + try { + StringWriter sw = new StringWriter(); + Field velocityField = ReflectUtil.getField(DefaultSiteRenderer.class, "velocity"); + + VelocityComponent velocity = (VelocityComponent) velocityField.get(this); + VelocityEngine engine = velocity.getEngine(); + + Field i18nField = ReflectUtil.getField(DefaultSiteRenderer.class, "i18n"); + + I18N i18n = (I18N) i18nField.get(this); + + String inputEncoding = siteRenderingContext.getInputEncoding(); + + // Set velocity variables + String tableOfContent = i18n.getString("jrst-site-renderer", locale, "content"); + String docName = mavenProject.getName(); + String titleDecoration = StringUtils.rightPad("", docName.length(), '='); + vc.put("titleDecoration", titleDecoration); + vc.put("docName", docName); + vc.put("tableContentName", tableOfContent); + + // Build the map of html documents from .rst or .rst.vm files + File basedir = buildDocMap(documents); + vc.put("basedir", basedir.getAbsolutePath()); + vc.put("separator", File.separatorChar); + + // Build the list of item's href + DecorationModel decoration = siteRenderingContext.getDecoration(); + List<Menu> menus = decoration.getMenus(); + Collection<String> paths = new LinkedList<String>(); + for (Menu menu : menus) { + List<MenuItem> items = menu.getItems(); + for (MenuItem item : items) { + buildListPaths(item, paths, siteRenderingContext); + } + } + + // Merge of the map of html file and the list of paths + List<String> documentRefs = mergeListAndMap(paths); + if (documentRefs.size() > 0) { + vc.put("documentRefs", documentRefs); + + // Aggregate all rst file info one file + //TODO tchemit-2012-06-29 : use a property + engine.mergeTemplate("/META-INF/maven/RstAggregation.vm", inputEncoding, vc, sw); + String fileContent = sw.toString(); + File pdfDoc = new File(outputDirectory, "pdfDoc.rst"); + FileUtils.writeStringToFile(pdfDoc, fileContent, inputEncoding); + + // Define the output file + File fileOut = new File(outputDirectory, pdfFilename); + + // Generate the pdf file + JRST.generate("pdf", pdfDoc, fileOut, JRST.Overwrite.ALLTIME, false); + } + + } catch (Exception e) { + getLogger().error("Can't generate pdf documentation of the project", e); + } + } + + public File buildDocMap(Collection<DocumentRenderer> documents) { + File basedir = new File("."); + for (DocumentRenderer doc : documents) { + RenderingContext renderingContext = doc.getRenderingContext(); + String inputName = renderingContext.getInputName(); + String relativeDir = renderingContext.getRelativePath(); + if (inputName.endsWith("rst") || inputName.endsWith("rst.vm")) { + // Change the extension to html + String[] splitName = inputName.split("\\."); + String htmlName = splitName[0] + "." + "html"; + String relativePath = "." + File.separator + htmlName; + if (getLogger().isInfoEnabled()) { + getLogger().info("relativePath: " + relativePath); + } + // Add in a hashmap + map.put(relativePath, inputName); + + if (relativeDir.equals(".") && inputName.startsWith("index")) { + basedir = renderingContext.getBasedir(); + } + } + } + return basedir; + } + + public List<String> mergeListAndMap(Collection<String> paths) { + // Merge the map and the list to obtain a list of rst files we can add in the pdf + List<String> documentRefs = new LinkedList<String>(); + for (String path : paths) { + // Seek in the hashmap if the rst file exists to add it in the doc list + String rstFilename = map.get(path); + if (rstFilename != null) { + documentRefs.add(rstFilename); + } + } + return documentRefs; + } + + public Collection<String> buildListPaths(MenuItem item, Collection<String> paths, + SiteRenderingContext siteRenderingContext) { + // add hrefs to paths if they don't start with "http" or ".." + String href = item.getHref(); + if (!href.startsWith("http") && !href.startsWith("..")) { + boolean addHref = true; + for (Locale loc : siteRenderingContext.getSiteLocales()) { + if (href.startsWith(loc.toString())) { + addHref = false; + } + } + if (addHref) { + if (!href.startsWith("./")) { + href = "./" + href; + } + if (getLogger().isInfoEnabled()) { + getLogger().info("xml: " + href); + } + paths.add(href); + } + } + // If the item has sub-items, we use recursion to add them to paths + List<MenuItem> subItems = item.getItems(); + if (!subItems.isEmpty()) { + for (MenuItem subItem : subItems) { + paths = buildListPaths(subItem, paths, siteRenderingContext); + } + } + return paths; + } + + protected String getStringProperty(String propertyName) { + String value = String.valueOf(mavenProject.getModel().getProperties().get(propertyName)); + return value; + } + + protected boolean getBooleanProperty(String propertyName) { + boolean result = "true".equals(getStringProperty(propertyName)); + return result; + } + +} \ No newline at end of file Property changes on: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/JrstSiteRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ReflectUtil.java =================================================================== --- trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ReflectUtil.java (rev 0) +++ trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ReflectUtil.java 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,70 @@ +/* + * #%L + * Maven Nuiton Skin + * + * $Id$ + * $HeadURL: http://svn.nuiton.org/svn/maven-nuiton-skin/trunk/src/main/java/org/nuiton/m... $ + * %% + * 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% + */ +package org.nuiton.jrst; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +/** + * Some usefull methods to obtains none accessible fields and method from + * some classes. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.6 + */ +public class ReflectUtil { + + public static Method getMethod(Class<?> klass, String methodName, Class<?>[] paramTypes) { + try { + Method declaredMethod = klass.getDeclaredMethod(methodName, paramTypes); + declaredMethod.setAccessible(true); + return declaredMethod; + } catch (Exception e) { + throw new IllegalStateException("Could not get method [" + methodName + "] from parent class :(... ", e); + } + + } + + public static Field getField(Class<?> klass, String fieldName) { + try { + Field declaredField = klass.getDeclaredField(fieldName); + declaredField.setAccessible(true); + return declaredField; + } catch (Exception e) { + throw new IllegalStateException("Could not get field [" + fieldName + "] from parent class :(... ", e); + } + + } + + public static <O> O invokeMethod(Method m, Object o, Object... params) { + try { + O result = (O) m.invoke(o, params); + return result; + } catch (Exception e) { + throw new IllegalStateException("Could not invoke method [" + m.getName() + "] from parent class :(... ", e); + } + + } +} Property changes on: trunk/jrst-site-util/src/main/java/org/nuiton/jrst/ReflectUtil.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/resources/META-INF/maven/RstAggregation.vm =================================================================== --- trunk/jrst-site-util/src/main/resources/META-INF/maven/RstAggregation.vm (rev 0) +++ trunk/jrst-site-util/src/main/resources/META-INF/maven/RstAggregation.vm 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,35 @@ +.. - +.. * #%L +.. * JRst :: Documentation +.. * +.. * $Id$ +.. * $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/jrst-doc/src/site/rst/index.rst $ +.. * %% +.. * 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% +.. - + +$titleDecoration +$docName +$titleDecoration + +.. contents:: $tableContentName + + +#foreach($ref in $documentRefs) +.. include:: $basedir$separator$ref +#end \ No newline at end of file Property changes on: trunk/jrst-site-util/src/main/resources/META-INF/maven/RstAggregation.vm ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml =================================================================== --- trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml (rev 0) +++ trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,59 @@ +<?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> Property changes on: trunk/jrst-site-util/src/main/resources/META-INF/plexus/components.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/resources/jrst-site-renderer.properties =================================================================== --- trunk/jrst-site-util/src/main/resources/jrst-site-renderer.properties (rev 0) +++ trunk/jrst-site-util/src/main/resources/jrst-site-renderer.properties 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1 @@ +content=Table of content Property changes on: trunk/jrst-site-util/src/main/resources/jrst-site-renderer.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/resources/jrst-site-renderer_en.properties =================================================================== --- trunk/jrst-site-util/src/main/resources/jrst-site-renderer_en.properties (rev 0) +++ trunk/jrst-site-util/src/main/resources/jrst-site-renderer_en.properties 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,6 @@ +# NOTE: +# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It +# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the +# JVM's default locale (which need not be "en"). See the method javadoc about +# ResourceBundle.getBundle(String, Locale, ClassLoader) +# for a full description of the lookup strategy. \ No newline at end of file Property changes on: trunk/jrst-site-util/src/main/resources/jrst-site-renderer_en.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/main/resources/jrst-site-renderer_fr.properties =================================================================== --- trunk/jrst-site-util/src/main/resources/jrst-site-renderer_fr.properties (rev 0) +++ trunk/jrst-site-util/src/main/resources/jrst-site-renderer_fr.properties 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1 @@ +content=Sommaire \ No newline at end of file Property changes on: trunk/jrst-site-util/src/main/resources/jrst-site-renderer_fr.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/apt/devel.apt =================================================================== --- trunk/jrst-site-util/src/site/apt/devel.apt (rev 0) +++ trunk/jrst-site-util/src/site/apt/devel.apt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,35 @@ +~~~ +~~ #%L +~~ JRst :: Doxia module +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/apt/devel.ap... $ +~~ %% +~~ 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% +~~~ + + ------------- + Documentation + ------------- + +Documentation + + JRst doxia module, is inherited from {{{http://maven.apache.org/doxia/doxia-1.0.x/doxia-modules/doxia-module-xdoc/index.html}doxia-module-xdoc}}. + + It just intercept xdoc parser call, transform RST into xdoc, and + then send generated xdoc to XDoc parser. \ No newline at end of file Property changes on: trunk/jrst-site-util/src/site/apt/devel.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/apt/index.apt =================================================================== --- trunk/jrst-site-util/src/site/apt/index.apt (rev 0) +++ trunk/jrst-site-util/src/site/apt/index.apt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,47 @@ +~~~ +~~ #%L +~~ JRst :: Doxia module +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/apt/index.ap... $ +~~ %% +~~ 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% +~~~ + + ----------------- + Doxia Module JRst + ----------------- + +Configuration + +-------------------------------------------------- + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>2.0</version> + <dependencies> + <dependency> + <groupId>org.nuiton.jrst</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>1.0.0</version> + </dependency> + </dependencies> + </plugin> +-------------------------------------------------- + + Ensuite vous avez plus qu'à lancer la commande mvn site \ No newline at end of file Property changes on: trunk/jrst-site-util/src/site/apt/index.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/en/apt/devel.apt =================================================================== --- trunk/jrst-site-util/src/site/en/apt/devel.apt (rev 0) +++ trunk/jrst-site-util/src/site/en/apt/devel.apt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,35 @@ +~~~ +~~ #%L +~~ JRst :: Doxia module +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/en/apt/devel... $ +~~ %% +~~ 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% +~~~ + + ------------- + Documentation + ------------- + +Documentation + + JRst doxia module, is inherited from {{{http://maven.apache.org/doxia/doxia-1.0.x/doxia-modules/doxia-module-xdoc/index.html}doxia-module-xdoc}}. + + It just intercept xdoc parser call, transform RST into xdoc, and + then send generated xdoc to XDoc parser. \ No newline at end of file Property changes on: trunk/jrst-site-util/src/site/en/apt/devel.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/en/apt/index.apt =================================================================== --- trunk/jrst-site-util/src/site/en/apt/index.apt (rev 0) +++ trunk/jrst-site-util/src/site/en/apt/index.apt 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,52 @@ +~~~ +~~ #%L +~~ JRst :: Doxia module +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/en/apt/index... $ +~~ %% +~~ 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% +~~~ + + ----------------- + Doxia Module JRst + ----------------- + +Configuration + +-------------------------------------------------- + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>2.0</version> + <dependencies> + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>1.1.0</version> + </dependency> + </dependencies> + </plugin> +-------------------------------------------------- + + That it ! Then run "mvn site". + + +Warning + + This version only works with doxia-1.0.x (provided by maven-site-plugin-2.0). \ No newline at end of file Property changes on: trunk/jrst-site-util/src/site/en/apt/index.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/site_en.xml =================================================================== --- trunk/jrst-site-util/src/site/site_en.xml (rev 0) +++ trunk/jrst-site-util/src/site/site_en.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRst :: Doxia module + + $Id$ + $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/site_en.xml $ + %% + 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% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>/</href> + </bannerLeft> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <links> + <item name="[fr" href="../index.html"/> + <item name="en]" href="index.html"/> + </links> + + <menu name="Project Parent"> + <item name="JRst" href="../../en/index.html"/> + </menu> + + <menu name="User"> + <item href="/index.html" name="About"/> + </menu> + + <menu name="Developer"> + <item href="/devel.html" name="Documentation"/> + </menu> + + <menu name="Community"> + <item name="Bugtracker" href="http://nuiton.org/projects/jrst/issues"/> + <item name="Roadmap" href="http://nuiton.org/projects/roadmap/jrst"/> + <item name="Downloads" href="http://nuiton.org/projects/jrst/files"/> + <item name="Continuous integration" + href="http://hudson.nuiton.org/hudson/job/jrst"/> + <item name="Code analysis" + href="http://sonar.nuiton.org/sonar/project/index/org.nuiton:jrst"/> + </menu> + + <menu ref="reports"/> + + <footer> + + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.connection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> +</project> Property changes on: trunk/jrst-site-util/src/site/site_en.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jrst-site-util/src/site/site_fr.xml =================================================================== --- trunk/jrst-site-util/src/site/site_fr.xml (rev 0) +++ trunk/jrst-site-util/src/site/site_fr.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRst :: Doxia module + + $Id$ + $HeadURL: http://svn.nuiton.org/svn/jrst/trunk/doxia-module-jrst/src/site/site_fr.xml $ + %% + 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% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>/</href> + </bannerLeft> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="${project.url}"/> + </breadcrumbs> + + <links> + <item name="[fr" href="index.html"/> + <item name="en]" href="en/index.html"/> + </links> + + <menu ref="parent"/> + + <menu name="Utilisateur"> + <item href="/index.html" name="A propos"/> + </menu> + + <menu name="Developpeur"> + <item href="/devel.html" name="Documentation"/> + </menu> + + <menu name="Communauté"> + <item name="Suivi des bugs" + href="http://nuiton.org/projects/jrst/issues"/> + <item name="Roadmap" href="http://nuiton.org/projects/roadmap/jrst"/> + <item name="Téléchargements" + href="http://nuiton.org/projects/jrst/files"/> + <item name="Intégration continue" + href="http://hudson.nuiton.org/hudson/job/jrst"/> + <item name="Analyse du code" + href="http://sonar.nuiton.org/sonar/project/index/org.nuiton:jrst"/> + </menu> + + <menu ref="reports"/> + + <footer> + + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.connection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> +</project> Property changes on: trunk/jrst-site-util/src/site/site_fr.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-06-19 14:33:14 UTC (rev 723) +++ trunk/pom.xml 2012-06-29 20:05:59 UTC (rev 724) @@ -2,9 +2,6 @@ <!-- #%L JRst - - $Id$ - $HeadURL$ %% Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric %% @@ -23,7 +20,9 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -33,7 +32,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom4redmineAndCentral</artifactId> - <version>3.3.1</version> + <version>3.3.3</version> </parent> <artifactId>jrst</artifactId> @@ -44,6 +43,7 @@ <module>jrst</module> <!-- Evolution #35: Suppression du module "maven-jrst-plugin" --> <!--<module>maven-jrst-plugin</module>--> + <module>jrst-site-util</module> <module>doxia-module-jrst</module> <module>doxia-module-jrst-legacy</module> <module>jrst-doc</module> @@ -67,7 +67,7 @@ <dependency> <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin</artifactId> + <artifactId>helper-maven-plugin</artifactId> <version>${helperPluginVersion}</version> <exclusions> <exclusion> @@ -155,6 +155,12 @@ </dependency> <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-annotations</artifactId> + <version>1.5.5</version> + </dependency> + + <dependency> <groupId>xmlunit</groupId> <artifactId>xmlunit</artifactId> <version>1.3</version> @@ -290,7 +296,7 @@ <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> - </dependency> + </dependency> <!-- jaxx dependencies --> @@ -392,7 +398,7 @@ <doxiaVersion>1.3</doxiaVersion> <doxiaSitetoolsVersion>1.2</doxiaSitetoolsVersion> - <nuitonUtilsVersion>2.4.8</nuitonUtilsVersion> + <nuitonUtilsVersion>2.5</nuitonUtilsVersion> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> <xalanVersion>2.7.1</xalanVersion> <jaxxVersion>2.5-SNAPSHOT</jaxxVersion> @@ -416,6 +422,12 @@ <version>${jaxxVersion}</version> </plugin> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-metadata</artifactId> + <version>1.5.5</version> + </plugin> + </plugins> </pluginManagement> @@ -493,6 +505,4 @@ </profiles> - - </project>