You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by jv...@apache.org on 2006/02/06 23:31:59 UTC
svn commit: r375400 [1/2] - in /maven/doxia/trunk/doxia-modules:
doxia-module-confluence/ doxia-module-confluence/src/
doxia-module-confluence/src/main/ doxia-module-confluence/src/main/java/
doxia-module-confluence/src/main/java/org/ doxia-module-conf...
Author: jvanzyl
Date: Mon Feb 6 14:31:55 2006
New Revision: 375400
URL: http://svn.apache.org/viewcvs?rev=375400&view=rev
Log:
o adding confluence module
Added:
maven/doxia/trunk/doxia-modules/doxia-module-confluence/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlockParser.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableCellBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableCellHeaderBlock.java (with props)
maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableRowBlock.java (with props)
Modified:
maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml Mon Feb 6 14:31:55 2006
@@ -0,0 +1,53 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>doxia-modules</artifactId>
+ <groupId>org.apache.maven.doxia</groupId>
+ <version>1.0-alpha-8-SNAPSHOT</version>
+ </parent>
+ <artifactId>doxia-module-confluence</artifactId>
+ <name>Doxia TWiki sink</name>
+ <version>1.0-alpha-8-SNAPSHOT</version>
+ <developers>
+ <developer>
+ <name>Juan F. Codagnone</name>
+ <email>juan *at* zauber dot. com dot. ar</email>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-3</timezone>
+ </developer>
+ <developer>
+ <name>Jason van Zyl</name>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-5</timezone>
+ </developer>
+ </developers>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-core</artifactId>
+ <version>1.0-alpha-8-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,155 @@
+package org.apache.maven.doxia.module.confluence;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.common.ByLineReaderSource;
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.module.confluence.parser.Block;
+import org.apache.maven.doxia.module.confluence.parser.BlockParser;
+import org.apache.maven.doxia.module.confluence.parser.SectionBlockParser;
+import org.apache.maven.doxia.module.confluence.parser.ParagraphBlockParser;
+import org.apache.maven.doxia.module.confluence.parser.VerbatimBlockParser;
+import org.apache.maven.doxia.module.confluence.parser.HorizontalRuleBlockParser;
+import org.apache.maven.doxia.module.confluence.parser.table.TableBlockParser;
+import org.apache.maven.doxia.module.confluence.parser.list.ListBlockParser;
+import org.apache.maven.doxia.parser.AbstractParser;
+import org.apache.maven.doxia.parser.ParseException;
+import org.apache.maven.doxia.sink.Sink;
+
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @plexus.component role="org.apache.maven.doxia.parser.Parser"
+ * role-hint="confluence"
+ */
+public class ConfluenceParser
+ extends AbstractParser
+{
+ private BlockParser[] parsers;
+
+ public ConfluenceParser()
+ {
+ BlockParser headingParser = new SectionBlockParser();
+ BlockParser verbatimParser = new VerbatimBlockParser();
+ BlockParser horizontalRuleParser = new HorizontalRuleBlockParser();
+ BlockParser paragraphParser = new ParagraphBlockParser();
+ BlockParser listParser = new ListBlockParser();
+ BlockParser tableParser = new TableBlockParser();
+
+ parsers = new BlockParser[]
+ {
+ headingParser,
+ verbatimParser,
+ horizontalRuleParser,
+ listParser,
+ tableParser,
+ paragraphParser
+ };
+ }
+
+ //TODO:
+ // (empty line) Produces a new paragraph
+ // \\ Creates a line break. Not often needed, most of the time Confluence will guess new lines for you appropriately.
+ // better support for anchors
+
+ public List parse( ByLineSource source )
+ throws ParseException
+ {
+ List blocks = new ArrayList();
+
+ String line;
+
+ while ( ( line = source.getNextLine() ) != null )
+ {
+ boolean accepted = false;
+
+ for ( int i = 0; i < parsers.length; i++ )
+ {
+ BlockParser parser = parsers[i];
+
+ if ( line.trim().length() == 0 )
+ {
+ continue;
+ }
+
+ if ( parser.accept( line, source ) )
+ {
+ /*
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( "line = " + line );
+ System.out.println( "line accepted by: " + parser );
+ System.out.println( "------------------------------------------------------------" );
+ */
+
+ accepted = true;
+
+ blocks.add( parser.visit( line, source ) );
+
+ break;
+ }
+ }
+
+ /*
+ if ( !accepted )
+ {
+ throw new ParseException( "don't know how to handle line: " + source.getLineNumber() + ": " + line );
+ }
+ */
+ }
+
+ return blocks;
+ }
+
+ public synchronized void parse( Reader reader, Sink sink )
+ throws ParseException
+ {
+ List blocks;
+
+ ByLineSource source = new ByLineReaderSource( reader );
+
+ try
+ {
+ blocks = parse( source );
+ }
+ catch ( ParseException e )
+ {
+ throw e;
+ }
+ catch ( Exception e )
+ {
+ throw new ParseException( e, source.getName(), source.getLineNumber() );
+ }
+
+ sink.head();
+
+ sink.head_();
+
+ sink.body();
+
+ for ( Iterator i = blocks.iterator(); i.hasNext(); )
+ {
+ Block block = (Block) i.next();
+
+ block.traverse( sink );
+ }
+
+ sink.body_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,44 @@
+package org.apache.maven.doxia.module.confluence;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.site.module.AbstractSiteModule;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:AptSiteModule.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $
+ * @plexus.component role="org.apache.maven.doxia.site.module.SiteModule"
+ * role-hint="confluence"
+ */
+public class ConfluenceSiteModule
+ extends AbstractSiteModule
+{
+ public String getSourceDirectory()
+ {
+ return "confluence";
+ }
+
+ public String getExtension()
+ {
+ return "confluence";
+ }
+
+ public String getParserId()
+ {
+ return "confluence";
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSiteModule.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,62 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Iterator;
+
+import org.apache.maven.doxia.sink.Sink;
+
+public abstract class AbstractFatherBlock
+ implements Block
+{
+ private List blocks;
+
+ public abstract void before( Sink sink );
+
+ public abstract void after( Sink sink );
+
+ public AbstractFatherBlock( List childBlocks )
+ {
+ if ( childBlocks == null )
+ {
+ throw new IllegalArgumentException( "argument can't be null" );
+ }
+
+ this.blocks = childBlocks;
+ }
+
+ public void traverse( Sink sink )
+ {
+ before( sink );
+
+ for ( Iterator i = blocks.iterator(); i.hasNext(); )
+ {
+ Block block = (Block) i.next();
+
+ block.traverse( sink );
+ }
+
+ after( sink );
+ }
+
+ public List getBlocks()
+ {
+ return blocks;
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AbstractFatherBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,40 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+public class AnchorBlock
+ implements Block
+{
+ private String name;
+
+ public AnchorBlock( String name ) throws IllegalArgumentException
+ {
+ if ( name == null )
+ {
+ throw new IllegalArgumentException( "argument can't be null" );
+ }
+ this.name = name;
+ }
+
+ public void traverse( Sink sink )
+ {
+ sink.anchor( name );
+ sink.anchor_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/AnchorBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+public interface Block
+{
+ void traverse( Sink sink );
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/Block.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.module.confluence.parser.Block;
+import org.apache.maven.doxia.parser.ParseException;
+
+public interface BlockParser
+{
+ boolean accept( String line, ByLineSource source );
+
+ Block visit( String line, ByLineSource source ) throws ParseException;
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,40 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+public class BoldBlock
+ extends AbstractFatherBlock
+{
+ public BoldBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.bold();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.bold_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/BoldBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+public class HorizontalRuleBlock
+ implements Block
+{
+ public void traverse( Sink sink )
+ {
+ sink.horizontalRule();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,35 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.parser.ParseException;
+
+public class HorizontalRuleBlockParser
+ implements BlockParser
+{
+ public boolean accept( String line, ByLineSource source )
+ {
+ return line.startsWith( "----" );
+ }
+
+ public Block visit( String line, ByLineSource source )
+ throws ParseException
+ {
+ return new HorizontalRuleBlock();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/HorizontalRuleBlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,40 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+public class ItalicBlock
+ extends AbstractFatherBlock
+{
+ public ItalicBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.italic();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.italic_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ItalicBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,48 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+
+public class LinkBlock
+ implements Block
+{
+ private String reference;
+
+ private String text;
+
+ public LinkBlock( String reference, String text )
+ throws IllegalArgumentException
+ {
+ if ( reference == null || text == null )
+ {
+ throw new IllegalArgumentException( "arguments can't be null" );
+ }
+ this.reference = reference;
+ this.text = text;
+ }
+
+ public void traverse( Sink sink )
+ {
+ sink.link( reference );
+
+ sink.text( text );
+
+ sink.link_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/LinkBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+public class MonospaceBlock extends AbstractFatherBlock
+{
+ public MonospaceBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.monospaced();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.monospaced_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/MonospaceBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,45 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+/**
+ * @author Juan F. Codagnone
+ * @since Nov 1, 2005
+ */
+public class ParagraphBlock
+ extends AbstractFatherBlock
+{
+ public ParagraphBlock( List blocks )
+ throws IllegalArgumentException
+ {
+ super( blocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.paragraph();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.paragraph_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,167 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.parser.ParseException;
+import org.codehaus.plexus.util.StringUtils;
+
+public class ParagraphBlockParser
+ implements BlockParser
+{
+ public boolean accept( String line, ByLineSource source )
+ {
+ return true;
+ }
+
+ public Block visit( String line, ByLineSource source )
+ throws ParseException
+ {
+ boolean insideBold = false;
+ boolean insideItalic = false;
+ boolean insideLink = false;
+
+ List blocks = new ArrayList();
+
+ StringBuffer text = new StringBuffer();
+
+ do
+ {
+ if ( line.trim().length() == 0 )
+ {
+ break;
+ }
+
+ for ( int i = 0; i < line.length(); i++ )
+ {
+ char c = line.charAt( i );
+
+ switch ( c )
+ {
+ case '*':
+ if ( insideBold )
+ {
+ TextBlock tb = new TextBlock( text.toString() );
+ blocks.add( new BoldBlock( Arrays.asList( new Block[]{tb} ) ) );
+ text = new StringBuffer();
+ }
+ else
+ {
+ blocks.add( new TextBlock( text.toString() ) );
+ text = new StringBuffer();
+ insideBold = true;
+ }
+
+ break;
+ case '_':
+ if ( insideItalic )
+ {
+ TextBlock tb = new TextBlock( text.toString() );
+ blocks.add( new ItalicBlock( Arrays.asList( new Block[]{tb} ) ) );
+ text = new StringBuffer();
+ }
+ else
+ {
+ blocks.add( new TextBlock( text.toString() ) );
+ text = new StringBuffer();
+ insideItalic = true;
+ }
+
+ break;
+ case '[':
+ insideLink = true;
+ blocks.add( new TextBlock( text.toString() ) );
+ text = new StringBuffer();
+ break;
+ case ']':
+ if ( insideLink )
+ {
+ String link = text.toString();
+
+ if ( link.indexOf( "|" ) > 0 )
+ {
+ String[] pieces = StringUtils.split( text.toString(), "|" );
+ blocks.add( new LinkBlock( pieces[1], pieces[0] ) );
+ }
+ else
+ {
+ blocks.add( new LinkBlock( link, link ) );
+ }
+
+ text = new StringBuffer();
+ }
+
+ break;
+ case '{':
+
+ if ( line.charAt( i + 1 ) == '{' )
+ {
+ i++;
+ blocks.add( new TextBlock( text.toString() ) );
+ text = new StringBuffer();
+ }
+ else
+ {
+ text.append( c );
+ }
+
+ break;
+ case '}':
+
+ System.out.println( "line = " + line );
+
+ if ( line.charAt( i + 1 ) == '}' )
+ {
+ i++;
+ TextBlock tb = new TextBlock( text.toString() );
+ blocks.add( new MonospaceBlock( Arrays.asList( new Block[]{tb} ) ) );
+ text = new StringBuffer();
+ }
+ else
+ {
+ text.append( c );
+ }
+
+ break;
+ default:
+ text.append( c );
+ }
+ }
+ }
+ // TODO: instead of just flying along we should probably test new lines in the other parsers
+ // to make sure there aren't things that should be handled by other parsers. For example, right
+ // now:
+ // Blah blah blah blah
+ // # one
+ // # two
+ //
+ // Will not get processed correctly. This parser will try to deal with it when it should be handled
+ // by the list parser.
+ while ( ( line = source.getNextLine() ) != null );
+
+ if ( text.length() > 0 )
+ {
+ blocks.add( new TextBlock( text.toString() ) );
+ }
+
+ return new ParagraphBlock( blocks );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/ParagraphBlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,79 @@
+package org.apache.maven.doxia.module.confluence.parser;
+
+import org.apache.maven.doxia.sink.Sink;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class SectionBlock
+ implements Block
+{
+ private String title;
+
+ private int level;
+
+ public SectionBlock( String title, int level )
+ {
+ this.title = title;
+ this.level = level;
+ }
+
+ public void traverse( Sink sink )
+ {
+ if ( level == 1 )
+ {
+ sink.section1();
+ sink.sectionTitle1();
+ }
+ else if ( level == 2 )
+ {
+ sink.section2();
+ sink.sectionTitle2();
+ }
+ else if ( level == 3 )
+ {
+ sink.section3();
+ sink.sectionTitle3();
+ }
+ else if ( level == 4 )
+ {
+ sink.section4();
+ sink.sectionTitle4();
+ }
+ else if ( level == 5 )
+ {
+ sink.section5();
+ sink.sectionTitle5();
+ }
+
+ sink.text( title );
+
+ if ( level == 1 )
+ {
+ sink.section1_();
+ sink.sectionTitle1_();
+ }
+ else if ( level == 2 )
+ {
+ sink.section2_();
+ sink.sectionTitle2_();
+ }
+ else if ( level == 3 )
+ {
+ sink.section3_();
+ sink.sectionTitle3_();
+
+ }
+ else if ( level == 4 )
+ {
+ sink.section4_();
+ sink.sectionTitle4_();
+ }
+ else if ( level == 5 )
+ {
+ sink.section5_();
+ sink.sectionTitle5_();
+ }
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.doxia.module.confluence.parser;
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.parser.ParseException;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class SectionBlockParser
+ implements BlockParser
+{
+ public boolean accept( String line, ByLineSource source )
+ {
+ if ( line.startsWith( "h1." ) )
+ {
+ return true;
+ }
+ else if ( line.startsWith( "h2." ) )
+ {
+ return true;
+ }
+ else if ( line.startsWith( "h3." ) )
+ {
+ return true;
+ }
+ else if ( line.startsWith( "h4." ) )
+ {
+ return true;
+ }
+ else if ( line.startsWith( "h5." ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Block visit( String line, ByLineSource source )
+ throws ParseException
+ {
+ int level = Integer.parseInt( Character.toString( line.charAt( 1 ) ) );
+
+ String title = line.substring( 3 );
+
+ return new SectionBlock( title, level );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/SectionBlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.doxia.module.confluence.parser;
+
+import org.apache.maven.doxia.sink.Sink;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class TextBlock
+ implements Block
+{
+ private String text;
+
+ public TextBlock( String text )
+ {
+ this.text = text;
+ }
+
+ public void traverse( Sink sink )
+ {
+ sink.text( text );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/TextBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.doxia.module.confluence.parser;
+
+import org.apache.maven.doxia.sink.Sink;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class VerbatimBlock
+ implements Block
+{
+ private String text;
+
+ public VerbatimBlock( String text )
+ {
+ this.text = text;
+ }
+
+ public void traverse( Sink sink )
+ {
+ sink.verbatim( true );
+
+ sink.text( text );
+
+ sink.verbatim_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.doxia.module.confluence.parser;
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.parser.ParseException;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class VerbatimBlockParser
+ implements BlockParser
+{
+ static String LS = System.getProperty( "line.separator" );
+
+ public boolean accept( String line, ByLineSource source )
+ {
+ if ( line.startsWith( "{code}" ) || line.startsWith( "{noformat}" ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Block visit( String line, ByLineSource source )
+ throws ParseException
+ {
+ StringBuffer text = new StringBuffer();
+
+ while ( ( line = source.getNextLine() ) != null )
+ {
+ if ( line.startsWith( "{code}" ) || line.startsWith( "{noformat}" ) )
+ {
+ break;
+ }
+
+ // TODO
+ text.append( line ).append( LS );
+ }
+
+ return new VerbatimBlock( text.toString() );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/VerbatimBlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,43 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
+
+import java.util.List;/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class BulletedListBlock
+ extends ListBlock
+{
+ public BulletedListBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.list();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.list_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/BulletedListBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,32 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
+
+import java.util.List;/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public abstract class ListBlock
+ extends AbstractFatherBlock
+{
+ protected ListBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,113 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+import org.apache.maven.doxia.module.common.ByLineSource;
+import org.apache.maven.doxia.module.confluence.parser.Block;
+import org.apache.maven.doxia.module.confluence.parser.BlockParser;
+import org.apache.maven.doxia.parser.ParseException;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class ListBlockParser
+ implements BlockParser
+{
+ public static int BULLETED_LIST = 0;
+
+ public static int NUMBERED_LIST = 1;
+
+ public boolean accept( String line, ByLineSource source )
+ {
+ String nextLine = null;
+
+ try
+ {
+ nextLine = source.getNextLine();
+
+ source.ungetLine();
+ }
+ catch ( ParseException e )
+ {
+ // do nothing
+ }
+
+ if ( isList( line ) && isList( nextLine ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Block visit( String line, ByLineSource source )
+ throws ParseException
+ {
+ TreeListBuilder treeListBuilder = new TreeListBuilder();
+
+ String l = line;
+
+ do
+ {
+ if ( !isList( l ) )
+ {
+ break;
+ }
+
+ if ( isBulletedList( l ) )
+ {
+ int level = getLevel( l, '*' );
+
+ treeListBuilder.feedEntry( BULLETED_LIST, level, l.substring( level ) );
+ }
+ else
+ {
+ int level = getLevel( l, '#' );
+
+ treeListBuilder.feedEntry( NUMBERED_LIST, level, l.substring( level ) );
+ }
+ }
+ while ( ( l = source.getNextLine() ) != null );
+
+ return treeListBuilder.getBlock();
+ }
+
+ private int getLevel( String line, char c )
+ {
+ int level = 0;
+
+ while ( line.charAt( level ) == c )
+ {
+ level++;
+ }
+
+ return level;
+ }
+
+ private boolean isBulletedList( String line )
+ {
+ return ( line.startsWith( "*" ) || line.startsWith( "-" ) );
+ }
+
+ private boolean isList( String line )
+ {
+ line = line.trim();
+
+ return ( line.startsWith( "*" ) || line.startsWith( "-" ) || line.startsWith( "#" ) );
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListBlockParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,62 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+public class ListItemBlock
+ extends AbstractFatherBlock
+{
+ private ListBlock innerList;
+
+ public ListItemBlock( List blocks )
+ throws IllegalArgumentException
+ {
+ this( blocks, null );
+ }
+
+ public ListItemBlock( List blocks, ListBlock innerList )
+ throws IllegalArgumentException
+ {
+ super( blocks );
+
+ this.innerList = innerList;
+ }
+
+ public void before( Sink sink )
+ {
+ sink.listItem();
+ }
+
+ public void after( Sink sink )
+ {
+ if ( innerList != null )
+ {
+ innerList.traverse( sink );
+ }
+
+ sink.listItem_();
+ }
+
+ public ListBlock getInnerList()
+ {
+ return innerList;
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/ListItemBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,41 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+public class NumberedListBlock
+ extends ListBlock
+{
+ public NumberedListBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.numberedList( Sink.NUMBERING_DECIMAL );
+ }
+
+ public void after( Sink sink )
+ {
+ sink.numberedList_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/NumberedListBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,118 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+/*
+* Copyright 2004-2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class TreeComponent
+{
+ private List children = new ArrayList();
+
+ private String text;
+
+ private TreeComponent father;
+
+ private int type;
+
+ public TreeComponent( TreeComponent father, String text, int type )
+ {
+ this.text = text;
+ this.father = father;
+ this.type = type;
+ }
+
+ public List getChildren()
+ {
+ return children;
+ }
+
+ public TreeComponent addChildren( String t, int ttype )
+ {
+ if ( t == null )
+ {
+ throw new IllegalArgumentException( "argument is null" );
+ }
+
+ TreeComponent ret = new TreeComponent( this, t, ttype );
+
+ children.add( ret );
+
+ return ret;
+ }
+
+ public TreeComponent getFather()
+ {
+ return father;
+ }
+
+ public int getDepth()
+ {
+ int ret = 0;
+
+ TreeComponent c = this;
+
+ while ( ( c = c.getFather() ) != null )
+ {
+ ret++;
+ }
+
+ return ret;
+ }
+
+ public String toString()
+ {
+ return toString( "" );
+ }
+
+ public String toString( String indent )
+ {
+ StringBuffer sb = new StringBuffer();
+
+ if ( father != null )
+ {
+ sb.append( indent );
+ sb.append( "- " );
+ sb.append( text );
+ sb.append( '\n' );
+ }
+
+ for ( Iterator i = children.iterator(); i.hasNext(); )
+ {
+ TreeComponent lc = (TreeComponent) i.next();
+
+ sb.append( lc.toString( indent + " " ) );
+ }
+
+ return sb.toString();
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeComponent.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,133 @@
+package org.apache.maven.doxia.module.confluence.parser.list;
+
+import org.apache.maven.doxia.module.confluence.parser.TextBlock;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+/*
+* Copyright 2004-2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+
+public class TreeListBuilder
+{
+ private TreeComponent root;
+
+ private TreeComponent current;
+
+ public TreeListBuilder()
+ throws IllegalArgumentException
+ {
+ root = new TreeComponent( null, "root", 0 );
+
+ current = root;
+ }
+
+ public void feedEntry( int type, int level, String text )
+ {
+ int currentDepth = current.getDepth();
+
+ int incomingLevel = level - 1;
+
+ if ( incomingLevel == currentDepth )
+ {
+ // nothing to move
+ }
+ else if ( incomingLevel > currentDepth )
+ {
+ // el actual ahora es el �ltimo que insert�
+ List components = current.getChildren();
+
+ if ( components.size() == 0 )
+ {
+ /* for example:
+ * * item1
+ * * item2
+ */
+ for ( int i = 0, n = incomingLevel - currentDepth; i < n; i++ )
+ {
+ current = current.addChildren( "", type );
+ }
+ }
+ else
+ {
+ current = (TreeComponent) components.get( components.size() - 1 );
+ }
+ }
+ else
+ {
+ for ( int i = 0, n = currentDepth - incomingLevel; i < n; i++ )
+ {
+ current = current.getFather();
+
+ if ( current == null )
+ {
+ throw new IllegalStateException();
+ }
+ }
+ }
+ current.addChildren( text, type );
+ }
+
+ public ListBlock getBlock()
+ {
+ return getList( root );
+ }
+
+ private ListBlock getList( TreeComponent treeComponent )
+ {
+ List list = getListItems( treeComponent );
+
+ int type = ((TreeComponent)treeComponent.getChildren().get(0)).getType();
+
+ if ( type == ListBlockParser.BULLETED_LIST )
+ {
+ return new BulletedListBlock( list );
+ }
+ else
+ {
+ return new NumberedListBlock( list );
+ }
+ }
+
+ private List getListItems( TreeComponent tc )
+ {
+ List blocks = new ArrayList();
+
+ for ( Iterator i = tc.getChildren().iterator(); i.hasNext(); )
+ {
+ TreeComponent child = (TreeComponent) i.next();
+
+ List text = new ArrayList();
+
+ if ( child.getFather() != null )
+ {
+ text.add( new TextBlock( child.getText() ) );
+ }
+
+ if ( child.getChildren().size() != 0 )
+ {
+ blocks.add( new ListItemBlock( text, getList( child ) ) );
+ }
+ else
+ {
+ blocks.add( new ListItemBlock( text ) );
+ }
+ }
+
+ return blocks;
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/list/TreeListBuilder.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java?rev=375400&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java Mon Feb 6 14:31:55 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.doxia.module.confluence.parser.table;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.doxia.module.confluence.parser.AbstractFatherBlock;
+import org.apache.maven.doxia.sink.Sink;
+
+import java.util.List;
+
+
+public class TableBlock
+ extends AbstractFatherBlock
+{
+ public TableBlock( List childBlocks )
+ {
+ super( childBlocks );
+ }
+
+ public void before( Sink sink )
+ {
+ sink.table();
+ }
+
+ public void after( Sink sink )
+ {
+ sink.table_();
+ }
+}
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/parser/table/TableBlock.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"