maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r418259 - in /maven/doxia/trunk: doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ doxia-modules/doxia-module-itext/src/test/resources/apt/ doxia-sandbox/doxia-book/ doxia-sandbox/doxia-book/src/main/java/o...
Date Fri, 30 Jun 2006 13:20:43 GMT
Author: trygvis
Date: Fri Jun 30 06:20:42 2006
New Revision: 418259

URL: http://svn.apache.org/viewvc?rev=418259&view=rev
Log:
o Adding a new constructor that's used by the book sink that takes an existing xml writer and makes the sink skip the writing of the root <itext> tag.
o Cleaning up the iText code style.
o Fixing a couple of bugs in the book indexing sink.

Added:
    maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/InvalidBookDescriptorException.java
Modified:
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml
    maven/doxia/trunk/doxia-sandbox/doxia-book/pom.xml
    maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java
    maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/indexer/BookIndexingSink.java
    maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/ITextBookRenderer.java
    maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java Fri Jun 30 06:20:42 2006
@@ -49,10 +49,10 @@
  *
  * @see <a href="http://www.lowagie.com/iText/tutorial/ch07.html">http://www.lowagie.com/iText/tutorial/ch07.html</a>
  *
+ * @plexus.component role="org.apache.maven.doxia.sink.Sink" role-hint="pdf"
+ *
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  * @version $Id$
- * @plexus.component role="org.apache.maven.doxia.sink.Sink"
- * role-hint="pdf"
  */
 public final class ITextSink
     extends SinkAdapter
@@ -81,6 +81,8 @@
     /** The XML Writer used */
     private XMLWriter xmlWriter;
 
+    private boolean writeStart;
+
     /** The Header object */
     private ITextHeader header;
 
@@ -95,20 +97,23 @@
     {
         this.writer = writer;
 
-        this.actionContext = new SinkActionContext();
-        this.font = new ITextFont();
-        this.header = new ITextHeader();
+        actionContext = new SinkActionContext();
+        font = new ITextFont();
+        header = new ITextHeader();
 
-        this.xmlWriter = new PrettyPrintXMLWriter( this.writer, "UTF-8", null );//, DOCTYPE );
+        xmlWriter = new PrettyPrintXMLWriter( this.writer, "UTF-8", null );//, DOCTYPE );
+        writeStart = true;
     }
 
     public ITextSink( PrettyPrintXMLWriter xmlWriter )
     {
-        this.actionContext = new SinkActionContext();
-        this.font = new ITextFont();
-        this.header = new ITextHeader();
-
         this.xmlWriter = xmlWriter;
+
+        actionContext = new SinkActionContext();
+        font = new ITextFont();
+        header = new ITextHeader();
+
+        writeStart = false;
     }
 
     /**
@@ -118,7 +123,7 @@
      */
     public ClassLoader getClassLoader()
     {
-        return this.currentClassLoader;
+        return currentClassLoader;
     }
 
     /**
@@ -128,7 +133,7 @@
      */
     public void setClassLoader( ClassLoader cl )
     {
-        this.currentClassLoader = cl;
+        currentClassLoader = cl;
     }
 
     // ----------------------------------------------------------------------
@@ -137,7 +142,7 @@
 
     public void close()
     {
-        IOUtil.close( this.writer );
+        IOUtil.close( writer );
     }
 
     public void flush()
@@ -151,42 +156,42 @@
 
     public void head_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void head()
     {
-        this.actionContext.setAction( SinkActionContext.HEAD );
+        actionContext.setAction( SinkActionContext.HEAD );
     }
 
     public void author_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void author()
     {
-        this.actionContext.setAction( SinkActionContext.AUTHOR );
+        actionContext.setAction( SinkActionContext.AUTHOR );
     }
 
     public void date_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void date()
     {
-        this.actionContext.setAction( SinkActionContext.DATE );
+        actionContext.setAction( SinkActionContext.DATE );
     }
 
     public void title_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void title()
     {
-        this.actionContext.setAction( SinkActionContext.TITLE );
+        actionContext.setAction( SinkActionContext.TITLE );
     }
 
     // ----------------------------------------------------------------------
@@ -195,58 +200,63 @@
 
     public void body_()
     {
-        writeEndElement(); // ElementTags.CHAPTER
+        if ( writeStart )
+        {
+            writeEndElement(); // ElementTags.CHAPTER
 
-        writeEndElement(); // ElementTags.ITEXT
+            writeEndElement(); // ElementTags.ITEXT
+        }
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
-    /**
-     * @see org.apache.maven.doxia.sink.Sink#body()
-     */
     public void body()
     {
-        writeStartElement( ElementTags.ITEXT );
-        writeAddAttribute( ElementTags.TITLE, this.header.getTitle() );
-        writeAddAttribute( ElementTags.AUTHOR, this.header.getAuthors() );
-        writeAddAttribute( ElementTags.CREATIONDATE, this.header.getDate() );
-        writeAddAttribute( ElementTags.SUBJECT, this.header.getTitle() );
-        writeAddAttribute( ElementTags.KEYWORDS, "" );
-        writeAddAttribute( ElementTags.PRODUCER, "Generated with Doxia by " + System.getProperty( "user.name" ) );
-        writeAddAttribute( ElementTags.PAGE_SIZE, ITextUtil.getPageSize( ITextUtil.getDefaultPageSize() ) );
-
-        writeStartElement( ElementTags.CHAPTER );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
-        writeAddAttribute( ElementTags.INDENT, "0.0" );
-
-        writeStartElement( ElementTags.TITLE );
-        writeAddAttribute( ElementTags.LEADING, DEFAULT_CHAPTER_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME );
-        writeAddAttribute( ElementTags.SIZE, ITextFont.getSectionFontSize( 0 ) );
-        writeAddAttribute( ElementTags.STYLE, ITextFont.BOLD );
-        writeAddAttribute( ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE );
-        writeAddAttribute( ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN );
-        writeAddAttribute( ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED );
-        writeAddAttribute( ElementTags.ALIGN, ElementTags.ALIGN_CENTER );
-
-        writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME );
-        writeAddAttribute( ElementTags.SIZE, ITextFont.getSectionFontSize( 0 ) );
-        writeAddAttribute( ElementTags.STYLE, ITextFont.BOLD );
-        writeAddAttribute( ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE );
-        writeAddAttribute( ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN );
-        writeAddAttribute( ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED );
-        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" );
+        if ( writeStart )
+        {
+            writeStartElement( ElementTags.ITEXT );
+            writeAddAttribute( ElementTags.TITLE, header.getTitle() );
+            writeAddAttribute( ElementTags.AUTHOR, header.getAuthors() );
+            writeAddAttribute( ElementTags.CREATIONDATE, header.getDate() );
+            writeAddAttribute( ElementTags.SUBJECT, header.getTitle() );
+            writeAddAttribute( ElementTags.KEYWORDS, "" );
+            writeAddAttribute( ElementTags.PRODUCER, "Generated with Doxia by " + System.getProperty( "user.name" ) );
+            writeAddAttribute( ElementTags.PAGE_SIZE, ITextUtil.getPageSize( ITextUtil.getDefaultPageSize() ) );
+
+            writeStartElement( ElementTags.CHAPTER );
+            writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+            writeAddAttribute( ElementTags.DEPTH, depth );
+            writeAddAttribute( ElementTags.INDENT, "0.0" );
+
+            writeStartElement( ElementTags.TITLE );
+            writeAddAttribute( ElementTags.LEADING, DEFAULT_CHAPTER_TITLE_LEADING );
+            writeAddAttribute( ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME );
+            writeAddAttribute( ElementTags.SIZE, ITextFont.getSectionFontSize( 0 ) );
+            writeAddAttribute( ElementTags.STYLE, ITextFont.BOLD );
+            writeAddAttribute( ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE );
+            writeAddAttribute( ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN );
+            writeAddAttribute( ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED );
+            writeAddAttribute( ElementTags.ALIGN, ElementTags.ALIGN_CENTER );
+
+//            startChunk( ITextFont.DEFAULT_FONT_NAME, ITextFont.getSectionFontSize( 0 ), ITextFont.BOLD, ITextFont.DEFAULT_FONT_COLOR_BLUE, ITextFont.DEFAULT_FONT_COLOR_GREEN, ITextFont.DEFAULT_FONT_COLOR_RED, "top" );
+
+            writeStartElement( ElementTags.CHUNK );
+            writeAddAttribute( ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME );
+            writeAddAttribute( ElementTags.SIZE, ITextFont.getSectionFontSize( 0 ) );
+            writeAddAttribute( ElementTags.STYLE, ITextFont.BOLD );
+            writeAddAttribute( ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE );
+            writeAddAttribute( ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN );
+            writeAddAttribute( ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED );
+//            writeAddAttribute( ElementTags.LOCALDESTINATION, "top" );
 
-        write( this.header.getTitle() );
+            write( header.getTitle() );
 
-        writeEndElement(); // ElementTags.CHUNK
+            writeEndElement(); // ElementTags.CHUNK
 
-        writeEndElement(); // ElementTags.TITLE
+            writeEndElement(); // ElementTags.TITLE
+        }
 
-        this.actionContext.setAction( SinkActionContext.BODY );
+        actionContext.setAction( SinkActionContext.BODY );
     }
 
     // ----------------------------------------------------------------------
@@ -255,277 +265,282 @@
 
     public void sectionTitle()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle_()
     {
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE );
     }
 
     public void section1_()
     {
         writeEndElement(); // ElementTags.SECTION
 
-        this.numberDepth--;
-        this.depth = 0;
+        numberDepth--;
+        depth = 0;
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void section1()
     {
-        this.numberDepth++;
-        this.depth = 1;
+        numberDepth++;
+        depth = 1;
 
         writeStartElement( ElementTags.SECTION );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
+        writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+        writeAddAttribute( ElementTags.DEPTH, depth );
         writeAddAttribute( ElementTags.INDENT, "0.0" );
 
         lineBreak();
 
-        this.actionContext.setAction( SinkActionContext.SECTION_1 );
+        actionContext.setAction( SinkActionContext.SECTION_1 );
     }
 
     public void sectionTitle1_()
     {
         writeEndElement(); // ElementTags.TITLE
 
-        this.font.setSize( ITextFont.DEFAULT_FONT_SIZE );
+        font.setSize( ITextFont.DEFAULT_FONT_SIZE );
         bold_();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle1()
     {
-        this.font.setSize( ITextFont.getSectionFontSize( 1 ) );
-        this.font.setColor( Color.BLACK );
+        font.setSize( ITextFont.getSectionFontSize( 1 ) );
+        font.setColor( Color.BLACK );
         bold();
 
         writeStartElement( ElementTags.TITLE );
         writeAddAttribute( ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve
 
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE_1 );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE_1 );
     }
 
     public void section2_()
     {
         writeEndElement(); // ElementTags.SECTION
 
-        this.numberDepth--;
-        this.depth = 0;
+        numberDepth--;
+        depth = 0;
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void section2()
     {
-        this.numberDepth++;
-        this.depth = 1;
+        numberDepth++;
+        depth = 1;
 
         writeStartElement( ElementTags.SECTION );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
+        writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+        writeAddAttribute( ElementTags.DEPTH, depth );
         writeAddAttribute( ElementTags.INDENT, "0.0" );
 
         lineBreak();
 
-        this.actionContext.setAction( SinkActionContext.SECTION_2 );
+        actionContext.setAction( SinkActionContext.SECTION_2 );
     }
 
     public void sectionTitle2_()
     {
         writeEndElement(); // ElementTags.TITLE
 
-        this.font.setSize( ITextFont.DEFAULT_FONT_SIZE );
+        font.setSize( ITextFont.DEFAULT_FONT_SIZE );
         bold_();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle2()
     {
-        this.font.setSize( ITextFont.getSectionFontSize( 2 ) );
-        this.font.setColor( Color.BLACK );
+        font.setSize( ITextFont.getSectionFontSize( 2 ) );
+        font.setColor( Color.BLACK );
         bold();
 
         writeStartElement( ElementTags.TITLE );
         writeAddAttribute( ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve
 
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE_2 );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE_2 );
     }
 
     public void section3_()
     {
         writeEndElement(); // ElementTags.SECTION
 
-        this.numberDepth--;
-        this.depth = 1;
+        numberDepth--;
+        depth = 1;
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void section3()
     {
-        this.numberDepth++;
-        this.depth = 1;
+        numberDepth++;
+        depth = 1;
 
         writeStartElement( ElementTags.SECTION );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
+        writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+        writeAddAttribute( ElementTags.DEPTH, depth );
         writeAddAttribute( ElementTags.INDENT, "0.0" );
 
         lineBreak();
 
-        this.actionContext.setAction( SinkActionContext.SECTION_3 );
+        actionContext.setAction( SinkActionContext.SECTION_3 );
     }
 
     public void sectionTitle3_()
     {
         writeEndElement(); // ElementTags.TITLE
 
-        this.font.setSize( ITextFont.DEFAULT_FONT_SIZE );
+        font.setSize( ITextFont.DEFAULT_FONT_SIZE );
         bold_();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle3()
     {
-        this.font.setSize( ITextFont.getSectionFontSize( 3 ) );
-        this.font.setColor( Color.BLACK );
+        font.setSize( ITextFont.getSectionFontSize( 3 ) );
+        font.setColor( Color.BLACK );
         bold();
 
         writeStartElement( ElementTags.TITLE );
         writeAddAttribute( ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve
 
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE_3 );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE_3 );
     }
 
     public void section4_()
     {
         writeEndElement(); // ElementTags.SECTION
 
-        this.numberDepth--;
-        this.depth = 1;
+        numberDepth--;
+        depth = 1;
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void section4()
     {
-        this.numberDepth++;
-        this.depth = 1;
+        numberDepth++;
+        depth = 1;
 
         writeStartElement( ElementTags.SECTION );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
+        writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+        writeAddAttribute( ElementTags.DEPTH, depth );
         writeAddAttribute( ElementTags.INDENT, "0.0" );
 
         lineBreak();
 
-        this.actionContext.setAction( SinkActionContext.SECTION_4 );
+        actionContext.setAction( SinkActionContext.SECTION_4 );
     }
 
     public void sectionTitle4_()
     {
         writeEndElement(); // ElementTags.TITLE
 
-        this.font.setSize( ITextFont.DEFAULT_FONT_SIZE );
+        font.setSize( ITextFont.DEFAULT_FONT_SIZE );
         bold_();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle4()
     {
-        this.font.setSize( ITextFont.getSectionFontSize( 4 ) );
-        this.font.setColor( Color.BLACK );
+        font.setSize( ITextFont.getSectionFontSize( 4 ) );
+        font.setColor( Color.BLACK );
         bold();
 
         writeStartElement( ElementTags.TITLE );
         writeAddAttribute( ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve
 
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE_4 );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE_4 );
     }
 
     public void section5_()
     {
         writeEndElement(); // ElementTags.SECTION
 
-        this.numberDepth--;
-        this.depth = 1;
+        numberDepth--;
+        depth = 1;
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void section5()
     {
-        this.numberDepth++;
-        this.depth = 1;
+        numberDepth++;
+        depth = 1;
 
         writeStartElement( ElementTags.SECTION );
-        writeAddAttribute( ElementTags.NUMBERDEPTH, this.numberDepth );
-        writeAddAttribute( ElementTags.DEPTH, this.depth );
+        writeAddAttribute( ElementTags.NUMBERDEPTH, numberDepth );
+        writeAddAttribute( ElementTags.DEPTH, depth );
         writeAddAttribute( ElementTags.INDENT, "0.0" );
 
         lineBreak();
 
-        this.actionContext.setAction( SinkActionContext.SECTION_5 );
+        actionContext.setAction( SinkActionContext.SECTION_5 );
     }
 
     public void sectionTitle5_()
     {
         writeEndElement(); // ElementTags.TITLE
 
-        this.font.setSize( ITextFont.DEFAULT_FONT_SIZE );
+        font.setSize( ITextFont.DEFAULT_FONT_SIZE );
         bold_();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void sectionTitle5()
     {
-        this.font.setSize( ITextFont.getSectionFontSize( 5 ) );
-        this.font.setColor( Color.BLACK );
+        font.setSize( ITextFont.getSectionFontSize( 5 ) );
+        font.setColor( Color.BLACK );
         bold();
 
         writeStartElement( ElementTags.TITLE );
         writeAddAttribute( ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve
 
-        this.actionContext.setAction( SinkActionContext.SECTION_TITLE_5 );
+        actionContext.setAction( SinkActionContext.SECTION_TITLE_5 );
     }
 
     // ----------------------------------------------------------------------
@@ -535,34 +550,33 @@
     public void paragraph_()
     {
         // Special case
-        if ( ( this.actionContext.getCurrentAction() == SinkActionContext.LIST_ITEM )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.NUMBERED_LIST_ITEM )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.DEFINITION ) )
+        if ( ( actionContext.getCurrentAction() == SinkActionContext.LIST_ITEM )
+            || ( actionContext.getCurrentAction() == SinkActionContext.NUMBERED_LIST_ITEM )
+            || ( actionContext.getCurrentAction() == SinkActionContext.DEFINITION ) )
         {
             return;
         }
 
         writeEndElement(); // ElementTags.PARAGRAPH
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void paragraph()
     {
         // Special case
-        if ( ( this.actionContext.getCurrentAction() == SinkActionContext.LIST_ITEM )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.NUMBERED_LIST_ITEM )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.DEFINITION ) )
+        if ( ( actionContext.getCurrentAction() == SinkActionContext.LIST_ITEM )
+            || ( actionContext.getCurrentAction() == SinkActionContext.NUMBERED_LIST_ITEM )
+            || ( actionContext.getCurrentAction() == SinkActionContext.DEFINITION ) )
         {
             return;
         }
 
         writeStartElement( ElementTags.PARAGRAPH );
-
         writeStartElement( ElementTags.NEWLINE );
         writeEndElement();
 
-        this.actionContext.setAction( SinkActionContext.PARAGRAPH );
+        actionContext.setAction( SinkActionContext.PARAGRAPH );
     }
 
     // ----------------------------------------------------------------------
@@ -575,31 +589,31 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void list()
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.LIST );
         writeAddAttribute( ElementTags.NUMBERED, Boolean.FALSE.toString() );
         writeAddAttribute( ElementTags.SYMBOLINDENT, "15" );
 
-        this.actionContext.setAction( SinkActionContext.LIST );
+        actionContext.setAction( SinkActionContext.LIST );
     }
 
     public void listItem_()
     {
         writeEndElement(); // ElementTags.LISTITEM
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void listItem()
@@ -607,7 +621,7 @@
         writeStartElement( ElementTags.LISTITEM );
         writeAddAttribute( ElementTags.INDENTATIONLEFT, "20.0" );
 
-        this.actionContext.setAction( SinkActionContext.LIST_ITEM );
+        actionContext.setAction( SinkActionContext.LIST_ITEM );
     }
 
     public void numberedList_()
@@ -616,18 +630,18 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void numberedList( int numbering )
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.LIST );
         writeAddAttribute( ElementTags.NUMBERED, Boolean.TRUE.toString() );
@@ -661,14 +675,14 @@
                 writeAddAttribute( ElementTags.LETTERED, Boolean.FALSE.toString() );
         }
 
