Skip to content
Snippets Groups Projects
Commit aac4d6d5 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-19002: Impossible to share macros between Velocity macros in a top level wiki template

parent f59a7395
No related branches found
No related tags found
No related merge requests found
......@@ -203,7 +203,15 @@ private void transform(Block block) throws TransformationException
new TransformationContext(block instanceof XDOM ? (XDOM) block : new XDOM(Arrays.asList(block)),
this.renderingContext.getDefaultSyntax(), this.renderingContext.isRestricted());
transformationContext.setId(this.transformationId);
// Use the Transformation id as the name passed to the Velocity Engine. This name is used internally
// by Velocity as a cache index key for caching macros.
String tId = this.renderingContext.getTransformationId();
if (tId == null) {
// We need to set a top level id (otherwise Velocity macros won't be able to share vmacros for example)
tId = this.template.getId() != null ? this.template.getId() : "unknown namespace";
}
transformationContext.setId(tId);
transformationContext.setTargetSyntax(this.targetSyntax);
transform(block, transformationContext);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment