maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r385817 - in /maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer: DefaultSiteRenderer.java Renderer.java
Date Tue, 14 Mar 2006 15:37:52 GMT
Author: brett
Date: Tue Mar 14 07:37:41 2006
New Revision: 385817

URL: http://svn.apache.org/viewcvs?rev=385817&view=rev
Log:
[MSITE-68] basic site:run now works for docs (not reports or summaries)

Modified:
    maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
    maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java

Modified: maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java?rev=385817&r1=385816&r2=385817&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
(original)
+++ maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
Tue Mar 14 07:37:41 2006
@@ -38,6 +38,7 @@
 import org.codehaus.plexus.velocity.VelocityComponent;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
@@ -200,41 +201,55 @@
         {
             RenderingContext renderingContext = (RenderingContext) i.next();
 
-            String fullPathDoc = new File( renderingContext.getBasedir(), renderingContext.getInputName()
).getPath();
+            File outputFile = new File( outputDirectory, renderingContext.getOutputName()
);
 
-            SiteRendererSink sink = createSink( renderingContext );
-
-            try
+            if ( !outputFile.getParentFile().exists() )
             {
-                FileReader reader = new FileReader( fullPathDoc );
-
-                doxia.parse( reader, renderingContext.getParserId(), sink );
-
-                File outputFile = new File( outputDirectory, renderingContext.getOutputName()
);
+                outputFile.getParentFile().mkdirs();
+            }
 
-                if ( !outputFile.getParentFile().exists() )
-                {
-                    outputFile.getParentFile().mkdirs();
-                }
+            OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile
), outputEncoding );
 
-                OutputStreamWriter writer =
-                    new OutputStreamWriter( new FileOutputStream( outputFile ), outputEncoding
);
-                generateDocument( writer, sink, siteRenderingContext );
-            }
-            catch ( ParserNotFoundException e )
-            {
-                throw new RendererException( "Error getting a parser for " + fullPathDoc
+ ": " + e.getMessage() );
-            }
-            catch ( ParseException e )
+            try
             {
-                getLogger().error( "Error parsing " + fullPathDoc + ": " + e.getMessage(),
e );
+                renderDocument( writer, renderingContext, siteRenderingContext );
             }
             finally
             {
-                sink.flush();
-
-                sink.close();
+                IOUtil.close( writer );
             }
+        }
+    }
+
+    public void renderDocument( Writer writer, RenderingContext renderingContext,
+                                SiteRenderingContext siteRenderingContext )
+        throws RendererException, FileNotFoundException
+    {
+        SiteRendererSink sink = createSink( renderingContext );
+
+        String fullPathDoc = new File( renderingContext.getBasedir(), renderingContext.getInputName()
).getPath();
+
+        try
+        {
+            FileReader reader = new FileReader( fullPathDoc );
+
+            doxia.parse( reader, renderingContext.getParserId(), sink );
+
+            generateDocument( writer, sink, siteRenderingContext );
+        }
+        catch ( ParserNotFoundException e )
+        {
+            throw new RendererException( "Error getting a parser for " + fullPathDoc + ":
" + e.getMessage() );
+        }
+        catch ( ParseException e )
+        {
+            getLogger().error( "Error parsing " + fullPathDoc + ": " + e.getMessage(), e
);
+        }
+        finally
+        {
+            sink.flush();
+
+            sink.close();
         }
     }
 

Modified: maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java?rev=385817&r1=385816&r2=385817&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
(original)
+++ maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
Tue Mar 14 07:37:41 2006
@@ -21,6 +21,7 @@
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.Writer;
 import java.net.MalformedURLException;
@@ -63,4 +64,7 @@
 
     Map locateDocumentFiles( SiteRenderingContext siteRenderingContext )
         throws IOException, RendererException;
+
+    void renderDocument( Writer writer, RenderingContext renderingContext, SiteRenderingContext
context )
+        throws RendererException, FileNotFoundException;
 }



Mime
View raw message