maven-doxia-sitetools/0001-Remove-dependency-on-velocity-tools.patch

100 lines
4.7 KiB
Diff

From 7b2073aa38961c5069508c40274b1b644ccb195d Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 6 Feb 2017 14:27:53 +0100
Subject: [PATCH] Remove dependency on velocity-tools
---
.../siterenderer/DefaultSiteRenderer.java | 65 +------------------
2 files changed, 2 insertions(+), 68 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 7e41c4a..6efdcaf 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
@@ -70,31 +70,11 @@ import org.apache.maven.doxia.siterenderer.SiteRenderingContext.SiteDirectory;
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
import org.apache.maven.doxia.util.XmlValidator;
import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.tools.Scope;
-import org.apache.velocity.tools.ToolManager;
-import org.apache.velocity.tools.config.ConfigurationUtils;
-import org.apache.velocity.tools.config.EasyFactoryConfiguration;
-import org.apache.velocity.tools.config.FactoryConfiguration;
-import org.apache.velocity.tools.generic.AlternatorTool;
-import org.apache.velocity.tools.generic.ClassTool;
-import org.apache.velocity.tools.generic.ComparisonDateTool;
-import org.apache.velocity.tools.generic.ContextTool;
-import org.apache.velocity.tools.generic.ConversionTool;
-import org.apache.velocity.tools.generic.DisplayTool;
-import org.apache.velocity.tools.generic.EscapeTool;
-import org.apache.velocity.tools.generic.FieldTool;
-import org.apache.velocity.tools.generic.LinkTool;
-import org.apache.velocity.tools.generic.LoopTool;
-import org.apache.velocity.tools.generic.MathTool;
-import org.apache.velocity.tools.generic.NumberTool;
-import org.apache.velocity.tools.generic.RenderTool;
-import org.apache.velocity.tools.generic.ResourceTool;
-import org.apache.velocity.tools.generic.SortTool;
-import org.apache.velocity.tools.generic.XmlTool;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
@@ -425,48 +405,7 @@ public class DefaultSiteRenderer implements Renderer {
* @return a Velocity tools managed context
*/
protected Context createToolManagedVelocityContext(SiteRenderingContext siteRenderingContext) {
- Locale locale = siteRenderingContext.getLocale();
- String dateFormat = siteRenderingContext.getSiteModel().getPublishDate().getFormat();
- String timeZoneId = siteRenderingContext.getSiteModel().getPublishDate().getTimezone();
- TimeZone timeZone =
- "system".equalsIgnoreCase(timeZoneId) ? TimeZone.getDefault() : TimeZone.getTimeZone(timeZoneId);
-
- EasyFactoryConfiguration config = new EasyFactoryConfiguration(false);
- config.property("safeMode", Boolean.FALSE);
- config.toolbox(Scope.REQUEST)
- .tool(ContextTool.class)
- .tool(LinkTool.class)
- .tool(LoopTool.class)
- .tool(RenderTool.class);
- config.toolbox(Scope.APPLICATION)
- .property("locale", locale)
- .tool(AlternatorTool.class)
- .tool(ClassTool.class)
- .tool(ComparisonDateTool.class)
- .property("format", dateFormat)
- .property("timezone", timeZone)
- .tool(ConversionTool.class)
- .property("dateFormat", dateFormat)
- .tool(DisplayTool.class)
- .tool(EscapeTool.class)
- .tool(FieldTool.class)
- .tool(MathTool.class)
- .tool(NumberTool.class)
- .tool(ResourceTool.class)
- .property("bundles", new String[] {"site-renderer"})
- .tool(SortTool.class)
- .tool(XmlTool.class);
-
- FactoryConfiguration customConfig = ConfigurationUtils.findInClasspath(TOOLS_LOCATION);
-
- if (customConfig != null) {
- config.addConfiguration(customConfig);
- }
-
- ToolManager manager = new ToolManager(false, false);
- manager.configure(config);
-
- return manager.createContext();
+ return new VelocityContext();
}
/**
--
2.46.1