r289 - in doxia-module-jrst/trunk: . src src/main src/main/components src/main/java src/main/java/org src/main/java/org/codelutin src/main/java/org/codelutin/jrst src/site src/site/rst src/test src/test/java src/test/java/org src/test/java/org/codelutin src/test/java/org/codelutin/jrst src/test/resources
Author: chatellier Date: 2009-03-03 16:25:43 +0000 (Tue, 03 Mar 2009) New Revision: 289 Added: doxia-module-jrst/trunk/LICENSE.txt doxia-module-jrst/trunk/README.txt doxia-module-jrst/trunk/changelog.txt doxia-module-jrst/trunk/pom.xml doxia-module-jrst/trunk/src/ doxia-module-jrst/trunk/src/main/ doxia-module-jrst/trunk/src/main/components/ doxia-module-jrst/trunk/src/main/components/components.xml doxia-module-jrst/trunk/src/main/java/ doxia-module-jrst/trunk/src/main/java/org/ doxia-module-jrst/trunk/src/main/java/org/codelutin/ doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/ doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstParser.java doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstSiteModule.java doxia-module-jrst/trunk/src/site/ doxia-module-jrst/trunk/src/site/rst/ doxia-module-jrst/trunk/src/site/rst/devel.rst doxia-module-jrst/trunk/src/site/rst/index.rst doxia-module-jrst/trunk/src/site/site.xml doxia-module-jrst/trunk/src/test/ doxia-module-jrst/trunk/src/test/java/ doxia-module-jrst/trunk/src/test/java/org/ doxia-module-jrst/trunk/src/test/java/org/codelutin/ doxia-module-jrst/trunk/src/test/java/org/codelutin/jrst/ doxia-module-jrst/trunk/src/test/java/org/codelutin/jrst/JrstParserTest.java doxia-module-jrst/trunk/src/test/resources/ doxia-module-jrst/trunk/src/test/resources/test.rst Modified: doxia-module-jrst/trunk/ Log: Initial import. Property changes on: doxia-module-jrst/trunk ___________________________________________________________________ Name: svn:ignore + .settings target .classpath .project Added: doxia-module-jrst/trunk/LICENSE.txt =================================================================== --- doxia-module-jrst/trunk/LICENSE.txt (rev 0) +++ doxia-module-jrst/trunk/LICENSE.txt 2009-03-03 16:25:43 UTC (rev 289) @@ -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. + Added: doxia-module-jrst/trunk/README.txt =================================================================== --- doxia-module-jrst/trunk/README.txt (rev 0) +++ doxia-module-jrst/trunk/README.txt 2009-03-03 16:25:43 UTC (rev 289) @@ -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". Added: doxia-module-jrst/trunk/changelog.txt =================================================================== --- doxia-module-jrst/trunk/changelog.txt (rev 0) +++ doxia-module-jrst/trunk/changelog.txt 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,3 @@ +doxia-module-jrst (0.8.5-SNAPSHOT) chatellier + + * Initial release \ No newline at end of file Added: doxia-module-jrst/trunk/pom.xml =================================================================== --- doxia-module-jrst/trunk/pom.xml (rev 0) +++ doxia-module-jrst/trunk/pom.xml 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinproject</artifactId> + <version>3.4</version> + </parent> + + <artifactId>doxia-module-jrst</artifactId> + <version>0.8.5-SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-module-xdoc</artifactId> + <version>1.0</version> + </dependency> + <!-- There is a pb with xalan --> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jrst</artifactId> + <version>0.8.5-SNAPSHOT</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-core</artifactId> + <type>test-jar</type> + <version>1.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>Doxia JRst Module</name> + <description>JRst module for doxia</description> + <inceptionYear>2009</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + <packaging>jar</packaging> + + <properties> + <labs.id>54</labs.id> + <labs.project>jrst</labs.project> + </properties> + + <developers> + <developer> + <name>Eric Chatellier</name> + <id>chatellier</id> + <email>chatellier@codelutin.com + </email> + <organization>CodeLutin</organization> + <timezone>+2</timezone> + <roles> + <role>Développeur</role> + </roles> + </developer> + </developers> + + <build> + + <defaultGoal>install</defaultGoal> + + <plugins> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-maven-plugin</artifactId> + <version>1.3.5</version> + <configuration> + <descriptors> + <descriptor>src/main/components/components.xml</descriptor> + <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <goals> + <goal>descriptor</goal> + <goal>merge-descriptors</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <!-- Fix conf in super pom --> + <configuration> + <siteDirectory>src/site</siteDirectory> + </configuration> + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>0.8.5-SNAPSHOT</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + <scm> + <connection>${maven.scm.connection}</connection> + <developerConnection>${maven.scm.developerConnection}</developerConnection> + <url>${maven.scm.url}</url> + </scm> + + <!--Code Lutin Repository--> + <repositories> + <repository> + <id>codelutin-repository</id> + <name>CodeLutinRepository</name> + <url>http://lutinbuilder.labs.libre-entreprise.org/maven2</url> + <snapshots> + <enabled>true</enabled> + <checksumPolicy>warn</checksumPolicy> + </snapshots> + <releases> + <enabled>true</enabled> + <checksumPolicy>warn</checksumPolicy> + </releases> + </repository> + </repositories> +</project> \ No newline at end of file Added: doxia-module-jrst/trunk/src/main/components/components.xml =================================================================== --- doxia-module-jrst/trunk/src/main/components/components.xml (rev 0) +++ doxia-module-jrst/trunk/src/main/components/components.xml 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<component-set> + <components> + <component> + <role>org.apache.maven.doxia.parser.Parser</role> + <role-hint>jrst</role-hint> + <implementation>org.codelutin.jrst.JrstParser</implementation> + <description>Parse an RST model and call XDoc parser.</description> + <requirements> + <requirement> + <role>org.apache.maven.doxia.macro.manager.MacroManager</role> + <field-name>macroManager</field-name> + </requirement> + </requirements> + </component> + </components> +</component-set> Added: doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstParser.java =================================================================== --- doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstParser.java (rev 0) +++ doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstParser.java 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,70 @@ +/* *##% Doxia module jrst + * Copyright (C) 2009 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>. ##%*/ + +package org.codelutin.jrst; + +import java.io.FileNotFoundException; +import java.io.Reader; +import java.io.StringReader; +import java.net.URL; + +import org.apache.maven.doxia.module.xdoc.XdocParser; +import org.apache.maven.doxia.parser.ParseException; +import org.apache.maven.doxia.sink.Sink; +import org.dom4j.Document; + +/** + * Parse an RST model, transform it into xdoc model and emit events into the + * specified doxia Sink. + * + * @author <a href="mailto:jason@maven.org">Jason van Zyl</a> + * @version $Id: JrstParser.java 746992 2009-02-23 12:35:59Z vsiveton $ + * @since 0.9.0 + * @plexus.component role="org.apache.maven.doxia.parser.Parser" + * role-hint="jrst" + */ +public class JrstParser extends XdocParser { + + protected final static String RST2XDOC = "/xsl/rst2xdoc.xsl"; + + /** {@inheritDoc} */ + public void parse(Reader source, Sink sink) throws ParseException { + + try { + + // Load source as RST Document + JRSTReader jrst = new JRSTReader(); + Document doc = jrst.read(source); + + // Apply xsl on rst RST Document + JRSTGenerator gen = new JRSTGenerator(); + URL stylesheet = JrstParser.class.getResource(RST2XDOC); + if (stylesheet == null) { + throw new FileNotFoundException("Can't find stylesheet: " + + RST2XDOC); + } + doc = gen.transform(doc, stylesheet); + + // Give xsl result to XDoc parser + Reader reader = new StringReader(doc.asXML()); + super.parse(reader, sink); + } catch (Exception e) { + throw new ParseException("Can't parse rst file", e); + } + + } +} Added: doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstSiteModule.java =================================================================== --- doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstSiteModule.java (rev 0) +++ doxia-module-jrst/trunk/src/main/java/org/codelutin/jrst/JrstSiteModule.java 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,46 @@ +/* *##% Doxia module jrst + * Copyright (C) 2009 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>. ##% */ + +package org.codelutin.jrst; + +import org.apache.maven.doxia.module.site.AbstractSiteModule; + +/** + * JrstSiteModule. + * + * @author chatellier + * @version $Revision : 1 $ + * @since 0.9.0 + * @plexus.component role="org.apache.maven.doxia.module.site.SiteModule" role-hint="jrst" + */ +public class JrstSiteModule extends AbstractSiteModule { + + /** {@inheritDoc} */ + public String getSourceDirectory() { + return "rst"; + } + + /** {@inheritDoc} */ + public String getExtension() { + return "rst"; + } + + /** {@inheritDoc} */ + public String getParserId() { + return "jrst"; + } +} Added: doxia-module-jrst/trunk/src/site/rst/devel.rst =================================================================== --- doxia-module-jrst/trunk/src/site/rst/devel.rst (rev 0) +++ doxia-module-jrst/trunk/src/site/rst/devel.rst 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,9 @@ +Documentation +============= + +JRst doxia module, is inherited from `doxia-module-xdoc`_. + +It just intercept xdoc parser call, transform RST into xdoc, and +then send generated xdoc to XDoc parser. + +.. _doxia-module-xdoc: http://maven.apache.org/doxia/doxia-1.0.x/doxia-modules/doxia-module-xdoc/in... \ No newline at end of file Added: doxia-module-jrst/trunk/src/site/rst/index.rst =================================================================== --- doxia-module-jrst/trunk/src/site/rst/index.rst (rev 0) +++ doxia-module-jrst/trunk/src/site/rst/index.rst 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,27 @@ +Doxia Module JRst +================= + +Configuration +------------- + +:: + + <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". + + +Links +----- + + * http://docutils.sourceforge.net/ \ No newline at end of file Added: doxia-module-jrst/trunk/src/site/site.xml =================================================================== --- doxia-module-jrst/trunk/src/site/site.xml (rev 0) +++ doxia-module-jrst/trunk/src/site/site.xml 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <skin> + <groupId>org.codelutin</groupId> + <artifactId>maven-lutin-skin</artifactId> + <version>0.2.3</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + <href>/</href> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>http://www.codelutin.com</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="JRst" href="http://jrst.labs.libre-entreprise.org/"/> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="Code Lutin" href="http://www.codelutin.com/"/> + <item name="[fr" href="http://jrst.labs.libre-entreprise.org/jrst/fr-redirect.html"/> + <item name="en]" href="http://jrst.labs.libre-entreprise.org/jrst/en-redirect.html"/> + </links> + + <menu name="User"> + <item href="/index.html" name="About"/> + + </menu> + + <menu name="Developer"> + <item href="/devel.html" name="Documentation"/> + </menu> + + <menu ref="reports"/> + + </body> +</project> Added: doxia-module-jrst/trunk/src/test/java/org/codelutin/jrst/JrstParserTest.java =================================================================== --- doxia-module-jrst/trunk/src/test/java/org/codelutin/jrst/JrstParserTest.java (rev 0) +++ doxia-module-jrst/trunk/src/test/java/org/codelutin/jrst/JrstParserTest.java 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,76 @@ +/* *##% Doxia module jrst + * Copyright (C) 2009 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>. ##% */ + +package org.codelutin.jrst; + +import java.io.Reader; +import java.io.StringWriter; + +import org.apache.maven.doxia.module.xdoc.XdocSink; +import org.apache.maven.doxia.parser.AbstractParserTest; +import org.apache.maven.doxia.parser.Parser; +import org.apache.maven.doxia.sink.Sink; + +/** + * @author chatellier + * @version $Revision : 1$ + */ +public class JrstParserTest extends AbstractParserTest { + + protected JrstParser parser; + + /** @see junit.framework.TestCase#setUp() */ + protected void setUp() throws Exception { + super.setUp(); + + parser = (JrstParser) lookup(Parser.ROLE, "jrst"); + } + + /** @see org.apache.maven.doxia.parser.AbstractParserTest#createParser() */ + protected Parser createParser() { + return parser; + } + + /** @throws Exception */ + public void testParseRst() throws Exception { + StringWriter output = null; + Reader reader = null; + + try { + output = new StringWriter(); + reader = getTestReader("test", "rst"); + + Sink sink = new XdocSink(output); + createParser().parse(reader, sink); + + /* FIXME output is null :( + assertTrue(output.toString().indexOf("emphasis") != -1); + assertTrue(output.toString().indexOf("This is the first item") != -1); + assertTrue(output.toString().indexOf("Title") != -1); + assertTrue(output.toString().indexOf("blocks.") != -1);*/ + } finally { + output.close(); + reader.close(); + } + } + + /** {@inheritDoc} */ + protected String outputExtension() { + return "rst"; + } + +} Added: doxia-module-jrst/trunk/src/test/resources/test.rst =================================================================== --- doxia-module-jrst/trunk/src/test/resources/test.rst (rev 0) +++ doxia-module-jrst/trunk/src/test/resources/test.rst 2009-03-03 16:25:43 UTC (rev 289) @@ -0,0 +1,51 @@ +Title +===== + +Subtitle +-------- + +*emphasis* + +**strong emphasis** + +`interpreted text` + +``inline literal`` + +http://docutils.sf.net/ + ++------------+------------+-----------+ +| Header 1 | Header 2 | Header 3 | ++============+============+===========+ +| body row 1 | column 2 | column 3 | ++------------+------------+-----------+ +| body row 2 | Cells may span columns.| ++------------+------------+-----------+ +| body row 3 | Cells may | - Cells | ++------------+ span rows. | - contain | +| body row 4 | | - blocks. | ++------------+------------+-----------+ + +:: + + Test + Sub test + + +Bullet lists: + +- This is item 1 +- This is item 2 + + +Enumerated lists: + +3. This is the first item +4. This is the second item +5. Enumerators are arabic numbers, + single letters, or roman numerals +6. List items should be sequentially + numbered, but need not start at 1 + (although not all formatters will + honour the first index). +#. This item is auto-enumerated \ No newline at end of file
participants (1)
-
chatellier@users.labs.libre-entreprise.org