Use the Atlassian Template Renderer (ATR) to render your textual content. ATR is a library that provides an abstraction on top of various template engines, making it easier to use the template engines. For example, instead of having to create a VelocityEngine object and configure it, we provide a factory to do that for you. See the Javadoc for reference information.
The following sections describe how to use the ATR.
In your atlassian-plugin.xml file, specify the module as follows:
<component-import key="velocity-renderer" interface="com.atlassian.templaterenderer.TemplateRenderer" />
Now just setup the component for injection into your component.
When you need to render a template, call the or method.
Let's say you want one of the other components injected into each of the template contexts for you to use. You could make sure to have that component injected anywhere you do some rendering and then creating a context map with the component in it. But there's an easier way. Specify the component as a template-context-item.
<template-context-item key="rendererHelperContextItem" component-ref="rendererHelper" context-key="helper" name="Renderer Helper Context Item"/>
Rate this page: