On Sat, Feb 28, 2009 at 17:57, SVN vmassol
<[email protected]> wrote:
> Author: vmassol
> Date: 2009-02-28 17:57:59 +0100 (Sat, 28 Feb 2009)
> New Revision: 17100
>
> Modified:
>
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/pom.xml
>
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/AbstractWikiModelParser.java
> Log:
> * Started adding setter for setter injection and to allow using the bean
> without a component manager that does the injection automatically.
> * Fixed checkstyle errors
>
> Modified:
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/pom.xml
> ===================================================================
> ---
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/pom.xml
> 2009-02-27 22:57:31 UTC (rev 17099)
> +++
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/pom.xml
> 2009-02-28 16:57:59 UTC (rev 17100)
> @@ -43,4 +43,25 @@
> <version>${pom.version}</version>
> </dependency>
> </dependencies>
> + <build>
> + <plugins>
> + <plugin>
> + <!-- Apply the Checkstyle configurations defined in the top level
> pom.xml file -->
> + <groupId>org.apache.maven.plugins</groupId>
> + <artifactId>maven-checkstyle-plugin</artifactId>
> + <dependencies>
> + <dependency>
> + <groupId>com.xpn.xwiki.platform.tools</groupId>
> + <artifactId>xwiki-verification-resources</artifactId>
> + <version>${platform.tool.verification.version}</version>
> + </dependency>
> + </dependencies>
I think the <dependencies> part is not needed here since it's already
defined in XWiki root pom.xml
> + <configuration>
> + <includes>
> + **/AbstractWikiModelParser.java
> + </includes>
> + </configuration>
> + </plugin>
> + </plugins>
> + </build>
> </project>
>
> Modified:
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/AbstractWikiModelParser.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/AbstractWikiModelParser.java
> 2009-02-27 22:57:31 UTC (rev 17099)
> +++
> platform/core/trunk/xwiki-rendering/xwiki-rendering-parsers/xwiki-rendering-parser-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/AbstractWikiModelParser.java
> 2009-02-28 16:57:59 UTC (rev 17100)
> @@ -21,7 +21,6 @@
>
> import org.xwiki.component.logging.AbstractLogEnabled;
> import org.xwiki.rendering.block.XDOM;
> -import org.xwiki.rendering.internal.parser.wikimodel.XDOMGeneratorListener;
> import org.xwiki.rendering.parser.ImageParser;
> import org.xwiki.rendering.parser.Parser;
> import org.xwiki.rendering.parser.LinkParser;
> @@ -31,30 +30,47 @@
> import java.io.Reader;
>
> /**
> + * Common code for all WikiModel-based parsers.
> + *
> * @version $Id$
> * @since 1.5M2
> */
> public abstract class AbstractWikiModelParser extends AbstractLogEnabled
> implements Parser
> {
> + /**
> + * @see #setLinkParser(LinkParser)
> + */
> protected LinkParser linkParser;
>
> + /**
> + * @see #setImageParser(ImageParser)
> + */
> protected ImageParser imageParser;
> -
> +
> + /**
> + * @return the WikiModel parser instance to use to parse input content.
> + * @throws ParseException when there's a problem creating an instance of
> the parser to use
> + */
> public abstract IWikiParser createWikiModelParser() throws ParseException;
>
> /**
> - * @return the parser to use for the link labels, since wikimodel does
> not support wiki syntax in links and they
> - * need to be handled in the XDOMGeneratorListener. By default,
> the link label parser is the same one as the
> - * source parser (this), but you should overwrite this method if
> you need to use a special parser.
> + * @return the syntax parser to use for parsing link labels, since
> wikimodel does not support wiki syntax
> + * in links and they need to be handled in the
> XDOMGeneratorListener. By default, the link label
> + * parser is the same one as the source parser (this), but you
> should overwrite this method if you
> + * need to use a special parser.
> * @see XDOMGeneratorListener#XDOMGeneratorListener(Parser, LinkParser,
> ImageParser)
> * @see http://code.google.com/p/wikimodel/issues/detail?id=87
> * TODO: Remove this method when the parser will not need to be passed to
> the XDOMGeneratorListener anymore.
> */
> - public Parser getLinkLabelParser()
> + protected Parser getLinkLabelParser()
> {
> return this;
> }
>
> + /**
> + * {...@inheritdoc}
> + * @see Parser#parse(Reader)
> + */
> public XDOM parse(Reader source) throws ParseException
> {
> IWikiParser parser = createWikiModelParser();
> @@ -70,4 +86,26 @@
> }
> return listener.getXDOM();
> }
> +
> + /**
> + * Sets the parser to use when parsing links. We need to parse links to
> transform a link reference passed as a raw
> + * string by WikiModel into a {...@link
> org.xwiki.rendering.listener.Link} object.
> + *
> + * @param linkParser the link parser to use
> + */
> + public void setLinkParser(LinkParser linkParser)
> + {
> + this.linkParser = linkParser;
> + }
> +
> + /**
> + * Sets the parser to use when parsing image references (eg
> "[email protected]" in XWiki Syntax 2.0).
> + * We transform a raw image reference into a {...@link
> org.xwiki.rendering.listener.Image} object.
> + *
> + * @param imageParser the image parser to use
> + */
> + public void setImageParser(ImageParser imageParser)
> + {
> + this.imageParser = imageParser;
> + }
> }
>
> _______________________________________________
> notifications mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/notifications
>
--
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs