maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven-doxia-sitetools] 01/02: extracted method for better understanding
Date Mon, 16 Apr 2018 21:55:00 GMT
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git

commit 3e4c9714711a5395fc2f8bd44e03d532387322c0
Author: Hervé Boutemy <hboutemy@apache.org>
AuthorDate: Mon Apr 16 23:51:05 2018 +0200

    extracted method for better understanding
---
 .../doxia/siterenderer/DefaultSiteRenderer.java    | 39 +++++++++++++---------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
index f7abb91..a279e9e 100644
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
@@ -397,22 +397,7 @@ public class DefaultSiteRenderer
                     if ( siteContext.getProcessedContentOutput() != null )
                     {
                         // save Velocity processing result, ie the Doxia content that will
be parsed after
-                        if ( !siteContext.getProcessedContentOutput().exists() )
-                        {
-                            siteContext.getProcessedContentOutput().mkdirs();
-                        }
-
-                        String input = docRenderingContext.getInputName();
-                        File outputFile = new File( siteContext.getProcessedContentOutput(),
-                                                    input.substring( 0, input.length() -
3 ) );
-
-                        File outputParent = outputFile.getParentFile();
-                        if ( !outputParent.exists() )
-                        {
-                            outputParent.mkdirs();
-                        }
-
-                        FileUtils.fileWrite( outputFile, siteContext.getInputEncoding(),
doxiaContent );
+                        saveVelocityProcessedContent( docRenderingContext, siteContext, doxiaContent
);
                     }
 
                     reader = new StringReader( doxiaContent );
@@ -485,6 +470,28 @@ public class DefaultSiteRenderer
         mergeDocumentIntoSite( writer, (DocumentContent) sink, siteContext );
     }
 
+    private void saveVelocityProcessedContent( RenderingContext docRenderingContext, SiteRenderingContext
siteContext,
+                                               String doxiaContent )
+        throws IOException
+    {
+        if ( !siteContext.getProcessedContentOutput().exists() )
+        {
+            siteContext.getProcessedContentOutput().mkdirs();
+        }
+
+        String input = docRenderingContext.getInputName();
+        File outputFile = new File( siteContext.getProcessedContentOutput(),
+                                    input.substring( 0, input.length() - 3 ) );
+
+        File outputParent = outputFile.getParentFile();
+        if ( !outputParent.exists() )
+        {
+            outputParent.mkdirs();
+        }
+
+        FileUtils.fileWrite( outputFile, siteContext.getInputEncoding(), doxiaContent );
+    }
+
     /**
      * Creates a Velocity Context with all generic tools configured wit the site rendering
context.
      *

-- 
To stop receiving notification emails like this one, please contact
hboutemy@apache.org.

Mime
View raw message