Author: vsiveton Date: Thu Jan 11 06:11:03 2007 New Revision: 495232 URL: http://svn.apache.org/viewvc?view=rev&rev=495232 Log: DOXIA-76: Doxia misses line breaks in apt when \ is not followed by \n Submitted by: Mathieu Champlon Reviewed by: Vincent Siveton
o patch added o added a test case Added: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java (with props) maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt (with props) Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?view=diff&rev=495232&r1=495231&r2=495232 ============================================================================== --- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java (original) +++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java Thu Jan 11 06:11:03 2007 @@ -840,6 +840,7 @@ flushTraversed( buffer, sink ); sink.nonBreakingSpace(); break; + case '\r': case '\n': ++i; // Skip white space which may follow a line break. Added: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java?view=auto&rev=495232 ============================================================================== --- maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java (added) +++ maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java Thu Jan 11 06:11:03 2007 @@ -0,0 +1,80 @@ +package org.apache.maven.doxia.module.apt; + +/* + * 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.FileReader; +import java.io.Reader; +import java.io.StringWriter; + +import org.apache.maven.doxia.parser.AbstractParserTestCase; +import org.apache.maven.doxia.parser.Parser; +import org.apache.maven.doxia.sink.Sink; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Siveton</a> + * @version $Id$ + */ +public class AptParserTest + extends AbstractParserTestCase +{ + private static final String EOL = System.getProperty( "line.separator" ); + + /** + * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getParser() + */ + protected Parser getParser() + { + return new AptParser(); + } + + /** + * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getDocument() + */ + protected String getDocument() + { + return "src/test/site/apt/linebreak.apt"; + } + + /** + * @throws Exception + */ + public void testLineBreak() + throws Exception + { + StringWriter output = null; + Reader reader = null; + + try + { + output = new StringWriter(); + reader = new FileReader( getTestFile( getBasedir(), getDocument() ) ); + + Sink sink = new AptSink( output ); + getParser().parse( reader, sink ); + + assertTrue( output.toString().indexOf( "Line\\" + EOL + "break." ) != -1 ); + } + finally + { + output.close(); + reader.close(); + } + } +} Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt?view=auto&rev=495232 ============================================================================== --- maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt (added) +++ maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt Thu Jan 11 06:11:03 2007 @@ -0,0 +1,10 @@ + ----- + Test DOXIA-76 + ----- + Vincent Siveton + ----- + +Test DOXIA-76 + + Line\ + break. Propchange: maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-core/src/test/site/apt/linebreak.apt ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"