Added: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java?view=auto&rev=519328
==============================================================================
--- 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
 (added)
+++ 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
 Sat Mar 17 07:44:23 2007
@@ -0,0 +1,700 @@
+package org.apache.maven.doxia.module.apt;
+
+/*
+ * 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.
+ */
+
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Stack;
+
+import org.apache.maven.doxia.module.HtmlTools;
+import org.apache.maven.doxia.sink.SinkAdapter;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * APT Sink implementation.
+ * @author eredmond
+ */
+public class AptSink extends SinkAdapter
+{
+    private static final String EOL = System.getProperty("line.separator");
+    private StringBuffer buffer;
+    private StringBuffer tableCaptionBuffer;
+    private String author;
+    private String title;
+    private String date;
+    private boolean tableCaptionFlag;
+    private boolean headerFlag;
+    private boolean bufferFlag;
+    private boolean itemFlag;
+    private boolean verbatimFlag;
+    private boolean boxed;
+    private boolean gridFlag;
+    private int cellCount;
+    private PrintWriter writer;
+    private int cellJustif[];
+    private String rowLine;
+    private String listNestingIndent;
+    private Stack listStyles;
+
+    public AptSink( Writer writer )
+    {
+       this.buffer = new StringBuffer();
+        this.tableCaptionBuffer = new StringBuffer();
+        this.writer = new PrintWriter(writer);
+        this.listNestingIndent = "";
+        this.listStyles = new Stack();
+    }
+
+    protected StringBuffer getBuffer()
+    {
+        return buffer;
+    }
+
+    protected void setHeadFlag(boolean headFlag)
+    {
+        this.headerFlag = headFlag;
+    }
+
+    protected void resetState()
+    {
+        headerFlag = false;
+        resetBuffer();
+        itemFlag = false;
+        verbatimFlag = false;
+        cellCount = 0;
+    }
+
+    protected void resetBuffer()
+    {
+        buffer = new StringBuffer();
+    }
+
+    protected void resetTableCaptionBuffer()
+    {
+       tableCaptionBuffer = new StringBuffer();
+    }
+
+    public void head()
+    {
+       resetState();
+       headerFlag = true;
+    }
+
+    public void head_()
+    {
+        headerFlag = false;
+
+        write( " -----" + EOL );
+        write( " " + title + EOL  );
+        write( " -----" + EOL );
+        write( " " + author + EOL  );
+        write( " -----" + EOL );
+        write( " " + date + EOL  );
+        write( " -----" + EOL );
+    }
+
+    public void title_()
+    {
+        if(buffer.length() > 0)
+        {
+               title = buffer.toString();
+            resetBuffer();
+        }
+    }
+
+    public void author_()
+    {
+        if(buffer.length() > 0)
+        {
+               author = buffer.toString();
+            resetBuffer();
+        }
+    }
+
+    public void date_()
+    {
+        if(buffer.length() > 0)
+        {
+               date = buffer.toString();
+            resetBuffer();
+        }
+    }
+
+    public void section1_()
+    {
+        write( EOL );
+    }
+
+    public void section2_()
+    {
+        write( EOL );
+    }
+
+    public void section3_()
+    {
+        write( EOL );
+    }
+
+    public void section4_()
+    {
+        write( EOL );
+    }
+
+    public void section5_()
+    {
+        write( EOL );
+    }
+
+    public void sectionTitle1()
+    {
+        write( EOL );
+    }
+
+    public void sectionTitle1_()
+    {
+        write( EOL + EOL );
+    }
+
+    public void sectionTitle2()
+    {
+        write( EOL + "*" );
+    }
+
+    public void sectionTitle2_()
+    {
+        write( EOL + EOL );
+    }
+
+    public void sectionTitle3()
+    {
+        write( EOL + "**" );
+    }
+
+    public void sectionTitle3_()
+    {
+        write( EOL + EOL );
+    }
+
+    public void sectionTitle4()
+    {
+        write( EOL + "***" );
+    }
+
+    public void sectionTitle4_()
+    {
+        write( EOL + EOL );
+    }
+
+    public void sectionTitle5()
+    {
+        write( EOL + "****" );
+    }
+
+    public void sectionTitle5_()
+    {
+        write( EOL + EOL );
+    }
+
+    public void list()
+    {
+       listNestingIndent += " ";
+       listStyles.push( "*" );
+       write( EOL );
+    }
+
+    public void list_()
+    {
+       if( listNestingIndent.length() <= 1 )
+               write( EOL + listNestingIndent + "[]" + EOL );
+       else
+               write( EOL );
+        listNestingIndent = StringUtils.chomp( listNestingIndent, " " );
+       listStyles.pop();
+       itemFlag = false;
+    }
+
+    public void listItem()
+    {
+       //if( !numberedList )
+       //write( EOL + listNestingIndent + "*" );
+       //else
+       numberedListItem();
+        itemFlag = true;
+    }
+
+    public void listItem_()
+    {
+       write( EOL );
+    }
+
+    public void numberedList( int numbering )
+    {
+       listNestingIndent += " ";
+        write( EOL );
+
+        String style;
+        switch ( numbering )
+        {
+            case NUMBERING_UPPER_ALPHA:
+                style = "A";
+                break;
+            case NUMBERING_LOWER_ALPHA:
+                style = "a";
+                break;
+            case NUMBERING_UPPER_ROMAN:
+                style = "I";
+                break;
+            case NUMBERING_LOWER_ROMAN:
+                style = "i";
+                break;
+            case NUMBERING_DECIMAL:
+            default:
+                style = "1";
+        }
+
+        listStyles.push( style );
+    }
+
+    public void numberedList_()
+    {
+       if( listNestingIndent.length() <= 1 )
+               write( EOL + listNestingIndent + "[]" + EOL );
+       else
+               write( EOL );
+       listNestingIndent = StringUtils.chomp( listNestingIndent, " " );
+       listStyles.pop();
+        itemFlag = false;
+    }
+
+    public void numberedListItem()
+    {
+       String style = (String)listStyles.peek();
+       if( style == "*" )
+               write( EOL + listNestingIndent + "* " );
+       else
+               write( EOL + listNestingIndent + "[[" + style + "]] " );
+        itemFlag = true;
+    }
+
+    public void numberedListItem_()
+    {
+        write( EOL );
+    }
+
+    public void definitionList()
+    {
+        write( EOL );
+    }
+
+    public void definitionList_()
+    {
+        write( EOL );
+        itemFlag = false;
+    }
+
+    public void definedTerm()
+    {
+        write( EOL + " [" );
+    }
+
+    public void definedTerm_()
+    {
+        write("]");
+    }
+
+    public void definition()
+    {
+        itemFlag = true;
+    }
+
+    public void definition_()
+    {
+        write( EOL );
+    }
+
+    public void pageBreak()
+    {
+       // TODO: APT parse defect... pagebreak is never used.
+       write( EOL + "^L" + EOL );
+    }
+
+    public void paragraph()
+    {
+        if(!itemFlag)
+            write( EOL + " ");
+    }
+
+    public void paragraph_()
+    {
+        if(itemFlag)
+            itemFlag = false;
+        else
+            write( EOL + EOL );
+    }
+
+    public void verbatim( boolean boxed )
+    {
+        verbatimFlag = true;
+        this.boxed = boxed;
+        if( boxed )
+               write("\n+------+\n");
+        else
+               write("\n------\n");
+    }
+
+    public void verbatim_()
+    {
+        if( boxed )
+               write("\n+------+\n");
+        else
+               write("\n------\n");
+        boxed = false;
+        verbatimFlag = false;
+    }
+
+    public void horizontalRule()
+    {
+        write(EOL + "========" + EOL );
+    }
+
+    public void table()
+    {
+       write( EOL );
+    }
+
+    public void table_()
+    {
+       if( rowLine != null )
+               write( rowLine );
+       rowLine = null;
+
+       if( tableCaptionBuffer.length() > 0 )
+               text( tableCaptionBuffer.toString() + EOL );
+
+       resetTableCaptionBuffer();
+    }
+
+    public void tableRows(int justification[], boolean grid)
+    {
+        cellJustif = justification;
+        gridFlag = grid;
+    }
+
+    public void tableRows_()
+    {
+        cellJustif = null;
+        gridFlag = false;
+    }
+
+    public void tableRow()
+    {
+       bufferFlag = true;
+       cellCount = 0;
+    }
+
+    public void tableRow_()
+    {
+       bufferFlag = false;
+
+       // write out the header row first, then the data in the buffer
+       buildRowLine();
+
+       write( rowLine );
+
+       // TODO: This will need to be more clever, for multi-line cells
+       if( gridFlag )
+               write( "|" );
+
+               write( buffer.toString() );
+
+       resetBuffer();
+
+       write( EOL );
+
+       // only reset cell count if this is the last row
+       cellCount = 0;
+    }
+
+    private void buildRowLine()
+    {
+       StringBuffer rowLine = new StringBuffer();
+       rowLine.append( "*--" );
+
+       for(int i = 0; i < cellCount; i++)
+       {
+               if(cellJustif != null)
+                       switch(cellJustif[i])
+                       {
+                       case 1:
+                               rowLine.append( "--+" );
+                               break;
+                       case 2:
+                               rowLine.append( "--:" );
+                               break;
+                       default:
+                               rowLine.append( "--*" );
+                       }
+               else
+                       rowLine.append( "--*" );
+       }
+       rowLine.append( EOL );
+
+       this.rowLine = rowLine.toString();
+    }
+
+    public void tableCell_()
+    {
+        tableCell_(false);
+    }
+
+    public void tableHeaderCell_()
+    {
+        tableCell_(true);
+    }
+
+    public void tableCell_(boolean headerRow)
+    {
+        buffer.append("|");
+        cellCount++;
+    }
+
+    public void tableCaption()
+    {
+       tableCaptionFlag = true;
+    }
+
+    public void tableCaption_()
+    {
+       tableCaptionFlag = false;
+    }
+
+    public void figureCaption_()
+    {
+        write( EOL );
+    }
+
+    public void figureGraphics(String name)
+    {
+        write( EOL + "[" + name + "] ");
+    }
+
+    public void anchor(String name)
+    {
+//     String id = HtmlTools.encodeId(name);
+       write("{");
+    }
+
+    public void anchor_()
+    {
+       write("}");
+    }
+
+    public void link(String name)
+    {
+        if(!headerFlag)
+        {
+               write("{{{");
+               text( name );
+               write( "}" );
+        }
+    }
+
+    public void link_()
+    {
+        if(!headerFlag)
+        {
+               write( "}}" );
+        }
+    }
+
+    public void link(String name, String target)
+    {
+        if(!headerFlag)
+        {
+               write("{{{");
+               text( target );
+               write( "}" );
+               text( name );
+        }
+    }
+
+    public void italic()
+    {
+        if(!headerFlag)
+               write("<");
+    }
+
+    public void italic_()
+    {
+        if(!headerFlag)
+               write(">");
+    }
+
+    public void bold()
+    {
+        if(!headerFlag)
+               write("<<");
+    }
+
+    public void bold_()
+    {
+        if(!headerFlag)
+               write(">>");
+    }
+
+    public void monospaced()
+    {
+        if(!headerFlag)
+               write("<<<");
+    }
+
+    public void monospaced_()
+    {
+        if(!headerFlag)
+               write(">>>");
+    }
+
+    public void lineBreak()
+    {
+        if(headerFlag || bufferFlag)
+            buffer.append(EOL);
+        else
+            write( "\\" + EOL);
+    }
+
+    public void nonBreakingSpace()
+    {
+        if(headerFlag || bufferFlag)
+            buffer.append("\\ ");
+        else
+            write( "\\ " );
+    }
+
+    public void text( String text )
+    {
+       if( tableCaptionFlag )
+               tableCaptionBuffer.append( text );
+       else if( headerFlag || bufferFlag )
+            buffer.append(text);
+        else if( verbatimFlag )
+            verbatimContent(text);
+        else
+            content(text);
+    }
+
+    public void rawText(String text)
+    {
+        write(text);
+    }
+
+    protected void write(String text)
+    {
+       writer.write(text);
+    }
+
+    protected void content(String text)
+    {
+        write(escapeAPT(text));
+    }
+
+    protected void verbatimContent(String text)
+    {
+        write(escapeAPT(text));
+    }
+
+    public static String encodeFragment(String text)
+    {
+        return HtmlTools.encodeFragment(text);
+    }
+
+    public static String encodeURL(String text)
+    {
+        return HtmlTools.encodeURL(text);
+    }
+
+    public void flush()
+    {
+        writer.flush();
+    }
+
+    public void close()
+    {
+        writer.close();
+    }
+
+    /**
+     * Escape special characters in a text in APT:
+     *
+     * <pre>
+     * \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\
+     * </pre>
+     *
+     * @param text the String to escape, may be null
+     * @return the text escaped, "" if null String input
+     */
+    private static String escapeAPT( String text )
+    {
+        if ( text == null )
+        {
+            return "";
+        }
+
+        int length = text.length();
+        StringBuffer buffer = new StringBuffer( length );
+
+        for ( int i = 0; i < length; ++i )
+        {
+            char c = text.charAt( i );
+            switch ( c )
+            { // 0080
+                case '\\':
+                case '~':
+                case '=':
+                case '-':
+                case '+':
+                case '*':
+                case '[':
+                case ']':
+                case '<':
+                case '>':
+                case '{':
+                case '}':
+                    buffer.append( '\\' );
+                    buffer.append( c );
+                    break;
+                default:
+                       if( c > 127 )
+                       {
+                               buffer.append( "\\u" );
+                               String hex = Integer.toHexString( c );
+                               if( hex.length() == 2 )
+                               buffer.append( "00" );
+                               else if( hex.length() == 3 )
+                               buffer.append( "0" );
+                               buffer.append( hex );
+                       }
+                       else
+                               buffer.append( c );
+            }
+        }
+
+        return buffer.toString();
+    }
+}

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java?view=auto&rev=519328
==============================================================================
--- 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java
 (added)
+++ 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java
 Sat Mar 17 07:44:23 2007
@@ -0,0 +1,47 @@
+package org.apache.maven.doxia.module.apt;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.doxia.site.module.AbstractSiteModule;
+
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
+ * @version $Id:AptSiteModule.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 
Nov 2005) brett $
+ * @plexus.component
+ * role-hint="apt"
+ */
+public class AptSiteModule
+    extends AbstractSiteModule
+{
+    public String getSourceDirectory()
+    {
+        return "apt";
+    }
+
+    public String getExtension()
+    {
+        return "apt";
+    }
+
+    public String getParserId()
+    {
+        return "apt";
+    }
+}

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSiteModule.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java?view=auto&rev=519328
==============================================================================
--- 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
 (added)
+++ 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
 Sat Mar 17 07:44:23 2007
@@ -0,0 +1,31 @@
+package org.apache.maven.doxia.module.apt;
+
+/*
+ * 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.
+ */
+
+public interface AptSource
+{
+    String getNextLine()
+        throws AptParseException;
+
+    String getName();
+
+    int getLineNumber();
+}
+

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java?view=auto&rev=519328
==============================================================================
--- 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
 (added)
+++ 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
 Sat Mar 17 07:44:23 2007
@@ -0,0 +1,147 @@
+package org.apache.maven.doxia.module.apt;
+
+/*
+ * 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.
+ */
+
+import java.io.FileReader;
+import java.io.Reader;
+import java.io.StringWriter;
+
+import org.apache.maven.doxia.parser.AbstractParserTestCase;
+import org.apache.maven.doxia.parser.Parser;
+import org.apache.maven.doxia.sink.Sink;
+
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Siveton</a>
+ * @version $Id$
+ */
+public class AptParserTest
+    extends AbstractParserTestCase
+{
+    private static final String EOL = System.getProperty( "line.separator" );
+
+    private AptParser parser;
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        parser = (AptParser) lookup( Parser.ROLE, "apt" );
+    }
+
+    /**
+     * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getParser()
+     */
+    protected Parser getParser()
+    {
+        return parser;
+    }
+
+    /**
+     * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getDocument()
+     */
+    protected String getDocument()
+    {
+        return "src/test/site/apt/linebreak.apt";
+    }
+
+    /**
+     * @throws Exception
+     */
+    public void testLineBreak()
+        throws Exception
+    {
+        StringWriter output = null;
+        Reader reader = null;
+
+        try
+        {
+            output = new StringWriter();
+            reader = new FileReader( getTestFile( getBasedir(), getDocument() 
) );
+
+            Sink sink = new AptSink( output );
+            getParser().parse( reader, sink );
+
+            assertTrue( output.toString().indexOf( "Line\\" + EOL + "break." ) 
!= -1 );
+        }
+        finally
+        {
+            output.close();
+            reader.close();
+        }
+    }
+
+    /**
+     * @throws Exception
+     */
+    public void testSnippetMacro()
+        throws Exception
+    {
+        StringWriter output = null;
+        Reader reader = null;
+
+        try
+        {
+            output = new StringWriter();
+            reader = new FileReader( getTestFile( getBasedir(), 
"src/test/site/apt/macro.apt" ) );
+
+            Sink sink = new AptSink( output );
+            getParser().parse( reader, sink );
+
+            assertTrue( output.toString().indexOf( 
"<modelVersion\\>4.0.0\\</modelVersion\\>" ) != -1 );
+        }
+        finally
+        {
+            output.close();
+            reader.close();
+        }
+    }
+
+    /**
+     * @throws Exception
+     */
+    public void testTocMacro()
+        throws Exception
+    {
+        StringWriter output = null;
+        Reader reader = null;
+
+        try
+        {
+            output = new StringWriter();
+            reader = new FileReader( getTestFile( getBasedir(), 
"src/test/site/apt/toc.apt" ) );
+
+            Sink sink = new AptSink( output );
+            getParser().parse( reader, sink );
+
+            // No section, only subsection 1 and 2
+            assertTrue( output.toString().indexOf( "* 
{{{#subsection_1}SubSection 1}}" ) != -1 );
+            assertTrue( output.toString().indexOf( "* 
{{{#subsection_1211}SubSection 1211}}" ) == -1 );
+        }
+        finally
+        {
+            output.close();
+            reader.close();
+        }
+    }
+}

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java?view=auto&rev=519328
==============================================================================
--- 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
 (added)
+++ 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
 Sat Mar 17 07:44:23 2007
@@ -0,0 +1,48 @@
+package org.apache.maven.doxia.module.apt;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.doxia.sink.AbstractSinkTestCase;
+import org.apache.maven.doxia.sink.Sink;
+
+public class AptSinkTest
+       extends AbstractSinkTestCase
+{
+    protected String outputExtension()
+    {
+        return "apt";
+    }
+
+    public void testApt()
+           throws Exception
+       {
+           Sink sink = createSink();
+
+           new AptParser().parse( getTestReader(), createSink() );
+
+           sink.flush();
+       }
+
+    protected Sink createSink()
+        throws Exception
+    {
+        return new AptSink( getTestWriter() );
+    }
+}

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"


Reply via email to