-        this.actionContext.setAction( SinkActionContext.NUMBERED_LIST );
+        actionContext.setAction( SinkActionContext.NUMBERED_LIST );
     }
 
     public void numberedListItem_()
     {
         writeEndElement(); // ElementTags.LISTITEM
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void numberedListItem()
@@ -676,17 +690,17 @@
         writeStartElement( ElementTags.LISTITEM );
         writeAddAttribute( ElementTags.INDENTATIONLEFT, "20" );
 
-        this.actionContext.setAction( SinkActionContext.NUMBERED_LIST_ITEM );
+        actionContext.setAction( SinkActionContext.NUMBERED_LIST_ITEM );
     }
 
     public void definitionList_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void definitionList()
     {
-        this.actionContext.setAction( SinkActionContext.DEFINITION_LIST );
+        actionContext.setAction( SinkActionContext.DEFINITION_LIST );
     }
 
     public void definedTerm_()
@@ -699,18 +713,18 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void definedTerm()
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.TABLE );
         writeAddAttribute( ElementTags.COLUMNS, "1" );
@@ -732,7 +746,7 @@
         writeAddAttribute( ElementTags.TOP, Boolean.FALSE.toString() );
         writeAddAttribute( ElementTags.BOTTOM, Boolean.FALSE.toString() );
 
-        this.actionContext.setAction( SinkActionContext.DEFINED_TERM );
+        actionContext.setAction( SinkActionContext.DEFINED_TERM );
     }
 
     public void definition_()
@@ -745,18 +759,18 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void definition()
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.TABLE );
         writeAddAttribute( ElementTags.COLUMNS, "2" );
@@ -789,20 +803,20 @@
         writeAddAttribute( ElementTags.TOP, Boolean.FALSE.toString() );
         writeAddAttribute( ElementTags.BOTTOM, Boolean.FALSE.toString() );
 
-        this.actionContext.setAction( SinkActionContext.DEFINITION );
+        actionContext.setAction( SinkActionContext.DEFINITION );
     }
 
     public void definitionListItem_()
     {
         // nop
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void definitionListItem()
     {
         // nop
 
-        this.actionContext.setAction( SinkActionContext.DEFINITION_LIST_ITEM );
+        actionContext.setAction( SinkActionContext.DEFINITION_LIST_ITEM );
     }
 
     // ----------------------------------------------------------------------
@@ -815,18 +829,18 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void table()
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.TABLE );
         writeAddAttribute( ElementTags.LEFT, Boolean.TRUE.toString() );
@@ -840,24 +854,24 @@
         writeAddAttribute( ElementTags.CELLPADDING, "10" );
         //writeAddAttribute( ElementTags.COLUMNS, "2" );
 
