You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2007/11/13 23:34:32 UTC
svn commit: r594680 - in /maven/doxia/doxia/trunk: doxia-book/
doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/
doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/
doxia-book/src/test/java/org/apache/m...
Author: ltheussl
Date: Tue Nov 13 14:34:31 2007
New Revision: 594680
URL: http://svn.apache.org/viewvc?rev=594680&view=rev
Log:
[DOXIA-160] Book output in doc-book format is not well formed. Moved book docbook type from docbook module into doxia-book.
Submitted by: Dave Syer
Added:
maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/
maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (with props)
maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/
maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/
maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (with props)
maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/
maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/
maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml (with props)
Removed:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookBookSinkTest.java
Modified:
maven/doxia/doxia/trunk/doxia-book/pom.xml
maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java
maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java
Modified: maven/doxia/doxia/trunk/doxia-book/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/pom.xml?rev=594680&r1=594679&r2=594680&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/pom.xml (original)
+++ maven/doxia/doxia/trunk/doxia-book/pom.xml Tue Nov 13 14:34:31 2007
@@ -92,6 +92,14 @@
<artifactId>plexus-cli</artifactId>
<version>1.0</version>
</dependency>
+
+ <!-- test -->
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-core</artifactId>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Modified: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java?rev=594680&r1=594679&r2=594680&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java (original)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java Tue Nov 13 14:34:31 2007
@@ -33,20 +33,23 @@
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 <code>BookRenderer</code> 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 +61,8 @@
// ----------------------------------------------------------------------
/** {@inheritDoc} */
- public void renderBook( BookContext context ) throws BookDoxiaException
+ public void renderBook( BookContext context )
+ throws BookDoxiaException
{
BookModel book = context.getBook();
@@ -66,8 +70,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 +94,51 @@
// TODO: Write out TOC?
- DocBookSink sink = new DocBookSink( fileWriter, true );
+ DocBookBookSink sink = new DocBookBookSink( fileWriter );
+
+ sink.book();
+
+ // TODO: symmetrize bookHead?
+
+ 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_();
Added: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java?rev=594680&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (added)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java Tue Nov 13 14:34:31 2007
@@ -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$
+ */
+public class DocBookBookSink
+ extends DocBookSink
+{
+ /** Indicates if we're inside a head. */
+ 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();
+ }
+
+ /** 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 );
+ }
+}
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java?rev=594680&r1=594679&r2=594680&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java Tue Nov 13 14:34:31 2007
@@ -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,23 @@
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" ) );
+
+ assertCorrectDocbook();
+ }
+
+ /**
+ * Regression test for the docbook output.
+ */
+ private void assertCorrectDocbook()
+ throws Exception
+ {
+ String expected =
+ FileUtils.fileRead( getTestFile( "src/test/resources/expected/doc-book/plexus-user-guide.xml" ) );
+
+ String actual =
+ FileUtils.fileRead( getTestFile( "target/test-output/doc-book/plexus-user-guide.xml" ) );
+
+ assertEquals( "Wrong docbook output!",
+ StringUtils.replace( expected, "\r", "" ), StringUtils.replace( actual, "\r", "" ) );
}
}
Added: maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java?rev=594680&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (added)
+++ maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java Tue Nov 13 14:34:31 2007
@@ -0,0 +1,41 @@
+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 Dave Syer
+ */
+public class DocBookBookSinkTest extends AbstractSinkTestCase
+{
+ protected String outputExtension()
+ {
+ return "docbook";
+ }
+
+ protected Parser createParser()
+ {
+ return new DocBookParser();
+ }
+
+ protected Sink createSink() throws Exception
+ {
+ return new DocBookBookSink( getTestWriter() );
+ }
+
+ protected Reader getTestReader() throws Exception
+ {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( "book-1.xml" );
+
+ InputStreamReader reader = new InputStreamReader( is );
+
+ return reader;
+ }
+}
Propchange: maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml?rev=594680&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml (added)
+++ maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml Tue Nov 13 14:34:31 2007
@@ -0,0 +1,125 @@
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+<book><bookinfo><title>Test Book</title>
+</bookinfo>
+<chapter><title>Chapter 1</title>
+<section><title>Subsection 1</title>
+<para>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.</para>
+<section><title>Subsubsection 1</title>
+<para>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.</para>
+</section>
+</section>
+<section><title>Subsection 2</title>
+<para>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.</para>
+</section>
+<section><title>Subsection 3</title>
+<para>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.</para>
+</section>
+<section><title>Subsection 4</title>
+<para>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.</para>
+</section>
+<section><title>Subsection 5</title>
+<para>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.</para>
+</section>
+<section><title>Section 1.10.32 of "de Finibus Bonorum et Malorum",
+written by Cicero in 45 BC</title>
+<para>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?</para>
+</section>
+</chapter>
+<chapter><title>Chapter 2</title>
+<section><title>1914 translation by H. Rackham</title>
+<para>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?</para>
+</section>
+<section><title>Section 1.10.33 of "de Finibus Bonorum et Malorum",
+written by Cicero in 45 BC</title>
+<para>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.</para>
+</section>
+</chapter>
+</book>
Propchange: maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-book/src/test/resources/expected/doc-book/plexus-user-guide.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java?rev=594680&r1=594679&r2=594680&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java Tue Nov 13 14:34:31 2007
@@ -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,6 +28,12 @@
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 <code>Docbook</code> model.
*
@@ -44,14 +44,17 @@
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;
@@ -128,22 +131,8 @@
/** tableHasGrid. */
private boolean tableHasGrid;
- // books have chapters and no headers
- private boolean isBook;
-
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 +148,6 @@
}
/**
- *
* @param text The text to escape.
* @param xmlMode xmlMode.
* @return The escaped text.
@@ -498,7 +486,7 @@
/**
* Reset all variables.
*/
- private void resetState()
+ protected void resetState()
{
hasTitle = false;
authorDateFlag = false;
@@ -517,6 +505,7 @@
/**
* {@inheritDoc}
+ *
* @see #DEFAULT_XML_PUBLIC_ID
* @see #DEFAULT_SGML_PUBLIC_ID
* @see #DEFAULT_XML_SYSTEM_ID
@@ -526,16 +515,23 @@
{
resetState();
- skip = isBook && !outputBookHead;
+ MutableAttributeSet att = writeXmlHeader( "article" );
+ writeStartTag( ARTICLE_TAG, att );
+ }
+
+ protected MutableAttributeSet writeXmlHeader( String root )
+ {
if ( xmlMode )
{
markup( "<?xml version=\"1.0\"" );
+
if ( encoding != null )
{
markup( " encoding=\"" + encoding + "\"" );
}
- markup( " ?>\n" );
+
+ markup( " ?>" + EOL );
if ( styleSheet != null )
{
@@ -544,15 +540,8 @@
}
String pubId;
- if ( isBook )
- {
- markup( "<!DOCTYPE book PUBLIC" );
- }
- else
- {
- markup( "<!DOCTYPE article PUBLIC" );
- }
-
+ markup( "<!DOCTYPE " + root + " PUBLIC" );
+
if ( publicId == null )
{
if ( xmlMode )
@@ -570,81 +559,57 @@
}
markup( " \"" + pubId + "\"" );
String sysId = systemId;
- if ( sysId == null && xmlMode )
- {
- sysId = DEFAULT_XML_SYSTEM_ID;
- }
if ( sysId == null )
{
- markup( ">" + EOL );
- }
- else
- {
- markup( EOL + "\"" + sysId + "\">" + EOL );
+ if ( xmlMode )
+ {
+ sysId = DEFAULT_XML_SYSTEM_ID;
+ }
+ else
+ {
+ sysId = DEFAULT_SGML_SYSTEM_ID;
+ }
}
+ 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 );
- }
-
- hasTitle = true;
+ writeStartTag( ARTICLEINFO_TAG );
writeStartTag( Tag.TITLE );
+ hasTitle = true;
}
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void title_()
@@ -654,6 +619,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#CORPAUTHOR_TAG
*/
public void author()
@@ -664,6 +630,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#CORPAUTHOR_TAG
*/
public void author_()
@@ -674,6 +641,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#DATE_TAG
*/
public void date()
@@ -684,6 +652,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#DATE_TAG
*/
public void date_()
@@ -694,44 +663,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 +685,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section1_()
@@ -750,6 +695,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section2()
@@ -759,6 +705,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section2_()
@@ -768,6 +715,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section3()
@@ -777,6 +725,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section3_()
@@ -786,6 +735,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section4()
@@ -795,6 +745,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section4_()
@@ -804,6 +755,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section5()
@@ -813,6 +765,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#SECTION_TAG
*/
public void section5_()
@@ -822,6 +775,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void sectionTitle()
@@ -831,6 +785,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void sectionTitle_()
@@ -840,6 +795,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 +905,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ITEMIZEDLIST_TAG
*/
public void list_()
@@ -858,6 +915,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void listItem()
@@ -867,6 +925,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void listItem_()
@@ -876,6 +935,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ORDEREDLIST_TAG
* @see DocbookMarkup#NUMERATION_ATTRIBUTE
*/
@@ -909,6 +969,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ORDEREDLIST_TAG
*/
public void numberedList_()
@@ -918,6 +979,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void numberedListItem()
@@ -927,6 +989,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void numberedListItem_()
@@ -936,6 +999,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARIABLELIST_TAG
*/
public void definitionList()
@@ -945,6 +1009,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARIABLELIST_TAG
*/
public void definitionList_()
@@ -954,6 +1019,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARLISTENTRY_TAG
*/
public void definitionListItem()
@@ -963,6 +1029,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#VARLISTENTRY_TAG
*/
public void definitionListItem_()
@@ -972,6 +1039,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TERM_TAG
*/
public void definedTerm()
@@ -981,6 +1049,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TERM_TAG
*/
public void definedTerm_()
@@ -990,6 +1059,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void definition()
@@ -999,6 +1069,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#LISTITEM_TAG
*/
public void definition_()
@@ -1008,6 +1079,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PARA_TAG
*/
public void paragraph()
@@ -1017,6 +1089,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PARA_TAG
*/
public void paragraph_()
@@ -1026,6 +1099,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PROGRAMLISTING_TAG
*/
public void verbatim( boolean boxed )
@@ -1036,6 +1110,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#PROGRAMLISTING_TAG
*/
public void verbatim_()
@@ -1112,6 +1187,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#FIGURE_TAG
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
@@ -1123,6 +1199,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#FIGURE_TAG
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
@@ -1141,6 +1218,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#INFORMALTABLE_TAG
* @see DocbookMarkup#FRAME_ATTRIBUTE
* @see DocbookMarkup#ROWSEP_ATTRIBUTE
@@ -1175,7 +1253,7 @@
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 );
@@ -1190,6 +1268,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TGROUP_TAG
* @see DocbookMarkup#COLS_ATTRIBUTE
* @see DocbookMarkup#COLSPEC_TAG
@@ -1245,6 +1324,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#TGROUP_TAG
* @see DocbookMarkup#TBODY_TAG
*/
@@ -1261,6 +1341,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ROW_TAG
*/
public void tableRow()
@@ -1270,6 +1351,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ROW_TAG
*/
public void tableRow_()
@@ -1279,6 +1361,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ENTRY_TAG
*/
public void tableCell()
@@ -1288,6 +1371,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ENTRY_TAG
*/
public void tableCell_()
@@ -1350,6 +1434,7 @@
/**
* {@inheritDoc}
+ *
* @see javax.swing.text.html.HTML.Tag#TITLE
*/
public void tableCaption_()
@@ -1359,6 +1444,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ANCHOR_TAG
*/
public void anchor( String name )
@@ -1383,6 +1469,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ANCHOR_TAG
*/
public void anchor_()
@@ -1398,6 +1485,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ULINK_TAG
* @see DocbookMarkup#URL_ATTRIBUTE
* @see DocbookMarkup#LINK_TAG
@@ -1425,6 +1513,7 @@
/**
* {@inheritDoc}
+ *
* @see DocbookMarkup#ULINK_TAG
* @see DocbookMarkup#LINK_TAG
*/
@@ -1582,5 +1671,13 @@
protected void write( String text )
{
markup( text );
+ }
+
+ /**
+ * @param skip the skip to set.
+ */
+ public void setSkip( boolean skip )
+ {
+ this.skip = skip;
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java?rev=594680&r1=594679&r2=594680&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/test/java/org/apache/maven/doxia/module/docbook/DocBookSinkTest.java Tue Nov 13 14:34:31 2007
@@ -19,14 +19,10 @@
* 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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -67,7 +63,8 @@
/** {@inheritDoc} */
protected String getHeadBlock()
{
- return "<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\"><article>";
+ return "<!DOCTYPE article PUBLIC \"" + DocBookSink.DEFAULT_SGML_PUBLIC_ID + "\""
+ + EOL + "\"" + DocBookSink.DEFAULT_SGML_SYSTEM_ID + "\"><article>";
}
/** {@inheritDoc} */
@@ -85,31 +82,31 @@
/** {@inheritDoc} */
protected String getSection1Block( String title )
{
- return "<section>" + title + "</section>";
+ return "<section><title>" + title + "</title></section>";
}
/** {@inheritDoc} */
protected String getSection2Block( String title )
{
- return "<section>" + title + "</section>";
+ return "<section><title>" + title + "</title></section>";
}
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return "<section>" + title + "</section>";
+ return "<section><title>" + title + "</title></section>";
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return "<section>" + title + "</section>";
+ return "<section><title>" + title + "</title></section>";
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return "<section>" + title + "</section>";
+ return "<section><title>" + title + "</title></section>";
}
/** {@inheritDoc} */