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/07 05:46:40 UTC

svn commit: r375482 - in /maven/doxia/trunk/doxia-modules: doxia-module-confluence/ doxia-module-twiki/ doxia-modules-docbook/ doxia-modules-docbook/src/ doxia-modules-docbook/src/main/ doxia-modules-docbook/src/main/java/ doxia-modules-docbook/src/mai...

Author: jvanzyl
Date: Mon Feb  6 20:46:31 2006
New Revision: 375482

URL: http://svn.apache.org/viewcvs?rev=375482&view=rev
Log:
o adding docbook module

Added:
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml   (with props)
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java   (with props)
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java   (with props)
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSiteModule.java   (with props)
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java   (with props)
    maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java   (with props)
Modified:
    maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml
    maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml

Modified: 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=375482&r1=375481&r2=375482&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-confluence/pom.xml Mon Feb  6 20:46:31 2006
@@ -6,7 +6,7 @@
     <version>1.0-alpha-8-SNAPSHOT</version>
   </parent>
   <artifactId>doxia-module-confluence</artifactId>
-  <name>Doxia TWiki sink</name>
+  <name>Doxia Confluence Module</name>
   <version>1.0-alpha-8-SNAPSHOT</version>
   <developers>
     <developer>
@@ -25,19 +25,6 @@
       <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>

Modified: maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml?rev=375482&r1=375481&r2=375482&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-twiki/pom.xml Mon Feb  6 20:46:31 2006
@@ -6,7 +6,7 @@
     <version>1.0-alpha-8-SNAPSHOT</version>
   </parent>
   <artifactId>doxia-module-twiki</artifactId>
-  <name>Doxia TWiki sink</name>
+  <name>Doxia TWiki Module</name>
   <version>1.0-alpha-8-SNAPSHOT</version>
   <developers>
     <developer>
@@ -18,19 +18,6 @@
       <timezone>-3</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>

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml Mon Feb  6 20:46:31 2006
@@ -0,0 +1,24 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>doxia</artifactId>
+    <groupId>org.apache.maven.doxia</groupId>
+    <version>1.0-alpha-8-SNAPSHOT</version>
+  </parent>
+  <artifactId>doxia-module-docbook</artifactId>
+  <name>Doxia Docbook Module</name>
+  <version>1.0-alpha-8-SNAPSHOT</version>
+  <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>
+</project>

Propchange: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java Mon Feb  6 20:46:31 2006
@@ -0,0 +1,705 @@
+package org.apache.maven.doxia.module.docbook;
+
+/*
+ * 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.parser.ParseException;
+import org.apache.maven.doxia.parser.Parser;
+import org.apache.maven.doxia.sink.Sink;
+import org.codehaus.plexus.util.xml.pull.MXParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Stack;
+
+/**
+ * Parse a DocBook document and emit events into the specified doxia
+ * Sink.
+ *
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:DocBookParser.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $
+ * @plexus.component role="org.apache.maven.doxia.parser.Parser"
+ * role-hint="doc-book"
+ */
+public class DocBookParser
+    implements Parser
+{
+    /**
+     * Level counter for calculating the section level.
+     */
+    private int level = 0;
+
+    /**
+     * A selective stack of parent elements
+     */
+    private Stack parent = new Stack();
+
+    /**
+     * The list of elements the parse has been unable to handle
+     */
+    private Collection failedElements = new HashSet();
+
+    /**
+     * The list of DocBook elements that introduce a new level of
+     * hierarchy.
+     */
+    private static final Collection hierElements = new HashSet();
+
+    /**
+     * The list of DocBook elements that will be rendered verbatim
+     */
+    private static final Collection verbatimElements = new HashSet();
+
+    /**
+     * The list of DocBook elements that will be rendered inline and bold
+     */
+    private static final Collection boldElements = new HashSet();
+
+    /**
+     * The list of DocBook elements that will be rendered inline and italic
+     */
+    private static final Collection italicElements = new HashSet();
+
+    /**
+     * The list of DocBook elements that will be rendered inline and monospace
+     */
+    private static final Collection monospaceElements = new HashSet();
+
+    static
+    {
+        DocBookParser.hierElements.add( "set" );
+        DocBookParser.hierElements.add( "book" );
+        DocBookParser.hierElements.add( "part" );
+        DocBookParser.hierElements.add( "chapter" );
+        DocBookParser.hierElements.add( "section" );
+        DocBookParser.hierElements.add( "sect1" );
+        DocBookParser.hierElements.add( "sect2" );
+        DocBookParser.hierElements.add( "sect3" );
+        DocBookParser.hierElements.add( "sect4" );
+        DocBookParser.hierElements.add( "sect5" );
+        DocBookParser.hierElements.add( "article" );
+        DocBookParser.hierElements.add( "preface" );
+        DocBookParser.hierElements.add( "partintro" );
+        DocBookParser.hierElements.add( "appendix" );
+        DocBookParser.hierElements.add( "bibliography" );
+        DocBookParser.hierElements.add( "reference" );
+        DocBookParser.hierElements.add( "bibliography" );
+        DocBookParser.hierElements.add( "bibliodiv" );
+        DocBookParser.hierElements.add( "glossary" );
+        DocBookParser.hierElements.add( "refentry" );
+        DocBookParser.hierElements.add( "refnamediv" );
+        DocBookParser.hierElements.add( "refsection" );
+        DocBookParser.hierElements.add( "refsect1" );
+        DocBookParser.hierElements.add( "refsect2" );
+        DocBookParser.hierElements.add( "refsect3" );
+
+        DocBookParser.verbatimElements.add( "programlisting" );
+        DocBookParser.verbatimElements.add( "screen" );
+        DocBookParser.verbatimElements.add( "literallayout" );
+        DocBookParser.verbatimElements.add( "synopsis" );
+
+        DocBookParser.boldElements.add( "command" );
+        DocBookParser.boldElements.add( "keycap" );
+        DocBookParser.boldElements.add( "shortcut" );
+        DocBookParser.boldElements.add( "userinput" );
+
+        DocBookParser.italicElements.add( "parameter" );
+        DocBookParser.italicElements.add( "replaceable" );
+        DocBookParser.italicElements.add( "medialabel" );
+        DocBookParser.italicElements.add( "structfield" );
+        DocBookParser.italicElements.add( "systemitem" );
+        DocBookParser.italicElements.add( "citetitle" );
+        DocBookParser.italicElements.add( "emphasis" );
+        DocBookParser.italicElements.add( "foreignphrase" );
+        DocBookParser.italicElements.add( "wordasword" );
+
+        DocBookParser.monospaceElements.add( "classname" );
+        DocBookParser.monospaceElements.add( "exceptionname" );
+        DocBookParser.monospaceElements.add( "interfacename" );
+        DocBookParser.monospaceElements.add( "methodname" );
+        DocBookParser.monospaceElements.add( "computeroutput" );
+        DocBookParser.monospaceElements.add( "constant" );
+        DocBookParser.monospaceElements.add( "envar" );
+        DocBookParser.monospaceElements.add( "function" );
+        DocBookParser.monospaceElements.add( "parameter" );
+        DocBookParser.monospaceElements.add( "replaceable" );
+        DocBookParser.monospaceElements.add( "literal" );
+        DocBookParser.monospaceElements.add( "code" );
+        DocBookParser.monospaceElements.add( "option" );
+        DocBookParser.monospaceElements.add( "prompt" );
+        DocBookParser.monospaceElements.add( "structfield" );
+        DocBookParser.monospaceElements.add( "systemitem" );
+        DocBookParser.monospaceElements.add( "structfield" );
+        DocBookParser.monospaceElements.add( "userinput" );
+        DocBookParser.monospaceElements.add( "varname" );
+        DocBookParser.monospaceElements.add( "sgmltag" );
+        DocBookParser.monospaceElements.add( "tag" );//DocBook 5
+        DocBookParser.monospaceElements.add( "uri" );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public void parse( Reader reader, Sink sink )
+        throws ParseException
+    {
+        try
+        {
+            XmlPullParser parser = new MXParser();
+
+            parser.setInput( reader );
+
+            parseDocBook( parser, sink );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new ParseException( "Error parsing the model.", e );
+        }
+        catch ( IOException e )
+        {
+            throw new ParseException( "Error parsing the model.", e );
+        }
+    }
+
+    public void parseDocBook( XmlPullParser parser, Sink sink )
+        throws XmlPullParserException, IOException
+    {
+        int eventType = parser.getEventType();
+
+        while ( eventType != XmlPullParser.END_DOCUMENT )
+        {
+
+            if ( eventType == XmlPullParser.START_TAG )
+            {
+                String id = getAttributeValue( parser, "id" );
+                //catch link targets
+                if ( id != null )
+                {
+                    sink.anchor( id );
+                }
+
+                //If the element introduces a new level of hierarchy, raise the stack
+                if ( hierElements.contains( parser.getName() ) )
+                {
+                    //increase the nesting level
+                    level++;
+                    //if this is the root element, handle it as body
+                    if ( level == 1 )
+                    {
+                        sink.body();
+                    }
+                    else if ( level == 2 )
+                    {
+                        sink.section1();
+                    }
+                    else if ( level == 3 )
+                    {
+                        sink.section2();
+                    }
+                    else if ( level == 4 )
+                    {
+                        sink.section3();
+                    }
+                    else if ( level == 5 )
+                    {
+                        sink.section4();
+                    }
+                    else if ( level == 6 )
+                    {
+                        sink.section5();
+                    }
+                }
+                //Match all *info-Elements for metainformation, but only consider the root element
+                else if ( ( parser.getName().endsWith( "info" ) ) && ( level == 1 ) )
+                {
+                    sink.head();
+                    parent.push( parser.getName() );
+                }
+                //handle lists
+                else if ( parser.getName().equals( "itemizedlist" ) )
+                {
+                    sink.list();
+                    //for itemizedlists in variablelists
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "orderedlist" ) )
+                {
+                    //default enumeration style is decimal
+                    int numeration = Sink.NUMBERING_DECIMAL;
+                    String style = getAttributeValue( parser, "numeration" );
+                    if ( style.equals( "arabic" ) )
+                    {
+                        numeration = Sink.NUMBERING_DECIMAL;
+                    }
+                    else if ( style.equals( "loweralpha" ) )
+                    {
+                        numeration = Sink.NUMBERING_LOWER_ALPHA;
+                    }
+                    else if ( style.equals( "lowerroman" ) )
+                    {
+                        numeration = Sink.NUMBERING_LOWER_ROMAN;
+                    }
+                    else if ( style.equals( "upperalpha" ) )
+                    {
+                        numeration = Sink.NUMBERING_UPPER_ALPHA;
+                    }
+                    else if ( style.equals( "upperroman" ) )
+                    {
+                        numeration = Sink.NUMBERING_UPPER_ROMAN;
+                    }
+                    sink.numberedList( numeration );
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "listitem" ) )
+                {
+                    if ( isParent( "variablelist" ) )
+                    {
+                        sink.definition();
+                    }
+                    else
+                    {
+                        sink.listItem();
+                    }
+                }
+                else if ( parser.getName().equals( "variablelist" ) )
+                {
+                    sink.definitionList();
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "varlistentry" ) )
+                {
+                    sink.definitionListItem();
+                }
+                else if ( parser.getName().equals( "term" ) )
+                {
+                    sink.definedTerm();
+                }
+                //handle figures
+                else if ( parser.getName().equals( "figure" ) || parser.getName().equals( "informalfigure" ) )
+                {
+                    sink.figure();
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "imageobject" ) )
+                {
+                    String fileref = getAttributeValue( parser, "fileref" );
+                    if ( fileref != null )
+                    {
+                        sink.figureGraphics( fileref );
+                        parent.push( parser.getName() );
+                    }
+                }
+                else if ( parser.getName().equals( "caption" ) && isParent( "figure" ) )
+                {
+                    sink.figureCaption();
+                }
+                else if ( parser.getName().equals( "table" ) || parser.getName().equals( "informaltable" ) )
+                {
+                    sink.table();
+                    //TODO handle tgroups
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "thead" ) )
+                {
+                    parent.push( parser.getName() );
+                }
+                else if ( parser.getName().equals( "tr" ) || parser.getName().equals( "row" ) )
+                {
+                    sink.tableRow();
+                }
+                else if ( parser.getName().equals( "entry" ) && isParent( "thead" ) || parser.getName().equals( "th" ) )
+                {
+                    sink.tableHeaderCell();
+                }
+                else if ( parser.getName().equals( "entry" ) )
+                {
+                    sink.tableCell();
+                }
+                else
+                if ( parser.getName().equals( "caption" ) && ( isParent( "informaltable" ) || isParent( "table" ) ) )
+                {
+                    sink.tableCaption();
+                }
+
+                else if ( ( parser.getName().equals( "para" ) || parser.getName().equals( "simpara" ) ) &&
+                    !isParent( "formalpara" ) )
+                {
+                    sink.paragraph();
+                }
+                else if ( parser.getName().equals( "formalpara" ) )
+                {
+                    parent.push( parser.getName() );
+                    sink.paragraph();
+                }
+                else if ( parser.getName().equals( "title" ) && isParent( "formalpara" ) )
+                {
+                    sink.bold();
+                }
+                else if ( DocBookParser.verbatimElements.contains( parser.getName() ) )
+                {
+                    sink.verbatim( true );
+                }
+
+                else if ( DocBookParser.boldElements.contains( parser.getName() ) &&
+                    DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.bold();
+                    sink.monospaced();
+                }
+                else if ( DocBookParser.italicElements.contains( parser.getName() ) &&
+                    DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.italic();
+                    sink.monospaced();
+                }
+                else if ( DocBookParser.boldElements.contains( parser.getName() ) )
+                {
+                    sink.bold();
+                }
+                else if ( DocBookParser.italicElements.contains( parser.getName() ) )
+                {
+                    sink.italic();
+                }
+                else if ( DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.monospaced();
+                }
+
+                else if ( parser.getName().equals( "title" ) )
+                {
+                    if ( parser.getName().equals( "figure" ) || parser.getName().equals( "informalfigure" ) )
+                    {
+                        sink.figureCaption();
+                    }
+                    else if ( parser.getName().equals( "table" ) || parser.getName().equals( "informaltable" ) )
+                    {
+                        sink.tableCaption();
+                    }
+                    else if ( level == 1 )
+                    {
+                        sink.title();
+                    }
+                    else if ( level == 2 )
+                    {
+                        sink.sectionTitle1();
+                    }
+                    else if ( level == 3 )
+                    {
+                        sink.sectionTitle2();
+                    }
+                    else if ( level == 4 )
+                    {
+                        sink.sectionTitle3();
+                    }
+                    else if ( level == 5 )
+                    {
+                        sink.sectionTitle4();
+                    }
+                    else if ( level == 6 )
+                    {
+                        sink.sectionTitle5();
+                    }
+                }
+                else if ( parser.getName().equals( "ulink" ) )
+                {
+                    String url = getAttributeValue( parser, "url" );
+                    if ( url != null )
+                    {
+                        parent.push( parser.getName() );
+                        sink.link( url );
+                    }
+                }
+                else if ( parser.getName().equals( "email" ) )
+                {
+                    sink.link( "mailto:" + parser.nextText() );
+                    sink.link_();
+                }
+                else if ( parser.getName().equals( "link" ) )
+                {
+                    String linkend = getAttributeValue( parser, "linkend" );
+                    if ( linkend != null )
+                    {
+                        parent.push( parser.getName() );
+                        sink.link( "#" + linkend );
+                    }
+                }
+                else if ( parser.getName().equals( "xref" ) )
+                {
+                    String linkend = getAttributeValue( parser, "linkend" );
+                    if ( linkend != null )
+                    {
+                        sink.link( "#" + linkend );
+                        sink.text( "Link" );//TODO: determine text of link target
+                        sink.link_();
+                    }
+                }
+                else
+                {
+                    failedElements.add( parser.getName() );
+                }
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                //If the element introduces a new level of hierarchy, lower the stack
+                if ( hierElements.contains( parser.getName() ) )
+                {
+                    //increase the nesting level
+                    level--;
+                    //if this is the root element, handle it as body
+                    if ( level == 1 )
+                    {
+                        sink.body_();
+                    }
+                    else if ( level == 2 )
+                    {
+                        sink.section1_();
+                    }
+                    else if ( level == 3 )
+                    {
+                        sink.section2_();
+                    }
+                    else if ( level == 4 )
+                    {
+                        sink.section3_();
+                    }
+                    else if ( level == 5 )
+                    {
+                        sink.section4_();
+                    }
+                    else if ( level == 6 )
+                    {
+                        sink.section5_();
+                    }
+                }
+                //Match all *info-Elements for metainformation, but only consider the root element
+                else if ( parser.getName().endsWith( "info" ) && level == 1 )
+                {
+                    sink.head_();
+                    parent.pop();
+                }
+                //handle lists
+                else if ( parser.getName().equals( "itemizedlist" ) )
+                {
+                    sink.list_();
+                    parent.pop();
+                }
+                else if ( parser.getName().equals( "orderedlist" ) )
+                {
+                    sink.numberedList_();
+                    parent.pop();
+                }
+                else if ( parser.getName().equals( "listitem" ) )
+                {
+                    if ( isParent( "variablelist" ) )
+                    {
+                        sink.definition_();
+                    }
+                    else
+                    {
+                        sink.listItem_();
+                    }
+                }
+                else if ( parser.getName().equals( "variablelist" ) )
+                {
+                    sink.definitionList_();
+                }
+                else if ( parser.getName().equals( "varlistentry" ) )
+                {
+                    sink.definitionListItem_();
+                }
+                else if ( parser.getName().equals( "term" ) )
+                {
+                    sink.definedTerm_();
+                }
+                //handle figures
+                else if ( parser.getName().equals( "figure" ) || parser.getName().equals( "informalfigure" ) )
+                {
+                    sink.figure_();
+                    parent.pop();
+                }
+                else if ( parser.getName().equals( "caption" ) && isParent( "figure" ) )
+                {
+                    sink.figureCaption_();
+                }
+                else if ( parser.getName().equals( "table" ) || parser.getName().equals( "informaltable" ) )
+                {
+                    sink.table_();
+                    //TODO handle tgroups
+                    parent.pop();
+                }
+                else if ( parser.getName().equals( "thead" ) )
+                {
+                    parent.pop();
+                }
+                else if ( parser.getName().equals( "tr" ) || parser.getName().equals( "row" ) )
+                {
+                    sink.tableRow_();
+                }
+                else if ( parser.getName().equals( "entry" ) && isParent( "thead" ) || parser.getName().equals( "th" ) )
+                {
+                    sink.tableHeaderCell_();
+                }
+                else if ( parser.getName().equals( "entry" ) )
+                {
+                    sink.tableCell_();
+                }
+                else
+                if ( parser.getName().equals( "caption" ) && ( isParent( "informaltable" ) || isParent( "table" ) ) )
+                {
+                    sink.tableCaption_();
+                }
+                else if ( ( parser.getName().equals( "para" ) || parser.getName().equals( "simpara" ) ) &&
+                    !isParent( "formalpara" ) )
+                {
+                    sink.paragraph_();
+                }
+                else if ( parser.getName().equals( "formalpara" ) )
+                {
+                    parent.pop();
+                    sink.paragraph_();
+                }
+                else if ( parser.getName().equals( "title" ) && isParent( "formalpara" ) )
+                {
+                    sink.text( ". " );//Inline Running head
+                    sink.bold_();
+                }
+                else if ( DocBookParser.verbatimElements.contains( parser.getName() ) )
+                {
+                    sink.verbatim_();
+                }
+                else if ( DocBookParser.boldElements.contains( parser.getName() ) &&
+                    DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.bold_();
+                    sink.monospaced_();
+                }
+                else if ( DocBookParser.italicElements.contains( parser.getName() ) &&
+                    DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.italic_();
+                    sink.monospaced_();
+                }
+                else if ( DocBookParser.boldElements.contains( parser.getName() ) )
+                {
+                    sink.bold_();
+                }
+                else if ( DocBookParser.italicElements.contains( parser.getName() ) )
+                {
+                    sink.italic_();
+                }
+                else if ( DocBookParser.monospaceElements.contains( parser.getName() ) )
+                {
+                    sink.monospaced_();
+                }
+
+                else if ( parser.getName().equals( "title" ) )
+                {
+                    if ( parser.getName().equals( "figure" ) || parser.getName().equals( "informalfigure" ) )
+                    {
+                        sink.figureCaption_();
+                    }
+                    else if ( parser.getName().equals( "table" ) || parser.getName().equals( "informaltable" ) )
+                    {
+                        sink.tableCaption_();
+                    }
+                    else if ( level == 1 )
+                    {
+                        sink.title_();
+                    }
+                    else if ( level == 2 )
+                    {
+                        sink.sectionTitle1_();
+                    }
+                    else if ( level == 3 )
+                    {
+                        sink.sectionTitle2_();
+                    }
+                    else if ( level == 4 )
+                    {
+                        sink.sectionTitle3_();
+                    }
+                    else if ( level == 5 )
+                    {
+                        sink.sectionTitle4_();
+                    }
+                    else if ( level == 6 )
+                    {
+                        sink.sectionTitle5_();
+                    }
+                }
+                else if ( parser.getName().equals( "ulink" ) || parser.getName().equals( "link" ) )
+                {
+                    if ( isParent( parser.getName() ) )
+                    {
+                        parent.pop();
+                        sink.link_();
+                    }
+                }
+            }
+            else if ( eventType == XmlPullParser.TEXT )
+            {
+                sink.text( parser.getText() );
+            }
+
+            eventType = parser.next();
+        }
+
+        // TODO: This should go through some monitor
+        if ( !failedElements.isEmpty() )
+        {
+            System.out.println( "Doxia was unable to handle following elements" );
+            for ( Iterator i = failedElements.iterator(); i.hasNext(); )
+            {
+                System.out.print( i.next().toString() + " " );
+            }
+
+            System.out.println();
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private String getAttributeValue( XmlPullParser parser, String name )
+    {
+        for ( int i = 0; i < parser.getAttributeCount(); i++ )
+        {
+            if ( parser.getAttributeName( i ).equals( name ) )
+            {
+                return parser.getAttributeValue( i );
+            }
+        }
+
+        return null;
+    }
+
+    private boolean isParent( String element )
+    {
+        if ( parent.size() > 0 )
+        {
+            return parent.peek().equals( element );
+        }
+
+        return false;
+    }
+}

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

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

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java Mon Feb  6 20:46:31 2006
@@ -0,0 +1,938 @@
+package org.apache.maven.doxia.module.docbook;
+
+/*
+ * 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.apt.AptParser;
+import org.apache.maven.doxia.sink.SinkAdapter;
+import org.apache.maven.doxia.sink.StructureSink;
+import org.apache.maven.doxia.util.FileUtil;
+import org.apache.maven.doxia.util.LineBreaker;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.StringTokenizer;
+
+public class DocBookSink
+    extends SinkAdapter
+{
+    public static final String DEFAULT_SGML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.1//EN";
+
+    public static final String DEFAULT_XML_PUBLIC_ID = "-//OASIS//DTD DocBook XML V4.1.2//EN";
+
+    public static final String DEFAULT_XML_SYSTEM_ID = "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd";
+
+    private LineBreaker out;
+
+    private boolean xmlMode = false;
+
+    private String encoding = null;
+
+    private String styleSheet = null;
+
+    private String lang = null;
+
+    private String publicId = null;
+
+    private String systemId = null;
+
+    private String italicBeginTag;
+
+    private String italicEndTag;
+
+    private String boldBeginTag;
+
+    private String boldEndTag;
+
+    private String monospacedBeginTag;
+
+    private String monospacedEndTag;
+
+    private String horizontalRuleElement;
+
+    private String pageBreakElement;
+
+    private String lineBreakElement;
+
+    protected String graphicsFileName;
+
+    private boolean hasTitle;
+
+    private boolean authorDateFlag;
+
+    private boolean verbatimFlag;
+
+    private boolean externalLinkFlag;
+
+    private boolean tableHasCaption;
+
+    private LineBreaker savedOut;
+
+    private String tableRows;
+
+    private boolean tableHasGrid;
+
+    // -----------------------------------------------------------------------
+
+    public DocBookSink( Writer out )
+    {
+        this.out = new LineBreaker( out );
+        setItalicElement( "<emphasis>" );
+        setBoldElement( "<emphasis role=\"bold\">" );
+        setMonospacedElement( "<literal>" );
+        setHorizontalRuleElement( "<!-- HR -->" );
+        setPageBreakElement( "<!-- PB -->" );
+        setLineBreakElement( "<!-- LB -->" );
+    }
+
+    public static final String escapeSGML( String text, boolean xmlMode )
+    {
+        int length = text.length();
+        StringBuffer buffer = new StringBuffer( length );
+
+        for ( int i = 0; i < length; ++i )
+        {
+            char c = text.charAt( i );
+            switch ( c )
+            {
+                case '<':
+                    buffer.append( "&lt;" );
+                    break;
+                case '>':
+                    buffer.append( "&gt;" );
+                    break;
+                case '&':
+                    buffer.append( "&amp;" );
+                    break;
+                case '"':
+                    buffer.append( "&quot;" );
+                    break;
+                default:
+                    if ( xmlMode )
+                    {
+                        buffer.append( c );
+                    }
+                    else
+                    {
+                        if ( c <= 0x7E )
+                        {
+                            // ASCII.
+                            buffer.append( c );
+                        }
+                        else
+                        {
+                            buffer.append( "&#" );
+                            buffer.append( (int) c );
+                            buffer.append( ';' );
+                        }
+                    }
+            }
+        }
+
+        return buffer.toString();
+    }
+
+    public void setXMLMode( boolean xmlMode )
+    {
+        this.xmlMode = xmlMode;
+    }
+
+    public boolean isXMLMode()
+    {
+        return xmlMode;
+    }
+
+    public void setEncoding( String encoding )
+    {
+        this.encoding = encoding;
+    }
+
+    public String getEncoding()
+    {
+        return encoding;
+    }
+
+    public void setStyleSheet( String styleSheet )
+    {
+        this.styleSheet = styleSheet;
+    }
+
+    public String getStyleSheet()
+    {
+        return styleSheet;
+    }
+
+    public void setPublicId( String publicId )
+    {
+        this.publicId = publicId;
+    }
+
+    public String getPublicId()
+    {
+        return publicId;
+    }
+
+    public void setSystemId( String systemId )
+    {
+        this.systemId = systemId;
+    }
+
+    public String getSystemId()
+    {
+        return systemId;
+    }
+
+    public void setLanguage( String lang )
+    {
+        this.lang = lang;
+    }
+
+    public String getLanguage()
+    {
+        return lang;
+    }
+
+    public void setItalicElement( String italicBeginTag )
+    {
+        if ( italicBeginTag == null )
+        {
+            italicBeginTag = "";
+        }
+        this.italicBeginTag = italicBeginTag;
+        italicEndTag = makeEndTag( italicBeginTag );
+    }
+
+    private String makeEndTag( String beginTag )
+    {
+        int length = beginTag.length();
+        if ( length == 0 )
+        {
+            return "";
+        }
+
+        if ( beginTag.charAt( 0 ) != '<' || beginTag.charAt( length - 1 ) != '>' )
+        {
+            throw new IllegalArgumentException( "'" + beginTag + "', not a tag" );
+        }
+
+        StringTokenizer tokens = new StringTokenizer( beginTag, "<> \t\n\r\f" );
+        if ( !tokens.hasMoreTokens() )
+        {
+            throw new IllegalArgumentException( "'" + beginTag + "', invalid tag" );
+        }
+
+        return "</" + tokens.nextToken() + ">";
+    }
+
+    public String getItalicElement()
+    {
+        return italicBeginTag;
+    }
+
+    public void setBoldElement( String boldBeginTag )
+    {
+        if ( boldBeginTag == null )
+        {
+            boldBeginTag = "";
+        }
+        this.boldBeginTag = boldBeginTag;
+        boldEndTag = makeEndTag( boldBeginTag );
+    }
+
+    public String getBoldElement()
+    {
+        return boldBeginTag;
+    }
+
+    public void setMonospacedElement( String monospacedBeginTag )
+    {
+        if ( monospacedBeginTag == null )
+        {
+            monospacedBeginTag = "";
+        }
+        this.monospacedBeginTag = monospacedBeginTag;
+        monospacedEndTag = makeEndTag( monospacedBeginTag );
+    }
+
+    public String getMonospacedElement()
+    {
+        return monospacedBeginTag;
+    }
+
+    public void setHorizontalRuleElement( String horizontalRuleElement )
+    {
+        this.horizontalRuleElement = horizontalRuleElement;
+    }
+
+    public String getHorizontalRuleElement()
+    {
+        return horizontalRuleElement;
+    }
+
+    public void setPageBreakElement( String pageBreakElement )
+    {
+        this.pageBreakElement = pageBreakElement;
+    }
+
+    public String getPageBreakElement()
+    {
+        return pageBreakElement;
+    }
+
+    public void setLineBreakElement( String lineBreakElement )
+    {
+        this.lineBreakElement = lineBreakElement;
+    }
+
+    public String getLineBreakElement()
+    {
+        return lineBreakElement;
+    }
+
+    private void resetState()
+    {
+        hasTitle = false;
+        authorDateFlag = false;
+        verbatimFlag = false;
+        externalLinkFlag = false;
+        graphicsFileName = null;
+        tableHasCaption = false;
+        savedOut = null;
+        tableRows = null;
+        tableHasGrid = false;
+    }
+
+    public void head()
+    {
+        resetState();
+
+        if ( xmlMode )
+        {
+            markup( "<?xml version=\"1.0\"" );
+            if ( encoding != null )
+            {
+                markup( " encoding=\"" + encoding + "\"" );
+            }
+            markup( " ?>\n" );
+
+            if ( styleSheet != null )
+            {
+                markup( "<?xml-stylesheet type=\"text/css\"\n" + "href=\"" + styleSheet + "\" ?>\n" );
+            }
+        }
+
+        String pubId;
+        markup( "<!DOCTYPE article PUBLIC" );
+        if ( publicId == null )
+        {
+            if ( xmlMode )
+            {
+                pubId = DEFAULT_XML_PUBLIC_ID;
+            }
+            else
+            {
+                pubId = DEFAULT_SGML_PUBLIC_ID;
+            }
+        }
+        else
+        {
+            pubId = publicId;
+        }
+        markup( " \"" + pubId + "\"" );
+        String sysId = systemId;
+        if ( sysId == null && xmlMode )
+        {
+            sysId = DEFAULT_XML_SYSTEM_ID;
+        }
+        if ( sysId == null )
+        {
+            markup( ">\n" );
+        }
+        else
+        {
+            markup( "\n\"" + sysId + "\">\n" );
+        }
+
+        markup( "<article" );
+        if ( lang != null )
+        {
+            markup( " lang=\"" + lang + "\"" );
+        }
+        markup( ">\n" );
+    }
+
+    public void head_()
+    {
+        if ( hasTitle )
+        {
+            markup( "</articleinfo>\n" );
+            hasTitle = false;
+        }
+    }
+
+    public void title()
+    {
+        markup( "<articleinfo>\n" );
+
+        hasTitle = true;
+        markup( "<title>" );
+    }
+
+    public void title_()
+    {
+        markup( "</title>\n" );
+    }
+
+    public void author()
+    {
+        authorDateFlag = true;
+        markup( "<corpauthor>" );
+    }
+
+    public void author_()
+    {
+        markup( "</corpauthor>\n" );
+        authorDateFlag = false;
+    }
+
+    public void date()
+    {
+        authorDateFlag = true;
+        markup( "<date>" );
+    }
+
+    public void date_()
+    {
+        markup( "</date>\n" );
+        authorDateFlag = false;
+    }
+
+    public void body_()
+    {
+        markup( "</article>\n" );
+        out.flush();
+        resetState();
+    }
+
+    public void section1()
+    {
+        markup( "<section>\n" );
+    }
+
+    public void section1_()
+    {
+        markup( "</section>\n" );
+    }
+
+    public void section2()
+    {
+        markup( "<section>\n" );
+    }
+
+    public void section2_()
+    {
+        markup( "</section>\n" );
+    }
+
+    public void section3()
+    {
+        markup( "<section>\n" );
+    }
+
+    public void section3_()
+    {
+        markup( "</section>\n" );
+    }
+
+    public void section4()
+    {
+        markup( "<section>\n" );
+    }
+
+    public void section4_()
+    {
+        markup( "</section>\n" );
+    }
+
+    public void section5()
+    {
+        markup( "<section>\n" );
+    }
+
+    public void section5_()
+    {
+        markup( "</section>\n" );
+    }
+
+    public void sectionTitle()
+    {
+        markup( "<title>" );
+    }
+
+    public void sectionTitle_()
+    {
+        markup( "</title>\n" );
+    }
+
+    public void list()
+    {
+        markup( "<itemizedlist>\n" );
+    }
+
+    public void list_()
+    {
+        markup( "</itemizedlist>\n" );
+    }
+
+    public void listItem()
+    {
+        markup( "<listitem>\n" );
+    }
+
+    public void listItem_()
+    {
+        markup( "</listitem>\n" );
+    }
+
+    public void numberedList( int numbering )
+    {
+        String numeration;
+        switch ( numbering )
+        {
+            case NUMBERING_UPPER_ALPHA:
+                numeration = "upperalpha";
+                break;
+            case NUMBERING_LOWER_ALPHA:
+                numeration = "loweralpha";
+                break;
+            case NUMBERING_UPPER_ROMAN:
+                numeration = "upperroman";
+                break;
+            case NUMBERING_LOWER_ROMAN:
+                numeration = "lowerroman";
+                break;
+            case NUMBERING_DECIMAL:
+            default:
+                numeration = "arabic";
+        }
+        markup( "<orderedlist numeration=\"" + numeration + "\">\n" );
+    }
+
+    public void numberedList_()
+    {
+        markup( "</orderedlist>\n" );
+    }
+
+    public void numberedListItem()
+    {
+        markup( "<listitem>\n" );
+    }
+
+    public void numberedListItem_()
+    {
+        markup( "</listitem>\n" );
+    }
+
+    public void definitionList()
+    {
+        markup( "<variablelist>\n" );
+    }
+
+    public void definitionList_()
+    {
+        markup( "</variablelist>\n" );
+    }
+
+    public void definitionListItem()
+    {
+        markup( "<varlistentry>\n" );
+    }
+
+    public void definitionListItem_()
+    {
+        markup( "</varlistentry>\n" );
+    }
+
+    public void definedTerm()
+    {
+        markup( "<term>" );
+    }
+
+    public void definedTerm_()
+    {
+        markup( "</term>\n" );
+    }
+
+    public void definition()
+    {
+        markup( "<listitem>\n" );
+    }
+
+    public void definition_()
+    {
+        markup( "</listitem>\n" );
+    }
+
+    public void paragraph()
+    {
+        markup( "<para>" );
+    }
+
+    public void paragraph_()
+    {
+        markup( "</para>\n" );
+    }
+
+    public void verbatim( boolean boxed )
+    {
+        verbatimFlag = true;
+        markup( "<programlisting>" );
+    }
+
+    public void verbatim_()
+    {
+        markup( "</programlisting>\n" );
+        verbatimFlag = false;
+    }
+
+    public void horizontalRule()
+    {
+        markup( horizontalRuleElement + '\n' );
+    }
+
+    public void pageBreak()
+    {
+        markup( pageBreakElement + '\n' );
+    }
+
+    public void figure_()
+    {
+        graphicElement();
+    }
+
+    protected void graphicElement()
+    {
+        if ( graphicsFileName != null )
+        {
+            String format = FileUtil.fileExtension( graphicsFileName ).toUpperCase();
+            if ( format.length() == 0 )
+            {
+                format = "JPEG";
+            }
+
+            markup( "<mediaobject>\n<imageobject>\n" );
+            markup(
+                "<imagedata format=\"" + format + "\"\nfileref=\"" + escapeSGML( graphicsFileName, xmlMode ) + '\"' );
+            if ( xmlMode )
+            {
+                markup( "/>\n" );
+            }
+            else
+            {
+                markup( ">\n" );
+            }
+            markup( "</imageobject>\n</mediaobject>\n" );
+            graphicsFileName = null;
+        }
+    }
+
+    public void figureGraphics( String name )
+    {
+        graphicsFileName = name + ".jpeg";
+    }
+
+    public void figureCaption()
+    {
+        markup( "<figure>\n" );
+        markup( "<title>" );
+    }
+
+    public void figureCaption_()
+    {
+        markup( "</title>\n" );
+        graphicElement();
+        markup( "</figure>\n" );
+    }
+
+    public void table()
+    {
+        tableHasCaption = false;
+    }
+
+    public void table_()
+    {
+        if ( tableHasCaption )
+        {
+            tableHasCaption = false;
+            // Formal table+title already written to original destination ---
+
+            out.write( tableRows, /*preserveSpace*/ true );
+            markup( "</table>\n" );
+        }
+        else
+        {
+            String frame;
+            int sep;
+            if ( tableHasGrid )
+            {
+                frame = "all";
+                sep = 1;
+            }
+            else
+            {
+                frame = "none";
+                sep = 0;
+            }
+
+            markup( "<informaltable frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" );
+            out.write( tableRows, /*preserveSpace*/ true );
+            markup( "</informaltable>\n" );
+        }
+
+        tableRows = null;
+        tableHasGrid = false;
+    }
+
+    public void tableRows( int[] justification, boolean grid )
+
+    {
+        tableHasGrid = grid;
+
+        // Divert output to a string ---
+        out.flush();
+        savedOut = out;
+        out = new LineBreaker( new StringWriter() );
+
+        markup( "<tgroup cols=\"" + justification.length + "\">\n" );
+        for ( int i = 0; i < justification.length; ++i )
+        {
+            String justif;
+            switch ( justification[i] )
+            {
+                case AptParser.JUSTIFY_LEFT:
+                    justif = "left";
+                    break;
+                case AptParser.JUSTIFY_RIGHT:
+                    justif = "right";
+                    break;
+                case AptParser.JUSTIFY_CENTER:
+                default:
+                    justif = "center";
+                    break;
+            }
+            markup( "<colspec align=\"" + justif + "\"" );
+            if ( xmlMode )
+            {
+                markup( "/>\n" );
+            }
+            else
+            {
+                markup( ">\n" );
+            }
+        }
+
+        markup( "<tbody>\n" );
+    }
+
+    public void tableRows_()
+    {
+        markup( "</tbody>\n" );
+        markup( "</tgroup>\n" );
+
+        // Remember diverted output and restore original destination ---
+        out.flush();
+        tableRows = ( (StringWriter) out.getDestination() ).toString();
+        out = savedOut;
+    }
+
+    public void tableRow()
+    {
+        markup( "<row>\n" );
+    }
+
+    public void tableRow_()
+    {
+        markup( "</row>\n" );
+    }
+
+    public void tableCell()
+    {
+        markup( "<entry><para>" );
+    }
+
+    public void tableCell_()
+    {
+        markup( "</para></entry>\n" );
+    }
+
+    public void tableCaption()
+    {
+        tableHasCaption = true;
+
+        String frame;
+        int sep;
+        if ( tableHasGrid )
+        {
+            frame = "all";
+            sep = 1;
+        }
+        else
+        {
+            frame = "none";
+            sep = 0;
+        }
+
+        markup( "<table frame=\"" + frame + "\" rowsep=\"" + sep + "\" colsep=\"" + sep + "\">\n" );
+        markup( "<title>" );
+    }
+
+    public void tableCaption_()
+    {
+        markup( "</title>\n" );
+    }
+
+    public void anchor( String name )
+    {
+        if ( !authorDateFlag )
+        {
+            // First char of ID cannot be a digit.
+            markup( "<anchor id=\"a." + StructureSink.linkToKey( name ) + "\"" );
+            if ( xmlMode )
+            {
+                markup( "/>" );
+            }
+            else
+            {
+                markup( ">" );
+            }
+        }
+    }
+
+    public void link( String name )
+    {
+        if ( StructureSink.isExternalLink( name ) )
+        {
+            externalLinkFlag = true;
+            markup( "<ulink url=\"" + escapeSGML( name, xmlMode ) + "\">" );
+        }
+        else
+        {
+            // First char of ID cannot be a digit.
+            markup( "<link linkend=\"a." + StructureSink.linkToKey( name ) + "\">" );
+        }
+    }
+
+    public void link_()
+    {
+        if ( externalLinkFlag )
+        {
+            markup( "</ulink>" );
+            externalLinkFlag = false;
+        }
+        else
+        {
+            markup( "</link>" );
+        }
+    }
+
+    public void italic()
+    {
+        markup( italicBeginTag );
+    }
+
+    public void italic_()
+    {
+        markup( italicEndTag );
+    }
+
+    public void bold()
+    {
+        markup( boldBeginTag );
+    }
+
+    public void bold_()
+    {
+        markup( boldEndTag );
+    }
+
+    public void monospaced()
+    {
+        if ( !authorDateFlag )
+        {
+            markup( monospacedBeginTag );
+        }
+    }
+
+    public void monospaced_()
+    {
+        if ( !authorDateFlag )
+        {
+            markup( monospacedEndTag );
+        }
+    }
+
+    public void lineBreak()
+    {
+        markup( lineBreakElement + '\n' );
+    }
+
+    public void nonBreakingSpace()
+    {
+        //markup("&#x00A0;");
+        markup( "&nbsp;" );
+    }
+
+    public void text( String text )
+    {
+        if ( verbatimFlag )
+        {
+            verbatimContent( text );
+        }
+        else
+        {
+            content( text );
+        }
+    }
+
+    // -----------------------------------------------------------------------
+
+    protected void markup( String text )
+    {
+        out.write( text, /*preserveSpace*/ true );
+    }
+
+    protected void content( String text )
+    {
+        out.write( escapeSGML( text, xmlMode ), /*preserveSpace*/ false );
+    }
+
+    protected void verbatimContent( String text )
+    {
+        out.write( escapeSGML( text, xmlMode ), /*preserveSpace*/ true );
+    }
+
+    // -----------------------------------------------------------------------
+
+    public void flush()
+    {
+        out.flush();
+    }
+
+    public void close()
+    {
+        out.close();
+    }
+}

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

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

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSiteModule.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSiteModule.java?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSiteModule.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSiteModule.java Mon Feb  6 20:46:31 2006
@@ -0,0 +1,44 @@
+package org.apache.maven.doxia.module.docbook;
+
+/*
+ * 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:evenisse@codehaus.org">Emmanuel Venisse</a>
+ * @version $Id:DocBookSiteModule.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="doc-book"
+ */
+public class DocBookSiteModule
+    extends AbstractSiteModule
+{
+    public String getSourceDirectory()
+    {
+        return "docbook";
+    }
+
+    public String getExtension()
+    {
+        return "xml";
+    }
+
+    public String getParserId()
+    {
+        return "doc-book";
+    }
+}

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

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

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookParserTest.java Mon Feb  6 20:46:31 2006
@@ -0,0 +1,38 @@
+package org.apache.maven.doxia.module.docbook;
+
+/*
+ * 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.parser.AbstractParserTestCase;
+import org.apache.maven.doxia.parser.Parser;
+
+/**
+ * @author <a href="mailto:lars@trieloff.net">Lars Trieloff</a>
+ * @version $Id:DocBookParserTest.java 348605 2005-11-24 01:02:44Z brett $
+ */
+public class DocBookParserTest
+    extends AbstractParserTestCase
+{
+    protected Parser getParser()
+    {
+        return new DocBookParser();
+    }
+
+    protected String getDocument()
+    {
+        return "src/test/site/docbook/guide.xml";
+    }
+}

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

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

Added: maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java?rev=375482&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java (added)
+++ maven/doxia/trunk/doxia-modules/doxia-modules-docbook/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java Mon Feb  6 20:46:31 2006
@@ -0,0 +1,40 @@
+package org.apache.maven.doxia.module.docbook;
+
+/*
+ * 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.docbook.DocBookSink;
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.AbstractSinkTestCase;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:DocBookSinkTest.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $
+ */
+public class DocBookSinkTest
+    extends AbstractSinkTestCase
+{
+    protected String outputExtension()
+    {
+        return "docbook";
+    }
+
+    protected Sink createSink()
+        throws Exception
+    {
+        return new DocBookSink( getTestWriter() );
+    }
+}

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

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