-        this.actionContext.setAction( SinkActionContext.TABLE );
+        actionContext.setAction( SinkActionContext.TABLE );
     }
 
     public void tableCaption_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void tableCaption()
     {
-        this.actionContext.setAction( SinkActionContext.TABLE_CAPTION );
+        actionContext.setAction( SinkActionContext.TABLE_CAPTION );
     }
 
     public void tableCell_()
     {
         writeEndElement(); // ElementTags.CELL
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void tableCell()
@@ -869,19 +883,19 @@
         writeAddAttribute( ElementTags.BOTTOM, Boolean.TRUE.toString() );
         writeAddAttribute( ElementTags.HORIZONTALALIGN, ElementTags.ALIGN_LEFT );
 
-        this.actionContext.setAction( SinkActionContext.TABLE_CELL );
+        actionContext.setAction( SinkActionContext.TABLE_CELL );
     }
 
     public void tableCell( String width )
     {
-        this.actionContext.setAction( SinkActionContext.TABLE_CELL );
+        actionContext.setAction( SinkActionContext.TABLE_CELL );
     }
 
     public void tableHeaderCell_()
     {
         writeEndElement(); // ElementTags.CELL
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void tableHeaderCell()
@@ -897,33 +911,33 @@
         writeAddAttribute( ElementTags.BGGREEN, Color.GRAY.getGreen() );
         writeAddAttribute( ElementTags.HORIZONTALALIGN, ElementTags.ALIGN_CENTER );
 
-        this.actionContext.setAction( SinkActionContext.TABLE_HEADER_CELL );
+        actionContext.setAction( SinkActionContext.TABLE_HEADER_CELL );
     }
 
     public void tableHeaderCell( String width )
     {
-        this.actionContext.setAction( SinkActionContext.TABLE_HEADER_CELL );
+        actionContext.setAction( SinkActionContext.TABLE_HEADER_CELL );
     }
 
     public void tableRow_()
     {
         writeEndElement(); // ElementTags.ROW
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void tableRow()
     {
         writeStartElement( ElementTags.ROW );
 
-        this.actionContext.setAction( SinkActionContext.TABLE_ROW );
+        actionContext.setAction( SinkActionContext.TABLE_ROW );
     }
 
     public void tableRows_()
     {
         //writeEndElement(); // ElementTags.TABLE
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void tableRows( int[] justification, boolean grid )
@@ -931,7 +945,7 @@
         // ElementTags.TABLE
         writeAddAttribute( ElementTags.COLUMNS, justification.length );
 
-        this.actionContext.setAction( SinkActionContext.TABLE_ROWS );
+        actionContext.setAction( SinkActionContext.TABLE_ROWS );
     }
 
     // ----------------------------------------------------------------------
@@ -948,19 +962,19 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void verbatim( boolean boxed )
     {
         // Always boxed
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.TABLE );
         writeAddAttribute( ElementTags.COLUMNS, "1" );
@@ -982,7 +996,7 @@
         writeAddAttribute( ElementTags.TOP, Boolean.TRUE.toString() );
         writeAddAttribute( ElementTags.BOTTOM, Boolean.TRUE.toString() );
 
-        this.actionContext.setAction( SinkActionContext.VERBATIM );
+        actionContext.setAction( SinkActionContext.VERBATIM );
     }
 
     // ----------------------------------------------------------------------
@@ -995,32 +1009,32 @@
 
         writeEndElement(); // ElementTags.CHUNK
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void figure()
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         writeStartElement( ElementTags.IMAGE );
 
-        this.actionContext.setAction( SinkActionContext.FIGURE );
+        actionContext.setAction( SinkActionContext.FIGURE );
     }
 
     public void figureCaption_()
     {
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void figureCaption()
     {
-        this.actionContext.setAction( SinkActionContext.FIGURE_CAPTION );
+        actionContext.setAction( SinkActionContext.FIGURE_CAPTION );
     }
 
     public void figureGraphics( String name )
@@ -1082,7 +1096,7 @@
         writeAddAttribute( ElementTags.PLAINWIDTH, String.valueOf( width ) );
         writeAddAttribute( ElementTags.PLAINHEIGHT, String.valueOf( height ) );
 
-        this.actionContext.setAction( SinkActionContext.FIGURE_GRAPHICS );
+        actionContext.setAction( SinkActionContext.FIGURE_GRAPHICS );
     }
 
     // ----------------------------------------------------------------------
@@ -1091,32 +1105,32 @@
 
     public void bold_()
     {
-        this.font.removeBold();
+        font.removeBold();
     }
 
     public void bold()
     {
-        this.font.addBold();
+        font.addBold();
     }
 
     public void italic_()
     {
-        this.font.removeItalic();
+        font.removeItalic();
     }
 
     public void italic()
     {
-        this.font.addItalic();
+        font.addItalic();
     }
 
     public void monospaced_()
     {
-        this.font.setMonoSpaced( false );
+        font.setMonoSpaced( false );
     }
 
     public void monospaced()
     {
-        this.font.setMonoSpaced( true );
+        font.setMonoSpaced( true );
     }
 
     // ----------------------------------------------------------------------
@@ -1127,34 +1141,34 @@
     {
         writeEndElement(); // ElementTags.ANCHOR
 
-        this.font.setColor( Color.BLACK );
-        this.font.removeUnderlined();
+        font.setColor( Color.BLACK );
+        font.removeUnderlined();
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void link( String name )
     {
-        this.font.setColor( Color.BLUE );
-        this.font.addUnderlined();
+        font.setColor( Color.BLUE );
+        font.addUnderlined();
 
         writeStartElement( ElementTags.ANCHOR );
         writeAddAttribute( ElementTags.REFERENCE, HtmlTools.escapeHTML( name ) );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
-        this.actionContext.setAction( SinkActionContext.LINK );
+        actionContext.setAction( SinkActionContext.LINK );
     }
 
     public void anchor_()
     {
         writeEndElement(); // ElementTags.ANCHOR
 
-        this.actionContext.release();
+        actionContext.release();
     }
 
     public void anchor( String name )
@@ -1162,7 +1176,7 @@
         writeStartElement( ElementTags.ANCHOR );
         writeAddAttribute( ElementTags.NAME, name );
 
-        this.actionContext.setAction( SinkActionContext.ANCHOR );
+        actionContext.setAction( SinkActionContext.ANCHOR );
     }
 
     // ----------------------------------------------------------------------
