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 2008/02/22 14:33:40 UTC
svn commit: r630198 [1/2] - in /maven/doxia/doxia/trunk:
doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/
doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/
doxia-core/src/main/java/org/apache...
Author: ltheussl
Date: Fri Feb 22 05:33:30 2008
New Revision: 630198
URL: http://svn.apache.org/viewvc?rev=630198&view=rev
Log:
[DOXIA-222] XhtmlBaseParser swallows significant whitespace.
Re-organized the abstract sink test, EOLs are not filtered out
anymore, sink tests are now supposed to test the occurence of EOLs.
That's ugly and inconvenient but avoids any surprises when sinks
use some special writers for pretty-printing (like LineBreaker).
Submitted by: Benjamin Bentmann
Added:
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java (with props)
Modified:
maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java
maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/AbstractXmlSink.java
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.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
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-latex/src/test/java/org/apache/maven/doxia/module/latex/LatexSinkTest.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
Modified: 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=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSink.java Fri Feb 22 05:33:30 2008
@@ -128,6 +128,7 @@
public void book_()
{
writeEndTag( BOOK_TAG );
+ writeEOL();
flush();
}
@@ -147,6 +148,7 @@
if ( hasHead )
{
writeEndTag( BOOKINFO_TAG );
+ writeEOL();
hasHead = false;
}
}
@@ -200,6 +202,7 @@
public void chapter_()
{
writeEndTag( CHAPTER_TAG );
+ writeEOL();
}
/** Emit the chapter title start tag. */
@@ -212,5 +215,6 @@
public void chapterTitle_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
}
Modified: 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=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-book/src/test/java/org/apache/maven/doxia/book/services/renderer/docbook/DocBookBookSinkTest.java Fri Feb 22 05:33:30 2008
@@ -43,8 +43,8 @@
sink.bookTitle_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getBookTitleBlock( title ) );
+ String actual = getSinkContent();
+ String expected = getBookTitleBlock( title );
assertEquals( "Wrong book title!", expected, actual );
}
@@ -65,8 +65,8 @@
sink.bookAuthor_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getBookAuthorBlock( author ) );
+ String actual = getSinkContent();
+ String expected = getBookAuthorBlock( author );
assertEquals( "Wrong book author!", expected, actual );
}
@@ -86,8 +86,8 @@
sink.bookDate_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getBookDateBlock( date ) );
+ String actual = getSinkContent();
+ String expected = getBookDateBlock( date );
assertEquals( "Wrong book date!", expected, actual );
}
@@ -105,8 +105,8 @@
sink.bookHead_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getBookHeadBlock() );
+ String actual = getSinkContent();
+ String expected = getBookHeadBlock();
assertEquals( "Wrong book head!", expected, actual );
}
@@ -124,8 +124,8 @@
sink.book_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getBookBlock() );
+ String actual = getSinkContent();
+ String expected = getBookBlock();
assertEquals( "Wrong book body!", expected, actual );
}
@@ -147,8 +147,8 @@
sink.chapterTitle_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getChapterTitleBlock( title ) );
+ String actual = getSinkContent();
+ String expected = getChapterTitleBlock( title );
assertEquals( "Wrong chapterTitle!", expected, actual );
}
@@ -167,8 +167,8 @@
sink.chapter_();
sink.flush();
- String actual = noNewLine( getSinkContent() );
- String expected = noNewLine( getChapterBlock() );
+ String actual = getSinkContent();
+ String expected = getChapterBlock();
assertEquals( "Wrong chapter block!", expected, actual );
}
@@ -181,7 +181,7 @@
*/
protected String getBookTitleBlock( String title )
{
- return "<bookinfo><title>" + title + "</title>";
+ return "<bookinfo><title>" + title + "</title>" + EOL;
}
/**
@@ -192,7 +192,7 @@
*/
protected String getBookAuthorBlock( String author )
{
- return "<bookinfo><corpauthor>" + author + "</corpauthor>";
+ return "<bookinfo><corpauthor>" + author + "</corpauthor>" + EOL;
}
/**
@@ -203,7 +203,7 @@
*/
protected String getBookDateBlock( String date )
{
- return "<bookinfo><date>" + date + "</date>";
+ return "<bookinfo><date>" + date + "</date>" + EOL;
}
/**
@@ -223,8 +223,8 @@
*/
protected String getBookBlock()
{
- return "<?xml version=\"1.0\" ?><!DOCTYPE book PUBLIC \"" + DocBookBookSink.DEFAULT_XML_PUBLIC_ID
- + "\"\"" + DocBookBookSink.DEFAULT_XML_SYSTEM_ID + "\"><book></book>";
+ return "<?xml version=\"1.0\" ?>" + EOL + "<!DOCTYPE book PUBLIC \"" + DocBookBookSink.DEFAULT_XML_PUBLIC_ID
+ + "\"" + EOL + "\"" + DocBookBookSink.DEFAULT_XML_SYSTEM_ID + "\">" + EOL + "<book></book>" + EOL;
}
/**
@@ -235,7 +235,7 @@
*/
protected String getChapterTitleBlock( String title )
{
- return "<title>" + title + "</title>";
+ return "<title>" + title + "</title>" + EOL;
}
/**
@@ -246,7 +246,7 @@
*/
protected String getChapterBlock()
{
- return "<chapter></chapter>";
+ return "<chapter></chapter>" + EOL;
}
@@ -270,7 +270,7 @@
/** {@inheritDoc} */
protected String getDateBlock( String date )
{
- return "<date>" + date + "</date>";
+ return "<date>" + date + "</date>" + EOL;
}
/** {@inheritDoc} */
@@ -288,97 +288,99 @@
/** {@inheritDoc} */
protected String getSectionTitleBlock( String title )
{
- return "<title>" + title + "</title>";
+ return "<title>" + title + "</title>" + EOL;
}
/** {@inheritDoc} */
protected String getSection1Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection2Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getListBlock( String item )
{
- return "<itemizedlist><listitem>" + item + "</listitem></itemizedlist>";
+ return "<itemizedlist><listitem>" + item + "</listitem>" + EOL + "</itemizedlist>" + EOL;
}
/** {@inheritDoc} */
protected String getNumberedListBlock( String item )
{
return "<orderedlist numeration=\"lowerroman\"><listitem>"
- + item + "</listitem></orderedlist>";
+ + item + "</listitem>" + EOL + "</orderedlist>" + EOL;
}
/** {@inheritDoc} */
protected String getDefinitionListBlock( String definum, String definition )
{
return "<variablelist><varlistentry><term>" + definum
- + "</term><listitem>" + definition
- + "</listitem></varlistentry></variablelist>";
+ + "</term>" + EOL + "<listitem>" + definition
+ + "</listitem>" + EOL + "</varlistentry>" + EOL + "</variablelist>" + EOL;
}
/** {@inheritDoc} */
protected String getFigureBlock( String source, String caption )
{
// TODO: fix source
- return "<figure><title>" + caption + "</title><mediaobject><imageobject><imagedata fileref=\"figure.jpeg\" format=\"JPEG\" /></imageobject></mediaobject></figure>";
+ return "<figure><title>" + caption
+ + "</title><mediaobject><imageobject><imagedata fileref=\"figure.jpg.jpeg\" format=\"JPEG\" /></imageobject></mediaobject>"
+ + EOL + "</figure>" + EOL;
}
/** {@inheritDoc} */
protected String getTableBlock( String cell, String caption )
{
return "<table frame=\"none\" rowsep=\"0\" colsep=\"0\"><title>" + caption
- + "</title><tgroup cols=\"1\"><colspec align=\"center\" /><tbody><row><entry>"
- + cell + "</entry></row></tbody></tgroup></table>";
+ + "</title>" + EOL + "<tgroup cols=\"1\"><colspec align=\"center\" /><tbody><row><entry>"
+ + cell + "</entry>" + EOL + "</row>" + EOL + "</tbody></tgroup>" + EOL + "</table>" + EOL;
}
/** {@inheritDoc} */
protected String getParagraphBlock( String text )
{
- return "<para>" + text + "</para>";
+ return "<para>" + text + "</para>" + EOL;
}
/** {@inheritDoc} */
protected String getVerbatimBlock( String text )
{
- return "<programlisting>" + text + "</programlisting>";
+ return "<programlisting>" + text + "</programlisting>" + EOL;
}
/** {@inheritDoc} */
protected String getHorizontalRuleBlock()
{
- return "<!-- HR -->";
+ return "<!-- HR -->" + EOL;
}
/** {@inheritDoc} */
protected String getPageBreakBlock()
{
- return "<!-- PB -->";
+ return "<!-- PB -->" + EOL;
}
/** {@inheritDoc} */
@@ -416,7 +418,7 @@
/** {@inheritDoc} */
protected String getLineBreakBlock()
{
- return "<!-- LB -->";
+ return "<!-- LB -->" + EOL;
}
/** {@inheritDoc} */
@@ -429,7 +431,7 @@
protected String getTextBlock( String text )
{
// TODO: retreive those from the sink
- return "~, =, -, +, *, [, ], <, >, {, }, \\";
+ return "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\";
}
/** {@inheritDoc} */
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java Fri Feb 22 05:33:30 2008
@@ -573,14 +573,26 @@
{
String text = parser.getText();
- if ( StringUtils.isNotEmpty( text.trim() ) )
+ /*
+ * NOTE: Don't do any whitespace trimming here. Whitespace normalization has already been performed by the
+ * parser so any whitespace that makes it here is significant.
+ */
+ if ( StringUtils.isNotEmpty( text ) )
{
- // emit separate text events for different lines
- String[] lines = StringUtils.split( text, EOL );
+ // Emit separate text events for different lines, e.g. the input
+ // "\nLine1\n\nLine2\n\n" should deliver the event sequence "\n", "Line1\n", "\n", "Line2\n", "\n".
+ // In other words, the concatenation of the text events must deliver the input sequence.
+ // (according to section 2.11 of the XML spec, parsers must normalize line breaks to "\n")
+ String[] lines = text.split( "\n", -1 );
- for ( int i = 0; i < lines.length; i++ )
+ for ( int i = 0; i < lines.length - 1; i++ )
{
- sink.text( lines[i] );
+ sink.text( lines[i] + EOL );
+ }
+
+ if ( lines[lines.length - 1].length() > 0 )
+ {
+ sink.text( lines[lines.length - 1] );
}
}
}
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/AbstractXmlSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/AbstractXmlSink.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/AbstractXmlSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/AbstractXmlSink.java Fri Feb 22 05:33:30 2008
@@ -157,34 +157,23 @@
sb.append( GREATER_THAN );
- if ( isSimpleTag )
- {
- sb.append( EOL );
- }
-
write( sb.toString() );
}
/**
- * Ends a Tag followed by an EOL. For instance:
- * <pre></tag>
- * </pre>
- *
- * @param t a tag
+ * Writes a system EOL.
*/
- protected void writeEndTag( Tag t )
+ protected void writeEOL()
{
- writeEndTagWithoutEOL( t );
write( EOL );
}
/**
- * Ends a Tag without an EOL. For instance:
- * <pre></tag></pre>
+ * Ends a Tag without writing an EOL. For instance: <pre></tag></pre>.
*
- * @param t a tag
+ * @param t a tag.
*/
- protected void writeEndTagWithoutEOL( Tag t )
+ protected void writeEndTag( Tag t )
{
StringBuffer sb = new StringBuffer();
sb.append( LESS_THAN );
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java Fri Feb 22 05:33:30 2008
@@ -916,7 +916,7 @@
{
if ( !headFlag )
{
- writeEndTagWithoutEOL( Tag.A );
+ writeEndTag( Tag.A );
}
}
@@ -999,7 +999,7 @@
{
if ( !headFlag )
{
- writeEndTagWithoutEOL( Tag.A );
+ writeEndTag( Tag.A );
}
}
@@ -1023,7 +1023,7 @@
{
if ( !headFlag )
{
- writeEndTagWithoutEOL( Tag.I );
+ writeEndTag( Tag.I );
}
}
@@ -1047,7 +1047,7 @@
{
if ( !headFlag )
{
- writeEndTagWithoutEOL( Tag.B );
+ writeEndTag( Tag.B );
}
}
@@ -1071,7 +1071,7 @@
{
if ( !headFlag )
{
- writeEndTagWithoutEOL( Tag.TT );
+ writeEndTag( Tag.TT );
}
}
Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java Fri Feb 22 05:33:30 2008
@@ -1,18 +1,22 @@
package org.apache.maven.doxia.parser;
/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * under the License.
+ * 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.util.Iterator;
@@ -25,7 +29,11 @@
import org.codehaus.plexus.util.xml.pull.MXParser;
/**
+ * Test for XhtmlBaseParser.
*
+ * @author ltheussl
+ * @version $Id$
+ * @since 1.0-beta-1
*/
public class XhtmlBaseParserTest
extends PlexusTestCase
@@ -154,8 +162,11 @@
assertEquals( "bold", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
- // FIXME: DOXIA-222
- //assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
+
+ SinkEventElement el = (SinkEventElement) it.next();
+ assertEquals( "text", el.getName() );
+ assertEquals( " ", (String) el.getArgs()[0] );
+
assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
@@ -175,8 +186,11 @@
assertEquals( "bold", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "bold_", ( (SinkEventElement) it.next() ).getName() );
- // FIXME: DOXIA-222
- //assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
+
+ el = (SinkEventElement) it.next();
+ assertEquals( "text", el.getName() );
+ assertEquals( EOL, (String) el.getArgs()[0] );
+
assertEquals( "italic", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
@@ -197,7 +211,7 @@
assertEquals( "text", ( (SinkEventElement) it.next() ).getName() );
assertEquals( "italic_", ( (SinkEventElement) it.next() ).getName() );
- SinkEventElement el = (SinkEventElement) it.next();
+ el = (SinkEventElement) it.next();
assertEquals( "text", el.getName() );
assertEquals( ".", (String) el.getArgs()[0] );
Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java Fri Feb 22 05:33:30 2008
@@ -75,7 +75,6 @@
* Checks that the sequence <code>[title(), text( title ), title_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getTitleBlock getTitleBlock}( title ).
- * NewLines are ignored.
*/
public void testTitle()
{
@@ -85,8 +84,8 @@
sink.title_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getTitleBlock( title ) );
+ String actual = writer.toString();
+ String expected = getTitleBlock( title );
assertEquals( "Wrong title!", expected, actual );
}
@@ -95,18 +94,17 @@
* Checks that the sequence <code>[author(), text( author ), author_()]
* </code>, invoked on the current sink, produces the same result as
* {@link #getAuthorBlock getAuthorBlock}( author ).
- * NewLines are ignored.
*/
public void testAuthor()
{
- String author = "Georg Trakl";
+ String author = "Georg_Trakl";
sink.author();
sink.text( author );
sink.author_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getAuthorBlock( author ) );
+ String actual = writer.toString();
+ String expected = getAuthorBlock( author );
assertEquals( "Wrong author!", expected, actual );
}
@@ -114,7 +112,7 @@
/**
* Checks that the sequence <code>[date(), text( date ), date_()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getDateBlock getDateBlock}( date ). NewLines are ignored.
+ * {@link #getDateBlock getDateBlock}( date ).
*/
public void testDate()
{
@@ -124,8 +122,8 @@
sink.date_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getDateBlock( date ) );
+ String actual = writer.toString();
+ String expected = getDateBlock( date );
assertEquals( "Wrong date!", expected, actual );
}
@@ -133,7 +131,7 @@
/**
* Checks that the sequence <code>[head(), head_()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getHeadBlock getHeadBlock()}. NewLines are ignored.
+ * {@link #getHeadBlock getHeadBlock()}.
*/
public void testHead()
{
@@ -141,8 +139,8 @@
sink.head_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getHeadBlock() );
+ String actual = writer.toString();
+ String expected = getHeadBlock();
assertEquals( "Wrong head!", expected, actual );
}
@@ -150,7 +148,7 @@
/**
* Checks that the sequence <code>[body(), body_()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getBodyBlock getBodyBlock()}. NewLines are ignored.
+ * {@link #getBodyBlock getBodyBlock()}.
*/
public void testBody()
{
@@ -158,8 +156,8 @@
sink.body_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getBodyBlock() );
+ String actual = writer.toString();
+ String expected = getBodyBlock();
assertEquals( "Wrong body!", expected, actual );
}
@@ -169,7 +167,6 @@
* sectionTitle_()]</code>, invoked on the current sink, produces
* the same result as
* {@link #getSectionTitleBlock getSectionTitleBlock}( title ).
- * NewLines are ignored.
*/
public void testSectionTitle()
{
@@ -179,8 +176,8 @@
sink.sectionTitle_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSectionTitleBlock( title ) );
+ String actual = writer.toString();
+ String expected = getSectionTitleBlock( title );
assertEquals( "Wrong sectionTitle!", expected, actual );
}
@@ -190,7 +187,6 @@
* text( title ), sectionTitle1_(), section1_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getSection1Block getSection1Block}( title ).
- * NewLines are ignored.
*/
public void testSection1()
{
@@ -202,8 +198,8 @@
sink.section1_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSection1Block( title ) );
+ String actual = writer.toString();
+ String expected = getSection1Block( title );
assertEquals( "Wrong section1 block!", expected, actual );
}
@@ -213,7 +209,6 @@
* text( title ), sectionTitle2_(), section2_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getSection2Block getSection2Block}( title ).
- * NewLines are ignored.
*/
public void testSection2()
{
@@ -225,8 +220,8 @@
sink.section2_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSection2Block( title ) );
+ String actual = writer.toString();
+ String expected = getSection2Block( title );
assertEquals( "Wrong section2 block!", expected, actual );
}
@@ -236,7 +231,6 @@
* text( title ), sectionTitle3_(), section3_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getSection3Block getSection3Block}( title ).
- * NewLines are ignored.
*/
public void testSection3()
{
@@ -248,8 +242,8 @@
sink.section3_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSection3Block( title ) );
+ String actual = writer.toString();
+ String expected = getSection3Block( title );
assertEquals( "Wrong section3 block!", expected, actual );
}
@@ -259,7 +253,7 @@
* text( title ), sectionTitle4_(), section4_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getSection4Block getSection4Block}( title ).
- * NewLines are ignored.
+ *
*/
public void testSection4()
{
@@ -271,8 +265,8 @@
sink.section4_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSection4Block( title ) );
+ String actual = writer.toString();
+ String expected = getSection4Block( title );
assertEquals( "Wrong section4 block!", expected, actual );
}
@@ -282,7 +276,6 @@
* text( title ), sectionTitle5_(), section5_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getSection5Block getSection5Block}( title ).
- * NewLines are ignored.
*/
public void testSection5()
{
@@ -294,8 +287,8 @@
sink.section5_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getSection5Block( title ) );
+ String actual = writer.toString();
+ String expected = getSection5Block( title );
assertEquals( "Wrong section5 block!", expected, actual );
}
@@ -304,11 +297,11 @@
* Checks that the sequence <code>[list(), listItem(), text( item ),
* listItem_(), list_()]</code>, invoked on the current sink, produces
* the same result as {@link #getListBlock getListBlock}( item ).
- * NewLines are ignored.
+ *
*/
public void testList()
{
- String item = "list item";
+ String item = "list_item";
sink.list();
sink.listItem();
sink.text( item );
@@ -316,8 +309,8 @@
sink.list_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getListBlock( item ) );
+ String actual = writer.toString();
+ String expected = getListBlock( item );
assertEquals( "Wrong list!", expected, actual );
}
@@ -328,11 +321,10 @@
* text( item ), numberedListItem_(), numberedList_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getNumberedListBlock getNumberedListBlock}( item ).
- * NewLines are ignored.
*/
public void testNumberedList()
{
- String item = "numbered list item";
+ String item = "numbered_list_item";
sink.numberedList( Sink.NUMBERING_LOWER_ROMAN );
sink.numberedListItem();
sink.text( item );
@@ -340,8 +332,8 @@
sink.numberedList_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getNumberedListBlock( item ) );
+ String actual = writer.toString();
+ String expected = getNumberedListBlock( item );
assertEquals( "Wrong numbered list!", expected, actual );
}
@@ -352,7 +344,7 @@
* text( definition ), definition_(), definitionListItem_(),
* definitionList_()]</code>, invoked on the current sink, produces the same
* result as {@link #getDefinitionListBlock getDefinitionListBlock}
- * ( definum, definition ). NewLines are ignored.
+ * ( definum, definition ).
*/
public void testDefinitionList()
{
@@ -370,8 +362,8 @@
sink.definitionList_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getDefinitionListBlock( definum, definition ) );
+ String actual = writer.toString();
+ String expected = getDefinitionListBlock( definum, definition );
assertEquals( "Wrong definition list!", expected, actual );
}
@@ -381,12 +373,11 @@
* figureCaption(), text( caption ), figureCaption_(), figure_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getFigureBlock getFigureBlock}( source, caption ).
- * NewLines are ignored.
*/
public void testFigure()
{
- String source = "figure";
- String caption = "Figure caption";
+ String source = "figure.jpg";
+ String caption = "Figure_caption";
sink.figure();
sink.figureGraphics( source );
sink.figureCaption();
@@ -395,8 +386,8 @@
sink.figure_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getFigureBlock( source, caption ) );
+ String actual = writer.toString();
+ String expected = getFigureBlock( source, caption );
assertEquals( "Wrong figure!", expected, actual );
}
@@ -408,12 +399,11 @@
* text( caption ), tableCaption_(), table_()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getTableBlock getTableBlock}( cell, caption ).
- * NewLines are ignored.
*/
public void testTable()
{
String cell = "cell";
- String caption = "Table caption";
+ String caption = "Table_caption";
int[] justify = { Parser.JUSTIFY_CENTER };
sink.table();
sink.tableRows( justify, false );
@@ -429,8 +419,8 @@
sink.table_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getTableBlock( cell, caption ) );
+ String actual = writer.toString();
+ String expected = getTableBlock( cell, caption );
assertEquals( "Wrong table!", expected, actual );
}
@@ -439,7 +429,6 @@
* Checks that the sequence <code>[paragraph(), text( text ),
* paragraph_()]</code>, invoked on the current sink, produces
* the same result as {@link #getParagraphBlock getParagraphBlock}( text ).
- * NewLines are ignored.
*/
public void testParagraph()
{
@@ -449,8 +438,8 @@
sink.paragraph_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getParagraphBlock( text ) );
+ String actual = writer.toString();
+ String expected = getParagraphBlock( text );
assertEquals( "Wrong paragraph!", expected, actual );
}
@@ -459,7 +448,6 @@
* Checks that the sequence <code>[verbatim( true ), text( text ),
* verbatim_()]</code>, invoked on the current sink, produces the
* same result as {@link #getVerbatimBlock getVerbatimBlock}( text ).
- * NewLines are ignored.
*/
public void testVerbatim()
{
@@ -469,8 +457,8 @@
sink.verbatim_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getVerbatimBlock( text ) );
+ String actual = writer.toString();
+ String expected = getVerbatimBlock( text );
assertEquals( "Wrong verbatim!", expected, actual );
}
@@ -479,15 +467,14 @@
* Checks that the sequence <code>[horizontalRule()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getHorizontalRuleBlock getHorizontalRuleBlock()}.
- * NewLines are ignored.
*/
public void testHorizontalRule()
{
sink.horizontalRule();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getHorizontalRuleBlock() );
+ String actual = writer.toString();
+ String expected = getHorizontalRuleBlock();
assertEquals( "Wrong horizontal rule!", expected, actual );
}
@@ -495,15 +482,15 @@
/**
* Checks that the sequence <code>[pageBreak()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getPageBreakBlock getPageBreakBlock()}. NewLines are ignored.
+ * {@link #getPageBreakBlock getPageBreakBlock()}.
*/
public void testPageBreak()
{
sink.pageBreak();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getPageBreakBlock() );
+ String actual = writer.toString();
+ String expected = getPageBreakBlock();
assertEquals( "Wrong pageBreak!", expected, actual );
}
@@ -512,7 +499,6 @@
* Checks that the sequence <code>[anchor( anchor ), text( anchor ),
* anchor_()]</code>, invoked on the current sink, produces the same
* result as {@link #getAnchorBlock getAnchorBlock}( anchor ).
- * NewLines are ignored.
*/
public void testAnchor()
{
@@ -522,8 +508,8 @@
sink.anchor_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getAnchorBlock( anchor ) );
+ String actual = writer.toString();
+ String expected = getAnchorBlock( anchor );
assertEquals( "Wrong anchor!", expected, actual );
}
@@ -532,7 +518,6 @@
* Checks that the sequence <code>[link( link ), text( text ),
* link_()]</code>, invoked on the current sink, produces the same
* result as {@link #getLinkBlock getLinkBlock}( link, text ).
- * NewLines are ignored.
*/
public void testLink()
{
@@ -543,8 +528,8 @@
sink.link_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getLinkBlock( link, text ) );
+ String actual = writer.toString();
+ String expected = getLinkBlock( link, text );
assertEquals( "Wrong link!", expected, actual );
}
@@ -552,7 +537,7 @@
/**
* Checks that the sequence <code>[italic(), text( text ), italic_()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getItalicBlock getItalicBlock}( text ). NewLines are ignored.
+ * {@link #getItalicBlock getItalicBlock}( text ).
*/
public void testItalic()
{
@@ -562,8 +547,8 @@
sink.italic_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getItalicBlock( text ) );
+ String actual = writer.toString();
+ String expected = getItalicBlock( text );
assertEquals( "Wrong italic!", expected, actual );
}
@@ -571,7 +556,7 @@
/**
* Checks that the sequence <code>[bold(), text( text ), bold_()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getBoldBlock getBoldBlock}( text ). NewLines are ignored.
+ * {@link #getBoldBlock getBoldBlock}( text ).
*/
public void testBold()
{
@@ -581,8 +566,8 @@
sink.bold_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getBoldBlock( text ) );
+ String actual = writer.toString();
+ String expected = getBoldBlock( text );
assertEquals( "Wrong bold!", expected, actual );
}
@@ -591,7 +576,6 @@
* Checks that the sequence <code>[monospaced(), text( text ),
* monospaced_()]</code>, invoked on the current sink, produces the same
* result as {@link #getMonospacedBlock getMonospacedBlock}( text ).
- * NewLines are ignored.
*/
public void testMonospaced()
{
@@ -601,8 +585,8 @@
sink.monospaced_();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getMonospacedBlock( text ) );
+ String actual = writer.toString();
+ String expected = getMonospacedBlock( text );
assertEquals( "Wrong monospaced!", expected, actual );
}
@@ -610,15 +594,15 @@
/**
* Checks that the sequence <code>[lineBreak()]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getLineBreakBlock getLineBreakBlock()}. NewLines are ignored.
+ * {@link #getLineBreakBlock getLineBreakBlock()}.
*/
public void testLineBreak()
{
sink.lineBreak();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getLineBreakBlock() );
+ String actual = writer.toString();
+ String expected = getLineBreakBlock();
assertEquals( "Wrong lineBreak!", expected, actual );
}
@@ -627,15 +611,14 @@
* Checks that the sequence <code>[nonBreakingSpace()]</code>,
* invoked on the current sink, produces the same result as
* {@link #getNonBreakingSpaceBlock getNonBreakingSpaceBlock()}.
- * NewLines are ignored.
*/
public void testNonBreakingSpace()
{
sink.nonBreakingSpace();
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getNonBreakingSpaceBlock() );
+ String actual = writer.toString();
+ String expected = getNonBreakingSpaceBlock();
assertEquals( "Wrong nonBreakingSpace!", expected, actual );
}
@@ -643,16 +626,16 @@
/**
* Checks that the sequence <code>[text( text )]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getTextBlock getTextBlock()}. NewLines are ignored.
+ * {@link #getTextBlock getTextBlock()}.
*/
public void testText()
{
- String text = "~, =, -, +, *, [, ], <, >, {, }, \\";
+ String text = "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\";
sink.text( text );
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getTextBlock( text ) );
+ String actual = writer.toString();
+ String expected = getTextBlock( text );
assertEquals( "Wrong text!", expected, actual );
}
@@ -660,16 +643,16 @@
/**
* Checks that the sequence <code>[rawText( text )]</code>,
* invoked on the current sink, produces the same result as
- * {@link #getRawTextBlock getRawTextBlock}( text ). NewLines are ignored.
+ * {@link #getRawTextBlock getRawTextBlock}( text ).
*/
public void testRawText()
{
- String text = "~, =, -, +, *, [, ], <, >, {, }, \\";
+ String text = "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\";
sink.rawText( text );
sink.flush();
- String actual = noNewLine( writer.toString() );
- String expected = noNewLine( getRawTextBlock( text ) );
+ String actual = writer.toString();
+ String expected = getRawTextBlock( text );
assertEquals( "Wrong rawText!", expected, actual );
}
@@ -678,12 +661,6 @@
// ----------------------------------------------------------------------
// Utility methods
// ----------------------------------------------------------------------
-
- protected String noNewLine( String text )
- {
- String EOL = System.getProperty( "line.separator" );
- return text.replaceAll( EOL, "" );
- }
/**
* Returns the sink that is currently being tested.
Added: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java?rev=630198&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java (added)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java Fri Feb 22 05:33:30 2008
@@ -0,0 +1,74 @@
+package org.apache.maven.doxia.sink;
+
+/*
+ * 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.StringWriter;
+import java.io.Writer;
+
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * Test for XhtmlBaseSink.
+ *
+ * @author ltheussl
+ * @version $Id$
+ * @since 1.0-beta-1
+ */
+public class XhtmlBaseSinkTest
+ extends PlexusTestCase
+{
+
+ private String EOL = System.getProperty( "line.separator" );;
+
+ /** @throws Exception */
+ public void testSpaceAfterClosingTag()
+ throws Exception
+ {
+ // DOXIA-189
+ XhtmlBaseSink sink = null;
+
+ try
+ {
+ Writer writer = new StringWriter();
+
+ sink = new XhtmlBaseSink( writer );
+
+ sink.paragraph();
+ sink.text( "There should be no space before the " );
+ sink.italic();
+ sink.text( "period" );
+ sink.italic_();
+ sink.text( "." );
+ sink.paragraph_();
+
+ String actual = writer.toString();
+ String expected = "<p>There should be no space before the <i>period</i>.</p>";
+
+ assertEquals( expected, actual );
+ }
+ finally
+ {
+ sink.close();
+ }
+
+ }
+
+
+}
Propchange: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/XhtmlBaseSinkTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptSinkTest.java Fri Feb 22 05:33:30 2008
@@ -66,8 +66,8 @@
/** {@inheritDoc} */
protected String getHeadBlock()
{
- return AptMarkup.HEADER_START_MARKUP + AptMarkup.HEADER_START_MARKUP + AptMarkup.HEADER_START_MARKUP
- + AptMarkup.HEADER_START_MARKUP;
+ return AptMarkup.HEADER_START_MARKUP + EOL + AptMarkup.HEADER_START_MARKUP + EOL + AptMarkup.HEADER_START_MARKUP
+ + EOL+ AptMarkup.HEADER_START_MARKUP + EOL;
}
/** {@inheritDoc} */
@@ -85,94 +85,95 @@
/** {@inheritDoc} */
protected String getSection1Block( String title )
{
- return title;
+ return EOL + title + EOL + EOL + EOL;
}
/** {@inheritDoc} */
protected String getSection2Block( String title )
{
- return AptMarkup.SECTION_TITLE_START_MARKUP + title;
+ return EOL + AptMarkup.SECTION_TITLE_START_MARKUP + title + EOL + EOL + EOL;
}
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 2 ) + title;
+ return EOL + StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 2 ) + title + EOL + EOL + EOL;
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 3 ) + title;
+ return EOL + StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 3 ) + title + EOL + EOL + EOL;
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 4 ) + title;
+ return EOL + StringUtils.repeat( String.valueOf( AptMarkup.SECTION_TITLE_START_MARKUP ), 4 ) + title + EOL + EOL + EOL;
}
/** {@inheritDoc} */
protected String getListBlock( String item )
{
- return Markup.SPACE + "" + AptMarkup.LIST_START_MARKUP + "" + Markup.SPACE + item
- + Markup.SPACE + "" + AptMarkup.LIST_END_MARKUP;
+ return EOL + EOL + Markup.SPACE + "" + AptMarkup.LIST_START_MARKUP + "" + Markup.SPACE + item + EOL + EOL
+ + Markup.SPACE + "" + AptMarkup.LIST_END_MARKUP + EOL;
}
/** {@inheritDoc} */
protected String getNumberedListBlock( String item )
{
- return Markup.SPACE + "" + Markup.LEFT_SQUARE_BRACKET + ""
+ return EOL + EOL + Markup.SPACE + "" + Markup.LEFT_SQUARE_BRACKET + ""
+ Markup.LEFT_SQUARE_BRACKET + AptMarkup.NUMBERING_LOWER_ROMAN_CHAR + ""
+ Markup.RIGHT_SQUARE_BRACKET + "" + Markup.RIGHT_SQUARE_BRACKET
- + Markup.SPACE + item + Markup.SPACE + "" + AptMarkup.LIST_END_MARKUP;
+ + Markup.SPACE + item + EOL + EOL + Markup.SPACE + "" + AptMarkup.LIST_END_MARKUP + EOL;
}
/** {@inheritDoc} */
protected String getDefinitionListBlock( String definum, String definition )
{
- return Markup.SPACE + "" + Markup.LEFT_SQUARE_BRACKET + definum
- + Markup.RIGHT_SQUARE_BRACKET + "" + Markup.SPACE + definition
- + Markup.SPACE + "" + Markup.LEFT_SQUARE_BRACKET + "" + Markup.RIGHT_SQUARE_BRACKET;
+ return EOL + EOL + Markup.SPACE + "" + Markup.LEFT_SQUARE_BRACKET + definum
+ + Markup.RIGHT_SQUARE_BRACKET + "" + Markup.SPACE + definition + EOL + EOL
+ + Markup.SPACE + "" + AptMarkup.LIST_END_MARKUP + EOL;
}
/** {@inheritDoc} */
protected String getFigureBlock( String source, String caption )
{
- return Markup.LEFT_SQUARE_BRACKET + source + Markup.RIGHT_SQUARE_BRACKET
- + Markup.SPACE + caption;
+ return EOL + Markup.LEFT_SQUARE_BRACKET + source + Markup.RIGHT_SQUARE_BRACKET
+ + Markup.SPACE + caption + EOL;
}
/** {@inheritDoc} */
protected String getTableBlock( String cell, String caption )
{
- return AptMarkup.TABLE_ROW_START_MARKUP + AptMarkup.TABLE_COL_CENTERED_ALIGNED_MARKUP + cell
- + AptMarkup.TABLE_ROW_SEPARATOR_MARKUP + AptMarkup.TABLE_ROW_START_MARKUP + AptMarkup.TABLE_COL_CENTERED_ALIGNED_MARKUP + caption;
+ return EOL + AptMarkup.TABLE_ROW_START_MARKUP + AptMarkup.TABLE_COL_CENTERED_ALIGNED_MARKUP + EOL + cell
+ + AptMarkup.TABLE_ROW_SEPARATOR_MARKUP + EOL + AptMarkup.TABLE_ROW_START_MARKUP
+ + AptMarkup.TABLE_COL_CENTERED_ALIGNED_MARKUP + EOL + caption + EOL;
}
/** {@inheritDoc} */
protected String getParagraphBlock( String text )
{
- return Markup.SPACE + text;
+ return EOL + Markup.SPACE + text + EOL + EOL;
}
/** {@inheritDoc} */
protected String getVerbatimBlock( String text )
{
- return Markup.EOL + AptMarkup.BOXED_VERBATIM_START_MARKUP + Markup.EOL + text + Markup.EOL
- + AptMarkup.BOXED_VERBATIM_START_MARKUP + Markup.EOL;
+ return EOL + EOL + AptMarkup.BOXED_VERBATIM_START_MARKUP + EOL + text + EOL
+ + AptMarkup.BOXED_VERBATIM_START_MARKUP + EOL;
}
/** {@inheritDoc} */
protected String getHorizontalRuleBlock()
{
- return AptMarkup.HORIZONTAL_RULE_MARKUP;
+ return EOL + AptMarkup.HORIZONTAL_RULE_MARKUP + EOL;
}
/** {@inheritDoc} */
protected String getPageBreakBlock()
{
- return AptMarkup.PAGE_BREAK_MARKUP;
+ return EOL + AptMarkup.PAGE_BREAK_MARKUP + EOL;
}
/** {@inheritDoc} */
@@ -208,7 +209,7 @@
/** {@inheritDoc} */
protected String getLineBreakBlock()
{
- return String.valueOf( AptMarkup.BACKSLASH );
+ return String.valueOf( AptMarkup.BACKSLASH ) + EOL;
}
/** {@inheritDoc} */
@@ -222,17 +223,17 @@
{
// "\\~, \\=, \\-, \\+, \\*, \\[, \\], \\<, \\>, \\{, \\}, \\\\"
StringBuffer sb = new StringBuffer();
- sb.append( getSpecialCharacters( AptMarkup.COMMENT ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.EQUAL ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.MINUS ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.PLUS ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.STAR ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.LEFT_SQUARE_BRACKET ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.RIGHT_SQUARE_BRACKET ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.LESS_THAN ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.GREATER_THAN ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.LEFT_CURLY_BRACKET ) ).append( ", " );
- sb.append( getSpecialCharacters( Markup.RIGHT_CURLY_BRACKET ) ).append( ", " );
+ sb.append( getSpecialCharacters( AptMarkup.COMMENT ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.EQUAL ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.MINUS ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.PLUS ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.STAR ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.LEFT_SQUARE_BRACKET ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.RIGHT_SQUARE_BRACKET ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.LESS_THAN ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.GREATER_THAN ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.LEFT_CURLY_BRACKET ) ).append( ",_" );
+ sb.append( getSpecialCharacters( Markup.RIGHT_CURLY_BRACKET ) ).append( ",_" );
sb.append( getSpecialCharacters( AptMarkup.BACKSLASH ) );
return sb.toString();
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=630198&r1=630197&r2=630198&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 Fri Feb 22 05:33:30 2008
@@ -590,6 +590,7 @@
if ( hasTitle )
{
writeEndTag( ARTICLEINFO_TAG );
+ writeEOL();
hasTitle = false;
}
}
@@ -615,6 +616,7 @@
public void title_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -636,6 +638,7 @@
public void author_()
{
writeEndTag( CORPAUTHOR_TAG );
+ writeEOL();
authorDateFlag = false;
}
@@ -658,6 +661,7 @@
public void date_()
{
writeEndTag( DATE_TAG );
+ writeEOL();
authorDateFlag = false;
}
@@ -669,6 +673,7 @@
public void body_()
{
writeEndTag( ARTICLE_TAG );
+ writeEOL();
out.flush();
resetState();
}
@@ -691,6 +696,7 @@
public void section1_()
{
writeEndTag( SECTION_TAG );
+ writeEOL();
}
/**
@@ -711,6 +717,7 @@
public void section2_()
{
writeEndTag( SECTION_TAG );
+ writeEOL();
}
/**
@@ -731,6 +738,7 @@
public void section3_()
{
writeEndTag( SECTION_TAG );
+ writeEOL();
}
/**
@@ -751,6 +759,7 @@
public void section4_()
{
writeEndTag( SECTION_TAG );
+ writeEOL();
}
/**
@@ -771,6 +780,7 @@
public void section5_()
{
writeEndTag( SECTION_TAG );
+ writeEOL();
}
/**
@@ -791,6 +801,7 @@
public void sectionTitle_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -811,6 +822,7 @@
public void sectionTitle1_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -831,6 +843,7 @@
public void sectionTitle2_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -851,6 +864,7 @@
public void sectionTitle3_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -871,6 +885,7 @@
public void sectionTitle4_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -891,6 +906,7 @@
public void sectionTitle5_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -911,6 +927,7 @@
public void list_()
{
writeEndTag( ITEMIZEDLIST_TAG );
+ writeEOL();
}
/**
@@ -931,6 +948,7 @@
public void listItem_()
{
writeEndTag( LISTITEM_TAG );
+ writeEOL();
}
/**
@@ -975,6 +993,7 @@
public void numberedList_()
{
writeEndTag( ORDEREDLIST_TAG );
+ writeEOL();
}
/**
@@ -995,6 +1014,7 @@
public void numberedListItem_()
{
writeEndTag( LISTITEM_TAG );
+ writeEOL();
}
/**
@@ -1015,6 +1035,7 @@
public void definitionList_()
{
writeEndTag( VARIABLELIST_TAG );
+ writeEOL();
}
/**
@@ -1035,6 +1056,7 @@
public void definitionListItem_()
{
writeEndTag( VARLISTENTRY_TAG );
+ writeEOL();
}
/**
@@ -1055,6 +1077,7 @@
public void definedTerm_()
{
writeEndTag( TERM_TAG );
+ writeEOL();
}
/**
@@ -1075,6 +1098,7 @@
public void definition_()
{
writeEndTag( LISTITEM_TAG );
+ writeEOL();
}
/**
@@ -1095,6 +1119,7 @@
public void paragraph_()
{
writeEndTag( PARA_TAG );
+ writeEOL();
}
/**
@@ -1116,6 +1141,7 @@
public void verbatim_()
{
writeEndTag( PROGRAMLISTING_TAG );
+ writeEOL();
verbatimFlag = false;
}
@@ -1174,6 +1200,7 @@
writeEndTag( IMAGEOBJECT_TAG );
writeEndTag( MEDIAOBJECT_TAG );
+ writeEOL();
graphicsFileName = null;
}
}
@@ -1208,6 +1235,7 @@
writeEndTag( Tag.TITLE );
graphicElement();
writeEndTag( FIGURE_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -1234,6 +1262,7 @@
out.write( tableRows, /*preserveSpace*/ true );
writeEndTag( Tag.TABLE );
+ writeEOL();
}
else
{
@@ -1260,6 +1289,7 @@
out.write( tableRows, /*preserveSpace*/ true );
writeEndTag( INFORMALTABLE_TAG );
+ writeEOL();
}
tableRows = null;
@@ -1316,6 +1346,7 @@
{
writeStartTag( COLSPEC_TAG, att );
writeEndTag( COLSPEC_TAG );
+ writeEOL();
}
}
@@ -1332,6 +1363,7 @@
{
writeEndTag( TBODY_TAG );
writeEndTag( TGROUP_TAG );
+ writeEOL();
// Remember diverted output and restore original destination ---
out.flush();
@@ -1357,6 +1389,7 @@
public void tableRow_()
{
writeEndTag( ROW_TAG );
+ writeEOL();
}
/**
@@ -1377,6 +1410,7 @@
public void tableCell_()
{
writeEndTag( ENTRY_TAG );
+ writeEOL();
}
/**
@@ -1395,6 +1429,7 @@
public void tableHeaderCell_()
{
writeEndTag( ENTRY_TAG );
+ writeEOL();
}
/**
@@ -1440,6 +1475,7 @@
public void tableCaption_()
{
writeEndTag( Tag.TITLE );
+ writeEOL();
}
/**
@@ -1478,7 +1514,7 @@
{
if ( !xmlMode )
{
- writeEndTagWithoutEOL( ANCHOR_TAG );
+ writeEndTag( ANCHOR_TAG );
}
}
}
@@ -1521,12 +1557,12 @@
{
if ( externalLinkFlag )
{
- writeEndTagWithoutEOL( ULINK_TAG );
+ writeEndTag( ULINK_TAG );
externalLinkFlag = false;
}
else
{
- writeEndTagWithoutEOL( LINK_TAG );
+ writeEndTag( LINK_TAG );
}
}
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=630198&r1=630197&r2=630198&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 Fri Feb 22 05:33:30 2008
@@ -45,128 +45,130 @@
/** {@inheritDoc} */
protected String getTitleBlock( String title )
{
- return "<articleinfo><title>" + title + "</title>";
+ return "<articleinfo><title>" + title + "</title>" + EOL;
}
/** {@inheritDoc} */
protected String getAuthorBlock( String author )
{
- return "<corpauthor>" + author + "</corpauthor>";
+ return "<corpauthor>" + author + "</corpauthor>" + EOL;
}
/** {@inheritDoc} */
protected String getDateBlock( String date )
{
- return "<date>" + date + "</date>";
+ return "<date>" + date + "</date>" + EOL;
}
/** {@inheritDoc} */
protected String getHeadBlock()
{
return "<!DOCTYPE article PUBLIC \"" + DocBookSink.DEFAULT_SGML_PUBLIC_ID + "\""
- + EOL + "\"" + DocBookSink.DEFAULT_SGML_SYSTEM_ID + "\"><article>";
+ + EOL + "\"" + DocBookSink.DEFAULT_SGML_SYSTEM_ID + "\">" + EOL + "<article>";
}
/** {@inheritDoc} */
protected String getBodyBlock()
{
- return "</article>";
+ return "</article>" + EOL;
}
/** {@inheritDoc} */
protected String getSectionTitleBlock( String title )
{
- return "<title>" + title + "</title>";
+ return "<title>" + title + "</title>" + EOL;
}
/** {@inheritDoc} */
protected String getSection1Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection2Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection3Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection4Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getSection5Block( String title )
{
- return "<section><title>" + title + "</title></section>";
+ return "<section><title>" + title + "</title>" + EOL + "</section>" + EOL;
}
/** {@inheritDoc} */
protected String getListBlock( String item )
{
- return "<itemizedlist><listitem>" + item + "</listitem></itemizedlist>";
+ return "<itemizedlist><listitem>" + item + "</listitem>" + EOL + "</itemizedlist>" + EOL;
}
/** {@inheritDoc} */
protected String getNumberedListBlock( String item )
{
return "<orderedlist numeration=\"lowerroman\"><listitem>"
- + item + "</listitem></orderedlist>";
+ + item + "</listitem>" + EOL + "</orderedlist>" + EOL;
}
/** {@inheritDoc} */
protected String getDefinitionListBlock( String definum, String definition )
{
return "<variablelist><varlistentry><term>" + definum
- + "</term><listitem>" + definition
- + "</listitem></varlistentry></variablelist>";
+ + "</term>" + EOL + "<listitem>" + definition
+ + "</listitem>" + EOL + "</varlistentry>" + EOL + "</variablelist>" + EOL;
}
/** {@inheritDoc} */
protected String getFigureBlock( String source, String caption )
{
// TODO: fix source
- return "<figure><title>" + caption + "</title><mediaobject><imageobject><imagedata fileref=\"figure.jpeg\" format=\"JPEG\"></imagedata></imageobject></mediaobject></figure>";
+ return "<figure><title>" + caption
+ + "</title><mediaobject><imageobject><imagedata fileref=\"figure.jpg.jpeg\" format=\"JPEG\"></imagedata></imageobject></mediaobject>"
+ + EOL + "</figure>" + EOL;
}
/** {@inheritDoc} */
protected String getTableBlock( String cell, String caption )
{
return "<table frame=\"none\" rowsep=\"0\" colsep=\"0\"><title>" + caption
- + "</title><tgroup cols=\"1\"><colspec align=\"center\"></colspec><tbody><row><entry>"
- + cell + "</entry></row></tbody></tgroup></table>";
+ + "</title>" + EOL + "<tgroup cols=\"1\"><colspec align=\"center\"></colspec>" + EOL + "<tbody><row><entry>"
+ + cell + "</entry>" + EOL + "</row>" + EOL + "</tbody></tgroup>" + EOL + "</table>" + EOL;
}
/** {@inheritDoc} */
protected String getParagraphBlock( String text )
{
- return "<para>" + text + "</para>";
+ return "<para>" + text + "</para>" + EOL;
}
/** {@inheritDoc} */
protected String getVerbatimBlock( String text )
{
- return "<programlisting>" + text + "</programlisting>";
+ return "<programlisting>" + text + "</programlisting>" + EOL;
}
/** {@inheritDoc} */
protected String getHorizontalRuleBlock()
{
- return "<!-- HR -->";
+ return "<!-- HR -->" + EOL;
}
/** {@inheritDoc} */
protected String getPageBreakBlock()
{
- return "<!-- PB -->";
+ return "<!-- PB -->" + EOL;
}
/** {@inheritDoc} */
@@ -204,7 +206,7 @@
/** {@inheritDoc} */
protected String getLineBreakBlock()
{
- return "<!-- LB -->";
+ return "<!-- LB -->" + EOL;
}
/** {@inheritDoc} */
@@ -217,7 +219,7 @@
protected String getTextBlock( String text )
{
// TODO: retreive those from the sink
- return "~, =, -, +, *, [, ], <, >, {, }, \\";
+ return "~,_=,_-,_+,_*,_[,_],_<,_>,_{,_},_\\";
}
/** {@inheritDoc} */
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java Fri Feb 22 05:33:30 2008
@@ -76,7 +76,7 @@
public void head_()
{
ignoreText = false;
- newline();
+ writeEOL();
}
/** {@inheritDoc} */
@@ -138,7 +138,7 @@
/** {@inheritDoc} */
public void body_()
{
- newline();
+ writeEOL();
writeEndTag( BLOCK_TAG );
writeEndTag( FLOW_TAG );
writeEndTag( PAGE_SEQUENCE_TAG );
@@ -453,7 +453,7 @@
{
if ( !ignoreText )
{
- super.newline();
+ writeEOL();
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=630198&r1=630197&r2=630198&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java Fri Feb 22 05:33:30 2008
@@ -101,7 +101,7 @@
/** {@inheritDoc} */
public void head_()
{
- newline();
+ writeEOL();
}
/** {@inheritDoc} */
@@ -114,6 +114,7 @@
public void title_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -126,6 +127,7 @@
public void author_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -138,6 +140,7 @@
public void date_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -149,9 +152,11 @@
/** {@inheritDoc} */
public void body_()
{
- newline();
+ writeEOL();
writeEndTag( FLOW_TAG );
+ writeEOL();
writeEndTag( PAGE_SEQUENCE_TAG );
+ writeEOL();
endDocument();
}
@@ -300,7 +305,7 @@
/** Starts a section/subsection. */
private void onSection()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "body.text" );
}
@@ -315,7 +320,7 @@
title.append( getChapterString() );
- newline();
+ writeEOL();
if ( depth == Sink.SECTION_LEVEL_1 )
{
writeStartTag( BLOCK_TAG, "body.h1" );
@@ -350,12 +355,14 @@
private void onSectionTitle_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** Ends a section/subsection. */
private void onSection_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/**
@@ -385,7 +392,7 @@
/** {@inheritDoc} */
public void list()
{
- newline();
+ writeEOL();
writeStartTag( LIST_BLOCK_TAG, "list" );
}
@@ -393,6 +400,7 @@
public void list_()
{
writeEndTag( LIST_BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -409,15 +417,18 @@
public void listItem_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
writeEndTag( LIST_ITEM_BODY_TAG );
+ writeEOL();
writeEndTag( LIST_ITEM_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
public void numberedList( int numbering )
{
listStack.push( new NumberedListItem( numbering ) );
- newline();
+ writeEOL();
writeStartTag( LIST_BLOCK_TAG, "list" );
}
@@ -426,6 +437,7 @@
{
listStack.pop();
writeEndTag( LIST_BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -440,7 +452,9 @@
writeStartTag( BLOCK_TAG, "" );
write( current.getListItemSymbol() );
writeEndTag( BLOCK_TAG );
+ writeEOL();
writeEndTag( LIST_ITEM_LABEL_TAG );
+ writeEOL();
writeStartTag( LIST_ITEM_BODY_TAG, "list.item" );
writeStartTag( BLOCK_TAG, "" );
@@ -450,14 +464,17 @@
public void numberedListItem_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
writeEndTag( LIST_ITEM_BODY_TAG );
+ writeEOL();
writeEndTag( LIST_ITEM_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
public void definitionList()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "dl" );
}
@@ -465,6 +482,7 @@
public void definitionList_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -489,12 +507,13 @@
public void definedTerm_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
public void definition()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "dd" );
}
@@ -502,12 +521,13 @@
public void definition_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
public void figure()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "figure.display" );
write( "<fo:external-graphic"
+ config.getAttributeString( "figure.graphics" ) );
@@ -517,6 +537,7 @@
public void figure_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -535,6 +556,7 @@
public void figureCaption_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -547,6 +569,7 @@
public void paragraph_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -568,15 +591,17 @@
{
this.verbatim = false;
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
public void horizontalRule()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "" );
writeEmptyTag( LEADER_TAG, "body.rule" );
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -584,13 +609,13 @@
{
//writeln( "<fo:block break-before=\"page\"/>" );
writeEmptyTag( BLOCK_TAG, "break-before", "page" );
- newline();
+ writeEOL();
}
/** {@inheritDoc} */
public void table()
{
- newline();
+ writeEOL();
writeStartTag( BLOCK_TAG, "table.padding" );
// <fo:table-and-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
@@ -603,11 +628,13 @@
public void table_()
{
writeEndTag( TABLE_TAG );
+ writeEOL();
// <fo:table-and-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
//writeEndTag( TABLE_AND_CAPTION_TAG );
writeEndTag( BLOCK_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -640,6 +667,7 @@
this.cellJustif = null;
this.isCellJustif = false;
writeEndTag( TABLE_BODY_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -654,6 +682,7 @@
public void tableRow_()
{
writeEndTag( TABLE_ROW_TAG );
+ writeEOL();
}
/** {@inheritDoc} */
@@ -730,7 +759,9 @@
public void tableCell_()
{
writeEndTag( BLOCK_TAG );
+ writeEOL();
writeEndTag( TABLE_CELL_TAG );
+ writeEOL();
if ( isCellJustif )
{
@@ -781,7 +812,7 @@
/** {@inheritDoc} */
public void anchor_()
{
- writeEndTagWithoutEOL( INLINE_TAG );
+ writeEndTag( INLINE_TAG );
}
/** {@inheritDoc} */
@@ -816,8 +847,8 @@
/** {@inheritDoc} */
public void link_()
{
- writeEndTagWithoutEOL( INLINE_TAG );
- writeEndTagWithoutEOL( BASIC_LINK_TAG );
+ writeEndTag( INLINE_TAG );
+ writeEndTag( BASIC_LINK_TAG );
}
/** {@inheritDoc} */
@@ -829,7 +860,7 @@
/** {@inheritDoc} */
public void italic_()
{
- writeEndTagWithoutEOL( INLINE_TAG );
+ writeEndTag( INLINE_TAG );
}
/** {@inheritDoc} */
@@ -841,7 +872,7 @@
/** {@inheritDoc} */
public void bold_()
{
- writeEndTagWithoutEOL( INLINE_TAG );
+ writeEndTag( INLINE_TAG );
}
/** {@inheritDoc} */
@@ -853,13 +884,13 @@
/** {@inheritDoc} */
public void monospaced_()
{
- writeEndTagWithoutEOL( INLINE_TAG );
+ writeEndTag( INLINE_TAG );
}
/** {@inheritDoc} */
public void lineBreak()
{
- newline();
+ writeEOL();
writeEmptyTag( BLOCK_TAG, "" );
}
@@ -921,20 +952,24 @@
writeStartTag( SIMPLE_PAGE_MASTER_TAG, "layout.master.set.cover-page" );
writeEmptyTag( REGION_BODY_TAG, "layout.master.set.cover-page.region-body" );
writeEndTag( SIMPLE_PAGE_MASTER_TAG );
+ writeEOL();
writeStartTag( SIMPLE_PAGE_MASTER_TAG, "layout.master.set.toc" );
writeEmptyTag( REGION_BODY_TAG, "layout.master.set.toc.region-body" );
writeEmptyTag( REGION_BEFORE_TAG, "layout.master.set.toc.region-before" );
writeEmptyTag( REGION_AFTER_TAG, "layout.master.set.toc.region-after" );
writeEndTag( SIMPLE_PAGE_MASTER_TAG );
+ writeEOL();
writeStartTag( SIMPLE_PAGE_MASTER_TAG, "layout.master.set.body" );
writeEmptyTag( REGION_BODY_TAG, "layout.master.set.body.region-body" );
writeEmptyTag( REGION_BEFORE_TAG, "layout.master.set.body.region-before" );
writeEmptyTag( REGION_AFTER_TAG, "layout.master.set.body.region-after" );
writeEndTag( SIMPLE_PAGE_MASTER_TAG );
+ writeEOL();
writeEndTag( LAYOUT_MASTER_SET_TAG );
+ writeEOL();
pdfBookmarks();
}
@@ -945,6 +980,8 @@
public void endDocument()
{
writeEndTag( ROOT_TAG );
+ writeEOL();
+
flush();
close();
}
@@ -971,7 +1008,7 @@
*/
protected void writeStartTag( Tag tag, String attributeId )
{
- newline();
+ writeEOL();
writeStartTag( tag, config.getAttributeSet( attributeId ) );
}
@@ -984,7 +1021,7 @@
*/
protected void writeStartTag( Tag tag, String id, String name )
{
- newline();
+ writeEOL();
MutableAttributeSet att = new SimpleAttributeSet();
att.addAttribute( id, name );
@@ -1011,7 +1048,7 @@
att.addAttribute( id, name );
- newline();
+ writeEOL();
writeStartTag( tag, att );
}
@@ -1027,7 +1064,7 @@
MutableAttributeSet att = new SimpleAttributeSet();
att.addAttribute( id, name );
- newline();
+ writeEOL();
writeSimpleTag( tag, att );
}
@@ -1039,7 +1076,7 @@
*/
protected void writeEmptyTag( Tag tag, String attributeId )
{
- newline();
+ writeEOL();
writeSimpleTag( tag, config.getAttributeSet( attributeId ) );
}
@@ -1068,7 +1105,7 @@
protected void writeln( String text )
{
write( text );
- newline();
+ writeEOL();
}
/**
@@ -1079,12 +1116,6 @@
protected void content( String text )
{
write( escaped( text, verbatim ) );
- }
-
- /** Writes EOL. */
- protected void newline()
- {
- write( EOL );
}
/**