svn commit: r946932 - in /maven/doxia/doxia/trunk: doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module

2010-05-21 Thread ltheussl
Author: ltheussl
Date: Fri May 21 08:36:30 2010
New Revision: 946932

URL: http://svn.apache.org/viewvc?rev=946932&view=rev
Log:
deprecate getBasedir(). add notes about DOXIA-373

Modified:

maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java

maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java

Modified: 
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java?rev=946932&r1=946931&r2=946932&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
 Fri May 21 08:36:30 2010
@@ -83,10 +83,13 @@ public abstract class AbstractParser
  * Returns the current base directory.
  *
  * @return The base directory.
+ *
+ * @deprecated this does not work in multi-module builds, see DOXIA-373
  */
 protected File getBasedir()
 {
 // TODO: This is baaad, it should come in with the request.
+// (this is only used for macro requests, see AptParser)
 
 String basedir = System.getProperty( "basedir" );
 

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?rev=946932&r1=946931&r2=946932&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
 Fri May 21 08:36:30 2010
@@ -2916,6 +2916,8 @@ public class AptParser
 aptParser.enableLogging( getLog() );
 parameters.put( "parser", aptParser );
 
+// getBasedir() does not work in multi-module builds, see DOXIA-373
+// the basedir should be injected from here, see DOXIA-224
 MacroRequest request = new MacroRequest( parameters, getBasedir() 
);
 try
 {




svn commit: r946933 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src: main/java/org/apache/maven/doxia/module/fo/NumberedListItem.java test/java/org/apache/maven/doxia/module/fo/FoSinkT

2010-05-21 Thread ltheussl
Author: ltheussl
Date: Fri May 21 08:39:07 2010
New Revision: 946933

URL: http://svn.apache.org/viewvc?rev=946933&view=rev
Log:
[DOXIA-376] add periods to numbered lists

Modified:

maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/NumberedListItem.java

maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/NumberedListItem.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/NumberedListItem.java?rev=946933&r1=946932&r2=946933&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/NumberedListItem.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/NumberedListItem.java
 Fri May 21 08:39:07 2010
@@ -160,7 +160,8 @@ public class NumberedListItem
 default:
 symbol = DECIMALS[j];
 }
-return symbol;
+
+return symbol + ".";
 }
 
 /**

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java?rev=946933&r1=946932&r2=946933&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
 Fri May 21 08:39:07 2010
@@ -262,7 +262,7 @@ public class FoSinkTest
 String attribs = getConfig().getAttributeString( "list" );
 String itemAttribs = getConfig().getAttributeString( "list.item" );
 return EOL + EOL + "" + EOL + 
"" + EOL
-+ "" + EOL + "i" + EOL + 
"" + EOL + EOL
++ "" + EOL + "i." + EOL + 
"" + EOL + EOL
 + "" + EOL + "" + 
item + "" + EOL
 + "" + EOL + "" + EOL + 
"" + EOL;
 }




svn commit: r946935 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src: main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java test/java/org/apache/maven/doxia/m

2010-05-21 Thread ltheussl
Author: ltheussl
Date: Fri May 21 08:46:29 2010
New Revision: 946935

URL: http://svn.apache.org/viewvc?rev=946935&view=rev
Log:
[DOXIA-382] Sink cannot be reused after parsing with ConfluenceParser
Submitted by: Sebastian Annies

Modified:

maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java

maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java?rev=946935&r1=946934&r2=946935&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceParser.java
 Fri May 21 08:46:29 2010
@@ -109,39 +109,37 @@ public class ConfluenceParser
 public synchronized void parse( Reader source, Sink sink )
 throws ParseException
 {
-List blocks;
-
 ByLineSource src = new ByLineReaderSource( source );
 
 try
 {
-blocks = parse( src );
+List blocks = parse( src );
+
+sink.head();
+
+sink.head_();
+
+sink.body();
+
+for ( Iterator i = blocks.iterator(); i.hasNext(); )
+{
+Block block = (Block) i.next();
+
+block.traverse( sink );
+}
+
+sink.body_();
 }
 catch ( Exception e )
 {
 // TODO handle column number
 throw new ParseException( e, src.getName(), src.getLineNumber(), 
-1 );
 }
-
-sink.head();
-
-sink.head_();
-
-sink.body();
-
-for ( Iterator i = blocks.iterator(); i.hasNext(); )
+finally
 {
-Block block = (Block) i.next();
-
-block.traverse( sink );
+setSecondParsing( false );
+init();
 }
-
-sink.body_();
-sink.flush();
-sink.close();
-
-setSecondParsing( false );
-init();
 }
 
 /** {...@inheritdoc} */

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java?rev=946935&r1=946934&r2=946935&view=diff
==
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
 Fri May 21 08:46:29 2010
