Reputation: 653
I am new in the development of Confluence Add-Ons. I want to use the example from the API. For instance look at this Page Dialog 2, there are the HTML-Code and the JS-Code separated.
I know how to define a JS-File and how to refer to the atlassian-plugin.xml
.
Look here
<web-resource key="Confluence-resources" name="Confluence-Web-Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="confluence.js" location="/js/confluence.js"/>
</web-resource>
But where I must define the HTML-Code?
Upvotes: 0
Views: 484
Reputation: 21
In essence, you need to render the HTML from execute
method in your Macro
class. But, practically speaking, there're a few "Atlassian-approved" approaches.
You might want to consider built-in Velocity templating support from VelocityUtils.getRenderedTemplate
method.
Quoting Atlassian's Documentation, you can probably write something like:
public String execute(Map params, String body, RenderContext renderContext) throws MacroException {
// do something with params ...
Map context = MacroUtils.defaultVelocityContext();
context.put("page", page);
context.put("labels", labels);
return VelocityUtils.getRenderedTemplate("com/atlassian/confluence/example/sample-velocity.vm", context);
}
In recent years, they started to promote the usage Soy Template
too.
Upvotes: 2