|
|
5dc6e7 |
From da397953bd73068c4ab8d219ec91e312fd3d5d55 Mon Sep 17 00:00:00 2001
|
|
|
5dc6e7 |
From: Michael Simacek <msimacek@redhat.com>
|
|
|
5dc6e7 |
Date: Mon, 6 Feb 2017 14:27:53 +0100
|
|
|
5dc6e7 |
Subject: [PATCH 2/2] Remove dependency on velocity-tools
|
|
|
5dc6e7 |
|
|
|
5dc6e7 |
---
|
|
|
5dc6e7 |
.../doxia/siterenderer/DefaultSiteRenderer.java | 58 +---------------------
|
|
|
5dc6e7 |
1 file changed, 2 insertions(+), 56 deletions(-)
|
|
|
5dc6e7 |
|
|
|
5dc6e7 |
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
|
|
|
5dc6e7 |
index c31688d..58058b3 100644
|
|
|
5dc6e7 |
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
|
|
|
5dc6e7 |
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
|
|
|
5dc6e7 |
@@ -76,31 +76,11 @@ import org.apache.maven.doxia.parser.module.ParserModuleNotFoundException;
|
|
|
5dc6e7 |
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
|
|
|
5dc6e7 |
import org.apache.maven.doxia.util.XmlValidator;
|
|
|
5dc6e7 |
import org.apache.velocity.Template;
|
|
|
5dc6e7 |
+import org.apache.velocity.VelocityContext;
|
|
|
5dc6e7 |
import org.apache.velocity.context.Context;
|
|
|
5dc6e7 |
import org.apache.velocity.exception.ParseErrorException;
|
|
|
5dc6e7 |
import org.apache.velocity.exception.ResourceNotFoundException;
|
|
|
5dc6e7 |
import org.apache.velocity.exception.VelocityException;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.Scope;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.ToolManager;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.config.ConfigurationUtils;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.config.EasyFactoryConfiguration;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.config.FactoryConfiguration;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.AlternatorTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.ClassTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.ComparisonDateTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.ContextTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.ConversionTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.DisplayTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.EscapeTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.FieldTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.LinkTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.LoopTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.MathTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.NumberTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.RenderTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.ResourceTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.SortTool;
|
|
|
5dc6e7 |
-import org.apache.velocity.tools.generic.XmlTool;
|
|
|
5dc6e7 |
import org.codehaus.plexus.PlexusContainer;
|
|
|
5dc6e7 |
import org.codehaus.plexus.component.annotations.Component;
|
|
|
5dc6e7 |
import org.codehaus.plexus.component.annotations.Requirement;
|
|
|
5dc6e7 |
@@ -481,41 +461,7 @@ public class DefaultSiteRenderer
|
|
|
5dc6e7 |
*/
|
|
|
5dc6e7 |
protected Context createToolManagedVelocityContext( SiteRenderingContext siteRenderingContext )
|
|
|
5dc6e7 |
{
|
|
|
5dc6e7 |
- Locale locale = siteRenderingContext.getLocale();
|
|
|
5dc6e7 |
- String dateFormat = siteRenderingContext.getDecoration().getPublishDate().getFormat();
|
|
|
5dc6e7 |
-
|
|
|
5dc6e7 |
- EasyFactoryConfiguration config = new EasyFactoryConfiguration( false );
|
|
|
5dc6e7 |
- config.property( "safeMode", Boolean.FALSE );
|
|
|
5dc6e7 |
- config.toolbox( Scope.REQUEST )
|
|
|
5dc6e7 |
- .tool( ContextTool.class )
|
|
|
5dc6e7 |
- .tool( LinkTool.class )
|
|
|
5dc6e7 |
- .tool( LoopTool.class )
|
|
|
5dc6e7 |
- .tool( RenderTool.class );
|
|
|
5dc6e7 |
- config.toolbox( Scope.APPLICATION ).property( "locale", locale )
|
|
|
5dc6e7 |
- .tool( AlternatorTool.class )
|
|
|
5dc6e7 |
- .tool( ClassTool.class )
|
|
|
5dc6e7 |
- .tool( ComparisonDateTool.class ).property( "format", dateFormat )
|
|
|
5dc6e7 |
- .tool( ConversionTool.class ).property( "dateFormat", dateFormat )
|
|
|
5dc6e7 |
- .tool( DisplayTool.class )
|
|
|
5dc6e7 |
- .tool( EscapeTool.class )
|
|
|
5dc6e7 |
- .tool( FieldTool.class )
|
|
|
5dc6e7 |
- .tool( MathTool.class )
|
|
|
5dc6e7 |
- .tool( NumberTool.class )
|
|
|
5dc6e7 |
- .tool( ResourceTool.class ).property( "bundles", new String[] { "site-renderer" } )
|
|
|
5dc6e7 |
- .tool( SortTool.class )
|
|
|
5dc6e7 |
- .tool( XmlTool.class );
|
|
|
5dc6e7 |
-
|
|
|
5dc6e7 |
- FactoryConfiguration customConfig = ConfigurationUtils.findInClasspath( TOOLS_LOCATION );
|
|
|
5dc6e7 |
-
|
|
|
5dc6e7 |
- if ( customConfig != null )
|
|
|
5dc6e7 |
- {
|
|
|
5dc6e7 |
- config.addConfiguration( customConfig );
|
|
|
5dc6e7 |
- }
|
|
|
5dc6e7 |
-
|
|
|
5dc6e7 |
- ToolManager manager = new ToolManager( false, false );
|
|
|
5dc6e7 |
- manager.configure( config );
|
|
|
5dc6e7 |
-
|
|
|
5dc6e7 |
- return manager.createContext();
|
|
|
5dc6e7 |
+ return new VelocityContext();
|
|
|
5dc6e7 |
}
|
|
|
5dc6e7 |
|
|
|
5dc6e7 |
/**
|
|
|
5dc6e7 |
--
|
|
|
5dc6e7 |
2.9.3
|
|
|
5dc6e7 |
|