@@ -19,6 +19,7 @@ package org.apache.maven.doxia.module.co
  * under the License.
  */
 
+import java.io.FilterWriter;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
@@ -444,6 +445,45 @@ public class ConfluenceParserTest
 assertTrue( "generated document should have a size > 0", 
output.toString().length() > 0 );
 }
 
+public void testDoxia382SinkCannotBeReused()
+throws ParseException
+{
+String document1 = "Test A"
++ "\n\n* list1"
++ "\n\n* list2"
++ "\n\n* list2{pre}123{/pre} "
++ "\n123";
+
+String document2 = "Test B"
++ "\n\n* list1"
++ "\n\n* list2"
++ "\n\n* list2{pre}123{/pre}"
++ "\n123";
+
+output = new StringWriter();
+Sink sink = new TextSink( new FilterWriter( output )
+{
+public void close() throws IOException
+{
+super.close();
+this.out = null;
+}
+
+public void write( String str, int off, int len )
+throws IOException
+{
+if ( out == null )
+{
+throw new IOException( "Writing to an already closed 
Writer" );
+}
+}
+});
+
+createParser().parse( new StringReader( document1 ), sink );
+createParser().parse( new StringReader( document2 ), sink );
+}
+
+
 private void assertContainsLines( String message, String result, Str

svn commit: r947013 - /maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java

2010-05-21 Thread ltheussl
Author: ltheussl
Date: Fri May 21 14:04:46 2010
New Revision: 947013

URL: http://svn.apache.org/viewvc?rev=947013&view=rev
Log:
ad DOXIA-392, DOXIASITETOOLS-37: also make DocumentRenderer validate xml

Modified:

maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java

Modified: 
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java?rev=947013&r1=947012&r2=947013&view=diff
==
--- 
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
 (original)
+++ 
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
 Fri May 21 14:04:46 2010
@@ -19,6 +19,7 @@ package org.apache.maven.doxia.docrender
  * under the License.
  */
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
@@ -44,6 +45,8 @@ import org.apache.maven.doxia.parser.man
 import org.apache.maven.doxia.logging.PlexusLoggerWrapper;
 import org.apache.maven.doxia.module.site.SiteModule;
 import org.apache.maven.doxia.module.site.manager.SiteModuleManager;
+import org.apache.maven.doxia.util.XmlValidator;
+
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.context.Context;
 
@@ -211,7 +214,6 @@ public abstract class AbstractDocumentRe
  * @param filesToProcess the Map of Files to process. The Map should 
contain as keys the paths of the
  *  source files (relative to {...@link #getBaseDir() baseDir}), and 
the corresponding SiteModule as values.
  * @param outputDirectory the output directory where the documents should 
be generated.
- * @param context the rendering context.
  * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if 
any
  * @throws java.io.IOException if any
  * @since 1.1.1
@@ -473,6 +475,10 @@ public abstract class AbstractDocumentRe
 {
 reader = getVelocityReader( f, ( (XmlStreamReader) 
reader ).getEncoding(), context );
 }
+if ( context != null && Boolean.TRUE.equals( (Boolean) 
context.get( "validate" ) ) )
+{
+reader = validate( reader, fullDocPath );
+}
 break;
 
 case Parser.TXT_TYPE:
@@ -504,7 +510,7 @@ public abstract class AbstractDocumentRe
 catch ( ParserNotFoundException e )
 {
 throw new DocumentRendererException( "No parser '" + parserId
-+ "' found for " + fullDocPath + ": " + e.getMessage() 
);
++ "' found for " + fullDocPath + ": " + 
e.getMessage(), e );
 }
 catch ( ParseException e )
 {
@@ -664,4 +670,23 @@ public abstract class AbstractDocumentRe
 {
 return FileUtils.getExtension( f.getAbsolutePath() ).toLowerCase( 
Locale.ENGLISH ).endsWith( "vm" );
 }
+
+private Reader validate( Reader source, String resource )
+throws ParseException, IOException
+{
+getLogger().debug( "Validating: " + resource );
+
+try
+{
+String content = IOUtil.toString( new BufferedReader( source ) );
+
+new XmlValidator( new PlexusLoggerWrapper( getLogger() ) 
).validate( content );
+
+return new StringReader( content );
+}
+finally
+{
+IOUtil.close( source );
+}
+}
 }