@@ -1172,9 +1186,9 @@
     public void lineBreak()
     {
         // Special case for the header
-        if ( ( this.actionContext.getCurrentAction() == SinkActionContext.AUTHOR )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.DATE )
-            || ( this.actionContext.getCurrentAction() == SinkActionContext.TITLE ) )
+        if ( ( actionContext.getCurrentAction() == SinkActionContext.AUTHOR )
+            || ( actionContext.getCurrentAction() == SinkActionContext.DATE )
+            || ( actionContext.getCurrentAction() == SinkActionContext.TITLE ) )
         {
             return;
         }
@@ -1207,12 +1221,12 @@
     public void rawText( String text )
     {
         writeStartElement( ElementTags.CHUNK );
-        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
         write( text, false );
 
@@ -1221,7 +1235,7 @@
 
     public void text( String text )
     {
-        switch ( this.actionContext.getCurrentAction() )
+        switch ( actionContext.getCurrentAction() )
         {
             case SinkActionContext.UNDEFINED:
                 break;
@@ -1230,25 +1244,25 @@
                 break;
 
             case SinkActionContext.AUTHOR:
-                this.header.addAuthor( text );
+                header.addAuthor( text );
                 break;
 
             case SinkActionContext.DATE:
-                this.header.setDate( text );
+                header.setDate( text );
                 break;
 
             case SinkActionContext.TITLE:
-                this.header.setTitle( text );
+                header.setTitle( text );
                 break;
 
             case SinkActionContext.SECTION_TITLE_1:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1257,12 +1271,12 @@
 
             case SinkActionContext.SECTION_TITLE_2:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1271,12 +1285,12 @@
 
             case SinkActionContext.SECTION_TITLE_3:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1285,12 +1299,12 @@
 
             case SinkActionContext.SECTION_TITLE_4:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1299,12 +1313,12 @@
 
             case SinkActionContext.SECTION_TITLE_5:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1313,12 +1327,12 @@
 
             case SinkActionContext.LIST_ITEM:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1327,12 +1341,12 @@
 
             case SinkActionContext.NUMBERED_LIST_ITEM:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1341,12 +1355,12 @@
 
             case SinkActionContext.DEFINED_TERM:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1355,12 +1369,12 @@
 
             case SinkActionContext.DEFINITION:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1375,12 +1389,12 @@
 
             case SinkActionContext.TABLE_HEADER_CELL:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1389,12 +1403,12 @@
 
             case SinkActionContext.TABLE_CELL:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1419,12 +1433,12 @@
                     while ( ( line = lnr.readLine() ) != null )
                     {
                         writeStartElement( ElementTags.CHUNK );
-                        writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                        writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                        writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                        writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                        writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                        writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                        writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                        writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                        writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                        writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                        writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                        writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                         write( "<![CDATA[", true );
                         // Special case
@@ -1453,12 +1467,12 @@
 
             case SinkActionContext.LINK:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1467,12 +1481,12 @@
 
             case SinkActionContext.ANCHOR:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1490,12 +1504,12 @@
             case SinkActionContext.PARAGRAPH:
             default:
                 writeStartElement( ElementTags.CHUNK );
-                writeAddAttribute( ElementTags.FONT, this.font.getFontName() );
-                writeAddAttribute( ElementTags.SIZE, this.font.getFontSize() );
-                writeAddAttribute( ElementTags.STYLE, this.font.getFontStyle() );
-                writeAddAttribute( ElementTags.BLUE, this.font.getFontColorBlue() );
-                writeAddAttribute( ElementTags.GREEN, this.font.getFontColorGreen() );
-                writeAddAttribute( ElementTags.RED, this.font.getFontColorRed() );
+                writeAddAttribute( ElementTags.FONT, font.getFontName() );
+                writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
+                writeAddAttribute( ElementTags.STYLE, font.getFontStyle() );
+                writeAddAttribute( ElementTags.BLUE, font.getFontColorBlue() );
+                writeAddAttribute( ElementTags.GREEN, font.getFontColorGreen() );
+                writeAddAttribute( ElementTags.RED, font.getFontColorRed() );
 
                 write( text );
 
@@ -1510,7 +1524,7 @@
      */
     private void writeStartElement( String tag )
     {
-        this.xmlWriter.startElement( tag );
+        xmlWriter.startElement( tag );
     }
 
     /**
@@ -1521,7 +1535,7 @@
      */
     private void writeAddAttribute( String key, String value )
     {
-        this.xmlWriter.addAttribute( key, value );
+        xmlWriter.addAttribute( key, value );
     }
 
     /**
@@ -1532,7 +1546,7 @@
      */
     private void writeAddAttribute( String key, int value )
     {
-        this.xmlWriter.addAttribute( key, String.valueOf( value ) );
+        xmlWriter.addAttribute( key, String.valueOf( value ) );
     }
 
     /**
@@ -1540,7 +1554,7 @@
      */
     private void writeEndElement()
     {
-        this.xmlWriter.endElement();
+        xmlWriter.endElement();
     }
 
     /**
@@ -1606,11 +1620,11 @@
         }
         if ( escapeHtml )
         {
-            this.xmlWriter.writeMarkup( aString );
+            xmlWriter.writeMarkup( aString );
         }
         else
         {
-            this.xmlWriter.writeText( aString );
+            xmlWriter.writeText( aString );
         }
     }
 
@@ -1635,4 +1649,16 @@
 
         return sb.toString().trim();
     }
-}
\ No newline at end of file
+
+    private void startChunk( String fontName, int fontSize, String fontStyle, int fontColorBlue, int fontColorGreen, int fontColorRed, String localDestination )
+    {
+        writeStartElement( ElementTags.CHUNK );
+        writeAddAttribute( ElementTags.FONT, fontName );
+        writeAddAttribute( ElementTags.SIZE, fontSize );
+        writeAddAttribute( ElementTags.STYLE, fontStyle );
+        writeAddAttribute( ElementTags.BLUE, fontColorBlue );
+        writeAddAttribute( ElementTags.GREEN, fontColorGreen );
+        writeAddAttribute( ElementTags.RED, fontColorRed );
+//        writeAddAttribute( ElementTags.LOCALDESTINATION, localDestination );
+    }
+}

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java Fri Jun 30 06:20:42 2006
@@ -106,16 +106,13 @@
      * @throws RuntimeException if any
      * @see com.lowagie.text.xml.XmlToPdf
      */
-    public static void writePdf( InputStream is,
-                                 OutputStream os )
-        throws RuntimeException
+    public static void writePdf( InputStream is, OutputStream os )
     {
         try
         {
             XmlToPdf x = new XmlToPdf();
 
             x.parse( is, os );
-
         }
         catch ( DocumentException e )
         {
@@ -132,9 +129,7 @@
      * @throws RuntimeException if any
      * @see com.lowagie.text.xml.XmlToRtf
      */
-    public static void writeRtf( InputStream is,
-                                 OutputStream os )
-        throws RuntimeException
+    public static void writeRtf( InputStream is, OutputStream os )
     {
         try
         {
@@ -156,9 +151,7 @@
      * @throws RuntimeException if any
      * @see com.lowagie.text.xml.XmlToHtml
      */
-    public static void writeHtml( InputStream is,
-                                  OutputStream os )
-        throws RuntimeException
+    public static void writeHtml( InputStream is, OutputStream os )
     {
         try
         {

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml Fri Jun 30 06:20:42 2006
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ITEXT SYSTEM "http://itext.sourceforge.net/itext.dtd">
 <itext creationdate="Sun Feb 08 12:53:24 CET 2004" producer="iTextXML by lowagie.com">
 	<paragraph leading="18.0" font="unknown" align="Default">
 		Please visit my 

Modified: maven/doxia/trunk/doxia-sandbox/doxia-book/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/pom.xml?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/pom.xml (original)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/pom.xml Fri Jun 30 06:20:42 2006
@@ -7,7 +7,13 @@
   </parent>
   <artifactId>doxia-book</artifactId>
   <version>1.0-alpha-1-SNAPSHOT</version>
+  <name>Doxia Book Components</name>
   <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>doxia-editor</artifactId>
+      <version>1.0-alpha-1-SNAPSHOT</version>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>doxia-core</artifactId>

Modified: maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java (original)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java Fri Jun 30 06:20:42 2006
@@ -20,6 +20,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -80,7 +81,7 @@
 
         if ( !validationResult.isAllOk() )
         {
-            throw new BookDoxiaException( "Could not validate the book model." );
+            throw new InvalidBookDescriptorException( validationResult );
         }
 
         // ----------------------------------------------------------------------
@@ -121,6 +122,22 @@
 
                     context.getFiles().put( name, bookFile );
                 }
+            }
+        }
+
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( "Dumping document <-> id mapping:" );
+
+            Map map = new TreeMap( context.getFiles() );
+
+            for ( Iterator it = map.entrySet().iterator(); it.hasNext(); )
+            {
+                Map.Entry entry = (Map.Entry) it.next();
+
+                BookContext.BookFile file = (BookContext.BookFile) entry.getValue();
+
+                getLogger().debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() );
             }
         }
 

Added: maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/InvalidBookDescriptorException.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/InvalidBookDescriptorException.java?rev=418259&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/InvalidBookDescriptorException.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/InvalidBookDescriptorException.java Fri Jun 30 06:20:42 2006
@@ -0,0 +1,25 @@
+package org.apache.maven.doxia.book;
+
+import org.apache.maven.doxia.book.services.validation.ValidationResult;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class InvalidBookDescriptorException
+    extends BookDoxiaException
+{
+    private ValidationResult validationResult;
+
+    public InvalidBookDescriptorException( ValidationResult validationResult )
+    {
+        super( "Invalid book descriptor." );
+
+        this.validationResult = validationResult;
+    }
+
+    public ValidationResult getValidationResult()
+    {
+        return validationResult;
+    }
+}

Modified: maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/indexer/BookIndexingSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/indexer/BookIndexingSink.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/indexer/BookIndexingSink.java (original)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/indexer/BookIndexingSink.java Fri Jun 30 06:20:42 2006
@@ -111,7 +111,7 @@
         {
             List entries = parent.getChildEntries();
 
-            parent = (TOCEntry) entries.get( entries.size() );
+            parent = (TOCEntry) entries.get( entries.size() - 1 );
         }
 
         parent.getChildEntries().add( entry );

Modified: maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/ITextBookRenderer.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/ITextBookRenderer.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/ITextBookRenderer.java (original)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/ITextBookRenderer.java Fri Jun 30 06:20:42 2006
@@ -9,10 +9,13 @@
 import org.apache.maven.doxia.module.itext.ITextUtil;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.Doxia;
+import org.apache.maven.doxia.editor.io.DebugSink;
+import org.apache.maven.doxia.editor.io.PipelineSink;
 import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
 import org.apache.maven.doxia.parser.ParseException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -23,6 +26,8 @@
 import java.io.FileInputStream;
 import java.util.Iterator;
 import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
 import java.text.DateFormat;
 
 /**
@@ -74,11 +79,42 @@
         // Create the XML File
         // ----------------------------------------------------------------------
 
-        PrettyPrintXMLWriter writer = new PrettyPrintXMLWriter( fileWriter );
+        PrettyPrintXMLWriter writer = new PrettyPrintXMLWriter( fileWriter, "UTF-8", null);
         writer.startElement( "itext" );
         writer.addAttribute( "creationdate", DateFormat.getDateTimeInstance().format( new Date() ) );
         writer.addAttribute( "producer", "Doxia iText" );
 
+//        writer.startElement( "paragraph" );
+//        writer.addAttribute( "leading", "18.0" );
+//        writer.addAttribute( "font", "unknown" );
+//        writer.addAttribute( "align", "Default" );
+//        writer.writeText( "Please visit my" + System.getProperty( "line.separator" ) );
+//
+//        writer.startElement( "anchor" );
+//        writer.addAttribute( "leading", "18.0" );
+//        writer.addAttribute( "font", "Helvetica" );
+//        writer.addAttribute( "size", "12.0" );
+//        writer.addAttribute( "fontstyle", "normal, underline" );
+//        writer.addAttribute( "red", "0" );
+//        writer.addAttribute( "green", "0" );
+//        writer.addAttribute( "blue", "255" );
+//        writer.addAttribute( "name", "top" );
+//        writer.addAttribute( "reference", "http://www.lowagie.com/iText/" );
+//
+//        writer.startElement( "chunk" );
+//        writer.addAttribute( "font", "Helvetica" );
+//        writer.addAttribute( "size", "12.0" );
+//        writer.addAttribute( "fontstyle", "normal, underline" );
+//        writer.addAttribute( "red", "0" );
+//        writer.addAttribute( "green", "0" );
+//        writer.addAttribute( "blue", "255" );
+//        writer.writeText( "website (external reference)" );
+//        writer.endElement();
+//
+//        writer.endElement(); // anchor
+//
+//        writer.endElement(); // paragraph
+
         // TODO: Write out TOC
 
         for ( Iterator it = book.getChapters().iterator(); it.hasNext(); )
@@ -131,12 +167,14 @@
         chunk( writer, chapter.getTitle(), "Helvetica", "24.0", "normal","255", "0", "0" );
         writer.endElement(); // title
 
+//        writer.startElement( "sectioncontent" );
         for ( Iterator it = chapter.getSections().iterator(); it.hasNext(); )
         {
             Section section = (Section) it.next();
 
             renderSection( writer, section, context );
         }
+//        writer.endElement(); // sectioncontent
 
         writer.endElement(); // chapter
     }
@@ -161,7 +199,12 @@
         //
         // ----------------------------------------------------------------------
 
-        Sink sink = new ITextSink( writer );
+        Sink itextSink = new ITextSink( writer );
+
+        List pipeline = new ArrayList();
+//        pipeline.add( DebugSink.newInstance() );
+        pipeline.add( itextSink );
+        Sink sink = PipelineSink.newInstance( pipeline );
 
         try
         {
@@ -206,8 +249,14 @@
         writer.addAttribute( "red", red );
         writer.addAttribute( "green", green );
         writer.addAttribute( "blue", blue );
-        // TODO: Handle empty title
-        writer.writeText( title );
+        if ( StringUtils.isNotEmpty( title ) )
+        {
+            writer.writeText( title );
+        }
+        else
+        {
+            writer.writeText( "<Missing title>" );
+        }
         writer.endElement(); // chunk
     }
 }

Modified: maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java?rev=418259&r1=418258&r2=418259&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java (original)
+++ maven/doxia/trunk/doxia-sandbox/doxia-book/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java Fri Jun 30 06:20:42 2006
@@ -5,6 +5,9 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 import org.apache.maven.doxia.book.model.Book;
+import org.apache.maven.doxia.book.model.Chapter;
+
+import java.util.Iterator;
 
 /**
  * @plexus.component
@@ -14,7 +17,7 @@
  */
 public class DefaultBookValidator
     extends AbstractLogEnabled
-    implements BookValidator, Initializable
+    implements BookValidator
 {
     // ----------------------------------------------------------------------
     // BookValidator Implementation
@@ -29,15 +32,39 @@
             result.getErrors().add( "Book is missing id." );
         }
 
+        if ( book.getChapters().size() == 0 )
+        {
+            result.getErrors().add( "The book must have at least one chaper" );
+        }
+        else
+        {
+            for ( Iterator it = book.getChapters().iterator(); it.hasNext(); )
+            {
+                Chapter chapter = (Chapter) it.next();
+
+                validateChapter( result, chapter );
+            }
+        }
+
         return result;
     }
 
     // ----------------------------------------------------------------------
-    // Component Lifecycle
+    // Private
     // ----------------------------------------------------------------------
 
-    public void initialize()
-        throws InitializationException
+    private void validateChapter( ValidationResult result, Chapter chapter )
     {
+        if ( StringUtils.isEmpty( chapter.getId() ) )
+        {
+            result.getErrors().add( "Each chapter has to have an id." );
+
+            return;
+        }
+
+        if ( chapter.getSections().size() == 0 )
+        {
+            result.getErrors().add( "Each chapter has to contain at least one section. Chapter id: " + chapter.getId() );
+        }
     }
 }



Mime
View raw message