Make macros in templates local to the template

We define macro 'elipses' in a number of templates. The template
code seems to assume the macro is local to the template file, but
this isn't the case by default in Velocity. For unknown reasons the
macro is made public to the entire set of templates being processed,
but this is hard to work with because we do not know what order
the macro files will be loaded and defined in, nor do we know what
macros a site admin might try to declare for their own templates.

Set all macros to be private to the file they are declared in, as
this makes the behavior more predictable. It does require a site
admin to copy common macros across all templates, but I think this
is already what a site admin might expect from our template format.

For reference see http://wiki.apache.org/velocity/MacroIssues

Change-Id: If2dc09a1246f49fb032f0c8c9b7d1a9afefdfca5
This commit is contained in:
Shawn O. Pearce
2012-01-09 17:43:44 -08:00
parent f8fdb7be80
commit 49ee8bc899

View File

@@ -42,6 +42,7 @@ public class VelocityRuntimeProvider implements Provider<RuntimeInstance> {
String pkg = "org.apache.velocity.runtime.resource.loader";
Properties p = new Properties();
p.setProperty(RuntimeConstants.VM_PERM_INLINE_LOCAL, "true");
p.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
Slf4jLogChute.class.getName());
p.setProperty("runtime.log.logsystem.log4j.category", "velocity");