Index: doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
===================================================================
--- doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (revision 0)
+++ doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (revision 0)
@@ -0,0 +1,216 @@
+package org.apache.maven.doxia.book.services.renderer.docbook;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Writer;
+
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML.Tag;
+
+import org.apache.maven.doxia.module.docbook.DocBookSink;
+import org.apache.maven.doxia.module.docbook.DocbookMarkup;
+
+/**
+ * An Docbook Sink that doesn't write out head or body elements for every section of a book, and has some convenience
+ * methods relating to the construction of a Doxia Book.
+ *
+ * @author Dave Syer
+ * @version $Id: XhtmlBookSink.java 573052 2007-09-05 20:53:09Z ltheussl $
+ */
+public class DocBookBookSink
+ extends DocBookSink
+{
+
+ private boolean hasHead = false;
+
+ /**
+ * Construct a new DocBookSink.
+ *
+ * @param out the writer for the sink.
+ * @param context the RenderingContext.
+ */
+ public DocBookBookSink( Writer out )
+ {
+ super( out );
+ setXMLMode( true );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void head()
+ {
+ // noop
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void head_()
+ {
+ // noop
+ }
+
+ /** Marks the skip flag to true so that this element's text is not emitted by the base class. */
+ public void title()
+ {
+ setSkip( true );
+ }
+
+ /** Marks the skip flag to false so that rendering can resume. */
+ public void title_()
+ {
+ setSkip( false );
+ }
+
+ /** Marks the skip flag to true so that this element's text is not emitted by the base class. */
+ public void author()
+ {
+ setSkip( true );
+ }
+
+ /** Marks the skip flag to false so that rendering can resume. */
+ public void author_()
+ {
+ setSkip( false );
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void body()
+ {
+ // noop
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void body_()
+ {
+ // noop
+ }
+
+ /**
+ * Emit the start tag for the book.
+ *
+ * @see DocbookMarkup#BOOK_TAG
+ */
+ public void book()
+ {
+ resetState();
+
+ MutableAttributeSet att = writeXmlHeader( "book" );
+
+ writeStartTag( BOOK_TAG, att );
+
+ }
+
+ /**
+ * Emit the end tag for the book.
+ *
+ * @see DocbookMarkup#BOOK_TAG
+ */
+ public void book_()
+ {
+ writeEndTag( BOOK_TAG );
+ flush();
+ }
+
+ /** If no header matter has yet been encountered emit the book info start tag. */
+ private void bookHead()
+ {
+ if ( !hasHead )
+ {
+ writeStartTag( BOOKINFO_TAG );
+ hasHead = true;
+ }
+ }
+
+ /** If some header matter has been encountered emit the book info end tag. */
+ public void bookHead_()
+ {
+ if ( hasHead )
+ {
+ writeEndTag( BOOKINFO_TAG );
+ hasHead = false;
+ }
+ }
+
+ /** Emit the title start tag for the whole book. */
+ public void bookTitle()
+ {
+ bookHead();
+ writeStartTag( Tag.TITLE );
+ }
+
+ /** Emit the title end tag for the whole book. */
+ public void bookTitle_()
+ {
+ super.title_();
+ }
+
+ /** Emit the author start tag for the whole book. */
+ public void bookAuthor()
+ {
+ bookHead();
+ super.author();
+ }
+
+ /** Emit the author end tag for the whole book. */
+ public void bookAuthor_()
+ {
+ super.author_();
+ }
+
+ /** Emit the date start tag for the whole book. */
+ public void bookDate()
+ {
+ bookHead();
+ super.date();
+ hasHead = true;
+ }
+
+ /** Emit the date end tag for the whole book. */
+ public void bookDate_()
+ {
+ super.date_();
+ }
+
+ /** Emit the chapter start tag. */
+ public void chapter()
+ {
+ writeStartTag( CHAPTER_TAG );
+ }
+
+ /** Emit the chapter end tag. */
+ public void chapter_()
+ {
+ writeEndTag( CHAPTER_TAG );
+ }
+
+ /** Emit the chapter title start tag. */
+ public void chapterTitle()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /** Emit the chapter title end tag. */
+ public void chapterTitle_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+}
Index: doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
===================================================================
--- doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (revision 0)
+++ doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (revision 0)
@@ -0,0 +1,216 @@
+package org.apache.maven.doxia.book.services.renderer.docbook;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Writer;
+
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML.Tag;
+
+import org.apache.maven.doxia.module.docbook.DocBookSink;
+import org.apache.maven.doxia.module.docbook.DocbookMarkup;
+
+/**
+ * An Docbook Sink that doesn't write out head or body elements for every section of a book, and has some convenience
+ * methods relating to the construction of a Doxia Book.
+ *
+ * @author Dave Syer
+ * @version $Id: XhtmlBookSink.java 573052 2007-09-05 20:53:09Z ltheussl $
+ */
+public class DocBookBookSink
+ extends DocBookSink
+{
+
+ private boolean hasHead = false;
+
+ /**
+ * Construct a new DocBookSink.
+ *
+ * @param out the writer for the sink.
+ * @param context the RenderingContext.
+ */
+ public DocBookBookSink( Writer out )
+ {
+ super( out );
+ setXMLMode( true );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void head()
+ {
+ // noop
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void head_()
+ {
+ // noop
+ }
+
+ /** Marks the skip flag to true so that this element's text is not emitted by the base class. */
+ public void title()
+ {
+ setSkip( true );
+ }
+
+ /** Marks the skip flag to false so that rendering can resume. */
+ public void title_()
+ {
+ setSkip( false );
+ }
+
+ /** Marks the skip flag to true so that this element's text is not emitted by the base class. */
+ public void author()
+ {
+ setSkip( true );
+ }
+
+ /** Marks the skip flag to false so that rendering can resume. */
+ public void author_()
+ {
+ setSkip( false );
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void body()
+ {
+ // noop
+ }
+
+ /** Does nothing because we don't want the header from each document to crop up in the middle of a book. */
+ public void body_()
+ {
+ // noop
+ }
+
+ /**
+ * Emit the start tag for the book.
+ *
+ * @see DocbookMarkup#BOOK_TAG
+ */
+ public void book()
+ {
+ resetState();
+
+ MutableAttributeSet att = writeXmlHeader( "book" );
+
+ writeStartTag( BOOK_TAG, att );
+
+ }
+
+ /**
+ * Emit the end tag for the book.
+ *
+ * @see DocbookMarkup#BOOK_TAG
+ */
+ public void book_()
+ {
+ writeEndTag( BOOK_TAG );
+ flush();
+ }
+
+ /** If no header matter has yet been encountered emit the book info start tag. */
+ private void bookHead()
+ {
+ if ( !hasHead )
+ {
+ writeStartTag( BOOKINFO_TAG );
+ hasHead = true;
+ }
+ }
+
+ /** If some header matter has been encountered emit the book info end tag. */
+ public void bookHead_()
+ {
+ if ( hasHead )
+ {
+ writeEndTag( BOOKINFO_TAG );
+ hasHead = false;
+ }
+ }
+
+ /** Emit the title start tag for the whole book. */
+ public void bookTitle()
+ {
+ bookHead();
+ writeStartTag( Tag.TITLE );
+ }
+
+ /** Emit the title end tag for the whole book. */
+ public void bookTitle_()
+ {
+ super.title_();
+ }
+
+ /** Emit the author start tag for the whole book. */
+ public void bookAuthor()
+ {
+ bookHead();
+ super.author();
+ }
+
+ /** Emit the author end tag for the whole book. */
+ public void bookAuthor_()
+ {
+ super.author_();
+ }
+
+ /** Emit the date start tag for the whole book. */
+ public void bookDate()
+ {
+ bookHead();
+ super.date();
+ hasHead = true;
+ }
+
+ /** Emit the date end tag for the whole book. */
+ public void bookDate_()
+ {
+ super.date_();
+ }
+
+ /** Emit the chapter start tag. */
+ public void chapter()
+ {
+ writeStartTag( CHAPTER_TAG );
+ }
+
+ /** Emit the chapter end tag. */
+ public void chapter_()
+ {
+ writeEndTag( CHAPTER_TAG );
+ }
+
+ /** Emit the chapter title start tag. */
+ public void chapterTitle()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /** Emit the chapter title end tag. */
+ public void chapterTitle_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+}
Index: doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java
===================================================================
--- doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java (revision 593752)
+++ doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java (working copy)
@@ -33,20 +33,22 @@
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.model.Chapter;
import org.apache.maven.doxia.book.model.Section;
-import org.apache.maven.doxia.module.docbook.DocBookSink;
+import org.apache.maven.doxia.book.services.renderer.docbook.DocBookBookSink;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.apache.maven.doxia.sink.Sink;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
/**
* An implementation of BookRenderer for docbook
*
* @plexus.component role-hint="doc-book"
- *
* @author Eric Redmond
*/
-public class DocbookBookRenderer extends AbstractLogEnabled implements BookRenderer
+public class DocbookBookRenderer
+ extends AbstractLogEnabled
+ implements BookRenderer
{
/**
* @plexus.requirement
@@ -58,7 +60,8 @@
// ----------------------------------------------------------------------
/** {@inheritDoc} */
- public void renderBook( BookContext context ) throws BookDoxiaException
+ public void renderBook( BookContext context )
+ throws BookDoxiaException
{
BookModel book = context.getBook();
@@ -66,8 +69,8 @@
{
if ( !context.getOutputDirectory().mkdirs() )
{
- throw new BookDoxiaException( "Could not make directory: "
- + context.getOutputDirectory().getAbsolutePath() + "." );
+ throw new BookDoxiaException( "Could not make directory: " +
+ context.getOutputDirectory().getAbsolutePath() + "." );
}
}
@@ -90,13 +93,41 @@
// TODO: Write out TOC?
- DocBookSink sink = new DocBookSink( fileWriter, true );
+ DocBookBookSink sink = new DocBookBookSink( fileWriter );
+ sink.book();
+
+ if ( StringUtils.isNotEmpty( book.getTitle() ) )
+ {
+ sink.bookTitle();
+ sink.text( book.getTitle() );
+ sink.bookTitle_();
+ }
+ if ( StringUtils.isNotEmpty( book.getDate() ) )
+ {
+ sink.bookDate();
+ sink.text( book.getDate() );
+ sink.bookDate_();
+ }
+ if ( StringUtils.isNotEmpty( book.getAuthor() ) )
+ {
+ sink.bookAuthor();
+ sink.text( book.getAuthor() );
+ sink.bookAuthor_();
+ }
+ sink.bookHead_();
+
for ( Iterator it = book.getChapters().iterator(); it.hasNext(); )
{
Chapter chapter = (Chapter) it.next();
-
+ sink.chapter();
+ if (StringUtils.isNotEmpty( chapter.getTitle())) {
+ sink.chapterTitle();
+ sink.text( chapter.getTitle() );
+ sink.chapterTitle_();
+ }
renderChapter( fileWriter, chapter, context, sink );
+ sink.chapter_();
}
sink.book_();
@@ -113,11 +144,10 @@
/**
* Write a chapter.
- *
+ *
* @param writer the writer.
* @param chapter the Chapter.
- * @param context the BookContext.
- * @param sink a Sink.
+ * @param context the BookContext. * @param sink a Sink.
* @throws BookDoxiaException if the chapter cannot be written.
*/
private void renderChapter( Writer writer, Chapter chapter, BookContext context, Sink sink )
@@ -133,7 +163,7 @@
/**
* Write a section.
- *
+ *
* @param writer the writer.
* @param section the Section.
* @param context the BookContext.
Index: doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java
===================================================================
--- doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java (revision 593752)
+++ doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java (working copy)
@@ -21,6 +21,7 @@
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
import org.apache.maven.doxia.book.model.BookModel;
import java.io.File;
@@ -50,5 +51,26 @@
doxia.renderBook( book, "latex", files, getTestFile( "target/test-output/latex" ) );
doxia.renderBook( book, "doc-book", files, getTestFile( "target/test-output/doc-book" ) );
doxia.renderBook( book, "rtf", files, getTestFile( "target/test-output/rtf" ) );
+
}
+
+ /**
+ * Regression test for the docbook output
+ */
+ public void testDocbook()
+ throws Exception
+ {
+ BookDoxia doxia = (BookDoxia) lookup( BookDoxia.ROLE );
+
+ File book1 = getTestFile( "src/test/resources/book-1.xml" );
+
+ List files = FileUtils.getFiles( getTestFile( "src/test/resources/book-1" ), "**/*.apt, **/*.xml", "" );
+
+ BookModel book = doxia.loadBook( book1 );
+
+ String target = FileUtils.fileRead( getTestFile( "src/test/resources/plexus-user-guide.xml" ) );
+ doxia.renderBook( book, "doc-book", files, getTestFile( "target/test-output/doc-book" ) );
+ String source = FileUtils.fileRead( getTestFile( "target/test-output/doc-book/plexus-user-guide.xml" ) );
+ assertEquals(StringUtils.replace( target, "\r", ""), StringUtils.replace( source, "\r", ""));
+ }
}
Index: doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
===================================================================
--- doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (revision 0)
+++ doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (working copy)
@@ -1,16 +1,17 @@
-package org.apache.maven.doxia.module.docbook;
+package org.apache.maven.doxia.book.services.renderer.docbook;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import org.apache.maven.doxia.module.docbook.DocBookParser;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.AbstractSinkTestCase;
import org.apache.maven.doxia.sink.Sink;
/**
* Test the book path of the DockBook sink
- * @author eredmond
+ * @author Dave Syer
*/
public class DocBookBookSinkTest extends AbstractSinkTestCase
{
@@ -26,7 +27,7 @@
protected Sink createSink() throws Exception
{
- return new DocBookSink( getTestWriter(), true );
+ return new DocBookBookSink( getTestWriter() );
}
protected Reader getTestReader() throws Exception
Index: doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
===================================================================
--- doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (revision 0)
+++ doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (working copy)
@@ -1,16 +1,17 @@
-package org.apache.maven.doxia.module.docbook;
+package org.apache.maven.doxia.book.services.renderer.docbook;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import org.apache.maven.doxia.module.docbook.DocBookParser;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.AbstractSinkTestCase;
import org.apache.maven.doxia.sink.Sink;
/**
* Test the book path of the DockBook sink
- * @author eredmond
+ * @author Dave Syer
*/
public class DocBookBookSinkTest extends AbstractSinkTestCase
{
@@ -26,7 +27,7 @@
protected Sink createSink() throws Exception
{
- return new DocBookSink( getTestWriter(), true );
+ return new DocBookBookSink( getTestWriter() );
}
protected Reader getTestReader() throws Exception
Index: doxia-book/src/test/resources/plexus-user-guide.xml
===================================================================
--- doxia-book/src/test/resources/plexus-user-guide.xml (revision 0)
+++ doxia-book/src/test/resources/plexus-user-guide.xml (revision 0)
@@ -0,0 +1,125 @@
+
+
+Test Book
+
+Chapter 1
+Subsection 1
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec sagittis
+malesuada nisi. Aliquam orci eros, vestibulum eu, placerat et, pretium sed,
+nisi. Proin consequat. Praesent faucibus sem id arcu hendrerit nonummy.
+Aliquam blandit accumsan pede. Vivamus aliquet lacinia nunc. Praesent dapibus
+orci eu magna. Cras nonummy, pede nec facilisis semper, sem nibh vestibulum
+massa, sed ornare tortor elit non lectus. Nullam mauris turpis, luctus et,
+vulputate vitae, commodo sit amet, purus. Fusce erat. Proin ullamcorper
+imperdiet est. Morbi sit amet dui. Fusce bibendum auctor augue. Sed leo
+sapien, vehicula ac, nonummy id, cursus at, nulla. Ut sed purus.
+Subsubsection 1
+Suspendisse sagittis metus nec leo. Suspendisse velit. Phasellus ipsum
+dolor, porttitor ut1, varius id, scelerisque vel, ligula. Aliquam tempor sem
+in pede tincidunt nonummy. Vestibulum et nulla. Nunc et dolor a risus
+porttitor tem pus. Sed felis arcu, consectetuer non, imperdiet sollicitudin,
+ullamcorper vitae, nulla. Vestibulum ante ipsum primis in faucibus.
+
+
+Subsection 2
+Duis eget libero aliquet quam ultrices malesuada. Donec molestie
+dignissim nunc. Curabitur turpis. Suspendisse a nibh ut elit vulputate
+ultrices. Etiam nulla erat, nonummy vel, fringilla at, scelerisque non, ante.
+Suspendisse adipiscing rhoncus purus. Nulla in augue. Ut ac nisi eu nisi
+cursus elementum. Pellentesque habitant morbi tristique senectus et netus et
+malesuada fames ac turpis egestas. Donec et turpis. Donec nec mi. Mauris
+malesuada congue sem. Maecenas et urna in nisi sagittis facilisis. Cras nibh.
+Aliquam purus. Donec convallis congue libero. Nulla feugiat. Nulla massa
+libero, consectetuer ac, aliquet ac, consequat eu, purus. Pellentesque
+eleifend pretium augue.
+
+Subsection 3
+Integer auctor, nisi ut convallis imperdiet, ligula diam sollicitudin
+dolor, porttitor mattis urna sapien at velit. Fusce vestibulum, neque nec
+malesuada tempor, tortor nisi accumsan purus, quis faucibus metus elit ac
+urna. Aliquam commodo velit vel ipsum. Donec blandit diam blandit eros.
+Aliquam pretium fermentum neque. Sed nec tellus eu orci ullamcorper facilisis.
+Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
+turpis egestas. Nulla sed leo. Class aptent taciti sociosqu ad litora torquent
+per conubia nostra, per inceptos hymenaeos. Fusce suscipit. Sed sit amet diam
+ac ante tincidunt ornare. Sed sodales vestibulum quam. Fusce accumsan. Ut ut
+mi.
+
+Subsection 4
+Maecenas tincidunt lobortis nunc. Phasellus euismod diam sit amet felis.
+Donec lorem metus, vulputate vitae, ornare vel, molestie sit amet, pede. In
+erat velit, adipiscing sed, varius in, interdum cursus, enim. Quisque dolor
+ante, tincidunt vel, congue eget, consectetuer id, nunc. Suspendisse
+hendrerit. Proin egestas, massa eget egestas ullamcorper, nisl elit gravida
+magna, vitae dignissim odio velit ut tortor. Fusce lobortis consequat nulla.
+Vestibulum pretium justo at metus. Sed lorem velit, elementum eget,
+pellentesque ac, ornare id, mi. Pellentesque vel ligula et erat dictum
+commodo. Integer malesuada lacus nec metus. Aliquam id purus ac neque mattis
+venenatis. Aenean lobortis accumsan massa. Donec dui ante, facilisis vel,
+hendrerit ut, vehicula in, eros. Suspendisse potenti. Sed fringilla.
+Suspendisse vel nibh. Sed sit amet lacus quis massa tincidunt elementum. Ut ut
+augue vitae ligula dapibus aliquam.
+
+Subsection 5
+Fusce non eros non lectus venenatis bibendum. Nullam pharetra. Nunc
+commodo pede et metus. Pellentesque habitant morbi tristique senectus et netus
+et malesuada fames ac turpis egestas. Vestibulum imperdiet nisl nec nulla.
+Morbi congue dictum pede. Aliquam ligula. In pede nulla, varius a, blandit ut,
+pulvinar vitae, mauris. Suspendisse sit amet magna. Curabitur cursus placerat
+justo. Vivamus imperdiet magna commodo mi. Vestibulum eget metus quis sem
+sollicitudin consectetuer. Morbi metus augue, elementum rutrum, luctus quis,
+porttitor a, est. Phasellus quis sapien et augue adipiscing fermentum. Sed
+fermentum tristique dui. Vivamus aliquam, tortor at ultricies commodo, urna
+ipsum fringilla neque, sit amet congue purus enim a justo.
+
+Section 1.10.32 of "de Finibus Bonorum et Malorum",
+written by Cicero in 45 BC
+Sed ut perspiciatis unde omnis iste natus error sit voluptatem
+accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo
+inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
+Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
+sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
+Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur,
+adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et
+dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis
+nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex
+ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea
+voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem
+eum fugiat quo voluptas nulla pariatur?
+
+
+Chapter 2
+1914 translation by H. Rackham
+But I must explain to you how all this mistaken idea of denouncing
+pleasure and praising pain was born and I will give you a complete account of
+the system, and expound the actual teachings of the great explorer of the
+truth, the master-builder of human happiness. No one rejects, dislikes, or
+avoids pleasure itself, because it is pleasure, but because those who do not
+know how to pursue pleasure rationally encounter consequences that are
+extremely painful. Nor again is there anyone who loves or pursues or desires
+to obtain pain of itself, because it is pain, but because occasionally
+circumstances occur in which toil and pain can procure him some great
+pleasure. To take a trivial example, which of us ever undertakes laborious
+physical exercise, except to obtain some advantage from it? But who has any
+right to find fault with a man who chooses to enjoy a pleasure that has no
+annoying consequences, or one who avoids a pain that produces no resultant
+pleasure?
+
+Section 1.10.33 of "de Finibus Bonorum et Malorum",
+written by Cicero in 45 BC
+At vero eos et accusamus et iusto odio dignissimos ducimus qui
+blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas
+molestias excepturi sint occaecati cupiditate non provident, similique sunt in
+culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et
+harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum
+soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime
+placeat facere possimus, omnis voluptas assumenda est, omnis dolor
+repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum
+necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae
+non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut
+reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus
+asperiores repellat.
+
+
+
Index: doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
===================================================================
--- doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (revision 593752)
+++ doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (working copy)
@@ -19,12 +19,6 @@
* under the License.
*/
-import org.apache.maven.doxia.parser.Parser;
-import org.apache.maven.doxia.sink.AbstractXmlSink;
-import org.apache.maven.doxia.sink.StructureSink;
-import org.apache.maven.doxia.util.LineBreaker;
-import org.codehaus.plexus.util.FileUtils;
-
import java.io.StringWriter;
import java.io.Writer;
import java.util.StringTokenizer;
@@ -34,9 +28,15 @@
import javax.swing.text.html.HTML.Attribute;
import javax.swing.text.html.HTML.Tag;
+import org.apache.maven.doxia.parser.Parser;
+import org.apache.maven.doxia.sink.AbstractXmlSink;
+import org.apache.maven.doxia.sink.StructureSink;
+import org.apache.maven.doxia.util.LineBreaker;
+import org.codehaus.plexus.util.FileUtils;
+
/**
* A doxia Sink which produces a Docbook model.
- *
+ *
* @version $Id$
* @since 1.0
*/
@@ -44,15 +44,18 @@
extends AbstractXmlSink
implements DocbookMarkup
{
- /** DocBook V4.1 SGML public id: "-//OASIS//DTD DocBook V4.1//EN" */
- public static final String DEFAULT_SGML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.1//EN";
+ /** DocBook V4.4 SGML public id: "-//OASIS//DTD DocBook V4.4//EN" */
+ public static final String DEFAULT_SGML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.4//EN";
- /** DocBook XML V4.1.2 XML public id: "-//OASIS//DTD DocBook XML V4.1.2//EN" */
- public static final String DEFAULT_XML_PUBLIC_ID = "-//OASIS//DTD DocBook XML V4.1.2//EN";
+ /** DocBook XML V4.4 XML public id: "-//OASIS//DTD DocBook XML V4.4//EN" */
+ public static final String DEFAULT_XML_PUBLIC_ID = "-//OASIS//DTD DocBook V4.4//EN";
- /** DocBook XML V4.0 XML system id: "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd" */
- public static final String DEFAULT_XML_SYSTEM_ID = "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd";
+ /** DocBook XML V4.4 XML system id: "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" */
+ public static final String DEFAULT_XML_SYSTEM_ID = "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd";
+ /** DocBook XML V4.4 SGML system id: "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" */
+ public static final String DEFAULT_SGML_SYSTEM_ID = "http://www.oasis-open.org/docbook/sgml/4.4/docbookx.dtd";
+
/** The output writer. */
private LineBreaker out;
@@ -104,9 +107,6 @@
/** An image source file. */
private String graphicsFileName;
- /** hasTitle. */
- private boolean hasTitle;
-
/** authorDate. */
private boolean authorDateFlag;
@@ -128,22 +128,10 @@
/** tableHasGrid. */
private boolean tableHasGrid;
- // books have chapters and no headers
- private boolean isBook;
+ private boolean hasTitle;
private boolean skip;
- private boolean outputBookHead;
-
- // -----------------------------------------------------------------------
-
- public DocBookSink( Writer out, boolean isBook )
- {
- this( out );
- this.isBook = isBook;
- this.outputBookHead = true;
- }
-
/**
* @param writer the default writer.
*/
@@ -159,7 +147,6 @@
}
/**
- *
* @param text The text to escape.
* @param xmlMode xmlMode.
* @return The escaped text.
@@ -214,7 +201,7 @@
/**
* Sets the xml mode.
- *
+ *
* @param mode the mode to set.
*/
public void setXMLMode( boolean mode )
@@ -224,7 +211,7 @@
/**
* Returns the current xmlMode.
- *
+ *
* @return the current xmlMode.
*/
public boolean isXMLMode()
@@ -234,7 +221,7 @@
/**
* Sets the encoding.
- *
+ *
* @param enc the encoding to set.
*/
public void setEncoding( String enc )
@@ -244,7 +231,7 @@
/**
* Returns the current encoding.
- *
+ *
* @return the current encoding.
*/
public String getEncoding()
@@ -254,7 +241,7 @@
/**
* Sets the styleSheet.
- *
+ *
* @param sheet the styleSheet to set.
*/
public void setStyleSheet( String sheet )
@@ -264,7 +251,7 @@
/**
* Returns the current styleSheet.
- *
+ *
* @return the current styleSheet.
*/
public String getStyleSheet()
@@ -274,7 +261,7 @@
/**
* Sets the publicId.
- *
+ *
* @param id the publicId to set.
*/
public void setPublicId( String id )
@@ -284,7 +271,7 @@
/**
* Returns the current publicId.
- *
+ *
* @return the current publicId.
*/
public String getPublicId()
@@ -294,7 +281,7 @@
/**
* Sets the systemId.
- *
+ *
* @param id the systemId to set.
*/
public void setSystemId( String id )
@@ -304,7 +291,7 @@
/**
* Returns the current systemId.
- *
+ *
* @return the current systemId.
*/
public String getSystemId()
@@ -314,7 +301,7 @@
/**
* Sets the language.
- *
+ *
* @param language the language to set.
*/
public void setLanguage( String language )
@@ -324,7 +311,7 @@
/**
* Returns the current language.
- *
+ *
* @return the current language.
*/
public String getLanguage()
@@ -334,7 +321,7 @@
/**
* Sets the current italicBeginTag and constructs the corresponding end tag from it.
- *
+ *
* @param tag the tag to set. If tag is null, the empty string is used.
*/
public void setItalicElement( String tag )
@@ -349,7 +336,7 @@
/**
* Constructs the corresponding end tag from the given begin tag.
- *
+ *
* @param beginTag the begin tag to set. If null, the empty string is returned.
* @return the corresponding end tag.
*/
@@ -377,7 +364,7 @@
/**
* Returns the current italicBeginTag.
- *
+ *
* @return the current italicBeginTag. Defaults to "".
*/
public String getItalicElement()
@@ -387,7 +374,7 @@
/**
* Sets the current boldBeginTag and constructs the corresponding end tag from it.
- *
+ *
* @param tag the tag to set. If tag is null, the empty string is used.
*/
public void setBoldElement( String tag )
@@ -402,7 +389,7 @@
/**
* Returns the current boldBeginTag.
- *
+ *
* @return the current boldBeginTag. Defaults to "".
*/
public String getBoldElement()
@@ -412,7 +399,7 @@
/**
* Sets the current monospacedBeginTag and constructs the corresponding end tag from it.
- *
+ *
* @param tag the tag to set. If tag is null, the empty string is used.
*/
public void setMonospacedElement( String tag )
@@ -427,7 +414,7 @@
/**
* Returns the current monospacedBeginTag.
- *
+ *
* @return the current monospacedBeginTag. Defaults to ">".
*/
public String getMonospacedElement()
@@ -437,7 +424,7 @@
/**
* Sets the current horizontalRuleElement.
- *
+ *
* @param element the element to set.
*/
public void setHorizontalRuleElement( String element )
@@ -447,7 +434,7 @@
/**
* Returns the current horizontalRuleElement.
- *
+ *
* @return the current horizontalRuleElement. Defaults to "".
*/
public String getHorizontalRuleElement()
@@ -457,7 +444,7 @@
/**
* Sets the current pageBreakElement.
- *
+ *
* @param element the element to set.
*/
public void setPageBreakElement( String element )
@@ -467,7 +454,7 @@
/**
* Returns the current pageBreakElement.
- *
+ *
* @return the current pageBreakElement. Defaults to "".
*/
public String getPageBreakElement()
@@ -477,7 +464,7 @@
/**
* Sets the current lineBreakElement.
- *
+ *
* @param element the element to set.
*/
public void setLineBreakElement( String element )
@@ -487,7 +474,7 @@
/**
* Returns the current lineBreakElement.
- *
+ *
* @return the current lineBreakElement. Defaults to "".
*/
public String getLineBreakElement()
@@ -498,7 +485,7 @@
/**
* Reset all variables.
*/
- private void resetState()
+ protected void resetState()
{
hasTitle = false;
authorDateFlag = false;
@@ -517,6 +504,7 @@
/**
* {@inheritDoc}
+ *
* @see #DEFAULT_XML_PUBLIC_ID
* @see #DEFAULT_SGML_PUBLIC_ID
* @see #DEFAULT_XML_SYSTEM_ID
@@ -526,8 +514,13 @@
{
resetState();
- skip = isBook && !outputBookHead;
+ MutableAttributeSet att = writeXmlHeader("article");
+ writeStartTag( ARTICLE_TAG, att );
+ }
+
+ protected MutableAttributeSet writeXmlHeader(String root)
+ {
if ( xmlMode )
{
markup( "" + EOL );
+ if ( xmlMode )
+ {
+ sysId = DEFAULT_XML_SYSTEM_ID;
+ }
+ else
+ {
+ sysId = DEFAULT_SGML_SYSTEM_ID;
+ }
}
- else
- {
- markup( EOL + "\"" + sysId + "\">" + EOL );
- }
+ markup( EOL + "\"" + sysId + "\">" + EOL );
MutableAttributeSet att = new SimpleAttributeSet();
if ( lang != null )
{
att.addAttribute( Attribute.LANG, lang );
}
-
- if ( isBook )
- {
- skip = false;
- writeStartTag( CHAPTER_TAG, att );
- }
- else
- {
- writeStartTag( ARTICLE_TAG, att );
- }
+ return att;
}
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ARTICLEINFO_TAG
*/
public void head_()
{
if ( hasTitle )
{
- if ( isBook )
- {
- writeEndTag( BOOKINFO_TAG );
- }
- else
- {
- writeEndTag( ARTICLEINFO_TAG );
- }
-
+ writeEndTag( ARTICLEINFO_TAG );
hasTitle = false;
- skip = false;
- outputBookHead = false;
}
}
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ARTICLEINFO_TAG
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void title()
{
- if ( isBook )
- {
- writeStartTag( BOOKINFO_TAG );
- }
- else
- {
- writeStartTag( ARTICLEINFO_TAG );
- }
-
+ writeStartTag( ARTICLEINFO_TAG );
+ writeStartTag( Tag.TITLE );
hasTitle = true;
- writeStartTag( Tag.TITLE );
}
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void title_()
@@ -654,6 +616,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#CORPAUTHOR_TAG
*/
public void author()
@@ -664,6 +627,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#CORPAUTHOR_TAG
*/
public void author_()
@@ -674,6 +638,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#DATE_TAG
*/
public void date()
@@ -684,6 +649,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#DATE_TAG
*/
public void date_()
@@ -694,44 +660,19 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ARTICLE_TAG
*/
public void body_()
{
- if ( isBook )
- {
- writeEndTag( CHAPTER_TAG );
- }
- else
- {
- writeEndTag( ARTICLE_TAG );
- }
-
+ writeEndTag( ARTICLE_TAG );
out.flush();
resetState();
}
-
- /**
- * {@inheritDoc}
- * @see DocbookMarkup#BOOK_TAG
- */
- public void book()
- {
- writeStartTag( BOOK_TAG );
- }
-
- /**
- * {@inheritDoc}
- * @see DocbookMarkup#BOOK_TAG
- */
- public void book_()
- {
- writeEndTag( BOOK_TAG );
- out.flush();
- }
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section1()
@@ -741,6 +682,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section1_()
@@ -750,6 +692,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section2()
@@ -759,6 +702,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section2_()
@@ -768,6 +712,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section3()
@@ -777,6 +722,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section3_()
@@ -786,6 +732,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section4()
@@ -795,6 +742,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section4_()
@@ -804,6 +752,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section5()
@@ -813,6 +762,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section5_()
@@ -822,6 +772,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void sectionTitle()
@@ -831,6 +782,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void sectionTitle_()
@@ -840,6 +792,107 @@
/**
* {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle1()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle1_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle2()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle2_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle3()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle3_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle4()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle4_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle5()
+ {
+ writeStartTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.swing.text.html.HTML.Tag#TITLE
+ */
+ public void sectionTitle5_()
+ {
+ writeEndTag( Tag.TITLE );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see DocbookMarkup#ITEMIZEDLIST_TAG
*/
public void list()
@@ -849,6 +902,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ITEMIZEDLIST_TAG
*/
public void list_()
@@ -858,6 +912,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void listItem()
@@ -867,6 +922,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void listItem_()
@@ -876,6 +932,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ORDEREDLIST_TAG
* @see DocbookMarkup#NUMERATION_ATTRIBUTE
*/
@@ -909,6 +966,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ORDEREDLIST_TAG
*/
public void numberedList_()
@@ -918,6 +976,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void numberedListItem()
@@ -927,6 +986,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void numberedListItem_()
@@ -936,6 +996,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARIABLELIST_TAG
*/
public void definitionList()
@@ -945,6 +1006,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARIABLELIST_TAG
*/
public void definitionList_()
@@ -954,6 +1016,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARLISTENTRY_TAG
*/
public void definitionListItem()
@@ -963,6 +1026,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARLISTENTRY_TAG
*/
public void definitionListItem_()
@@ -972,6 +1036,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TERM_TAG
*/
public void definedTerm()
@@ -981,6 +1046,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TERM_TAG
*/
public void definedTerm_()
@@ -990,6 +1056,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void definition()
@@ -999,6 +1066,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void definition_()
@@ -1008,6 +1076,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PARA_TAG
*/
public void paragraph()
@@ -1017,6 +1086,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PARA_TAG
*/
public void paragraph_()
@@ -1026,6 +1096,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PROGRAMLISTING_TAG
*/
public void verbatim( boolean boxed )
@@ -1036,6 +1107,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PROGRAMLISTING_TAG
*/
public void verbatim_()
@@ -1112,6 +1184,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#FIGURE_TAG
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
@@ -1123,6 +1196,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#FIGURE_TAG
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
@@ -1141,6 +1215,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#INFORMALTABLE_TAG
* @see DocbookMarkup#FRAME_ATTRIBUTE
* @see DocbookMarkup#ROWSEP_ATTRIBUTE
@@ -1154,7 +1229,7 @@
tableHasCaption = false;
// Formal table+title already written to original destination ---
- out.write( tableRows, /*preserveSpace*/ true );
+ out.write( tableRows, /* preserveSpace */true );
writeEndTag( Tag.TABLE );
}
else
@@ -1175,11 +1250,11 @@
MutableAttributeSet att = new SimpleAttributeSet();
att.addAttribute( FRAME_ATTRIBUTE, frame );
att.addAttribute( ROWSEP_ATTRIBUTE, String.valueOf( sep ) );
- att.addAttribute( COLSEP_ATTRIBUTE, String.valueOf( sep ) );
+ att.addAttribute( COLSEP_ATTRIBUTE, String.valueOf( sep ) );
writeStartTag( INFORMALTABLE_TAG, att );
- out.write( tableRows, /*preserveSpace*/ true );
+ out.write( tableRows, /* preserveSpace */true );
writeEndTag( INFORMALTABLE_TAG );
}
@@ -1190,6 +1265,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TGROUP_TAG
* @see DocbookMarkup#COLS_ATTRIBUTE
* @see DocbookMarkup#COLSPEC_TAG
@@ -1245,6 +1321,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TGROUP_TAG
* @see DocbookMarkup#TBODY_TAG
*/
@@ -1261,6 +1338,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ROW_TAG
*/
public void tableRow()
@@ -1270,6 +1348,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ROW_TAG
*/
public void tableRow_()
@@ -1279,6 +1358,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ENTRY_TAG
*/
public void tableCell()
@@ -1288,6 +1368,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ENTRY_TAG
*/
public void tableCell_()
@@ -1350,6 +1431,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void tableCaption_()
@@ -1359,6 +1441,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ANCHOR_TAG
*/
public void anchor( String name )
@@ -1383,6 +1466,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ANCHOR_TAG
*/
public void anchor_()
@@ -1398,6 +1482,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ULINK_TAG
* @see DocbookMarkup#URL_ATTRIBUTE
* @see DocbookMarkup#LINK_TAG
@@ -1425,6 +1510,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ULINK_TAG
* @see DocbookMarkup#LINK_TAG
*/
@@ -1493,7 +1579,7 @@
public void nonBreakingSpace()
{
markup( " " );
- //markup( " " );
+ // markup( " " );
}
/** {@inheritDoc} */
@@ -1527,41 +1613,35 @@
/**
* Write text to output, preserving white space.
- *
+ *
* @param text The text to write.
*/
protected void markup( String text )
{
if ( !skip )
- {
- out.write( text, /*preserveSpace*/ true );
- }
+ out.write( text, /* preserveSpace */true );
}
/**
* Write SGML escaped text to output, not preserving white space.
- *
+ *
* @param text The text to write.
*/
protected void content( String text )
{
if ( !skip )
- {
- out.write( escapeSGML( text, xmlMode ), /*preserveSpace*/ false );
- }
+ out.write( escapeSGML( text, xmlMode ), /* preserveSpace */false );
}
/**
* Write SGML escaped text to output, preserving white space.
- *
+ *
* @param text The text to write.
*/
protected void verbatimContent( String text )
{
if ( !skip )
- {
- out.write( escapeSGML( text, xmlMode ), /*preserveSpace*/ true );
- }
+ out.write( escapeSGML( text, xmlMode ), /* preserveSpace */true );
}
// -----------------------------------------------------------------------
@@ -1583,4 +1663,12 @@
{
markup( text );
}
+
+ /**
+ * @param skip the skip to set
+ */
+ public void setSkip( boolean skip )
+ {
+ this.skip = skip;
+ }
}
Index: doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookBookSinkTest.java
===================================================================
--- doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookBookSinkTest.java (revision 593752)
+++ doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookBookSinkTest.java (working copy)
@@ -1,40 +0,0 @@
-package org.apache.maven.doxia.module.docbook;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.apache.maven.doxia.parser.Parser;
-import org.apache.maven.doxia.sink.AbstractSinkTestCase;
-import org.apache.maven.doxia.sink.Sink;
-
-/**
- * Test the book path of the DockBook sink
- * @author eredmond
- */
-public class DocBookBookSinkTest extends AbstractSinkTestCase
-{
- protected String outputExtension()
- {
- return "docbook";
- }
-
- protected Parser createParser()
- {
- return new DocBookParser();
- }
-
- protected Sink createSink() throws Exception
- {
- return new DocBookSink( getTestWriter(), true );
- }
-
- protected Reader getTestReader() throws Exception
- {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( "book.xml" );
-
- InputStreamReader reader = new InputStreamReader( is );
-
- return reader;
- }
-}
Index: doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java
===================================================================
--- doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java (revision 593752)
+++ doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java (working copy)
@@ -19,15 +19,11 @@
* under the License.
*/
+import java.io.Writer;
+
import org.apache.maven.doxia.sink.AbstractSinkTest;
import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.doxia.parser.Parser;
-import java.io.Reader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Writer;
-
/**
* @author Jason van Zyl
* @version $Id$
@@ -67,7 +63,7 @@
/** {@inheritDoc} */
protected String getHeadBlock()
{
- return "";
+ return "";
}
/** {@inheritDoc} */
@@ -85,31 +81,31 @@
/** {@inheritDoc} */
protected String getSection1Block( String title )
{
- return "";
+ return "";
}
/** {@inheritDoc} */
protected String getSection2Block( String title )
{
- return "";
+ return "";
}
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return "";
+ return "";
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return "";
+ return "";
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return "";
+ return "";
}
/** {@inheritDoc} */
Index: pom.xml
===================================================================
--- pom.xml (revision 593752)
+++ pom.xml (working copy)
@@ -21,12 +21,12 @@
4.0.0
-
+
org.apache.maven.doxia
doxia
1.0-beta-1-SNAPSHOT
@@ -245,4 +245,14 @@
scp://people.apache.org/www/maven.apache.org/doxia/doxia
+
+
+
+ apache-snapshots
+
+ http://people.apache.org/maven-snapshot-repository
+
+
+
+