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 <hbout...@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 hbout...@apache.org.