@Override
public List<Block> execute(ChartMacroParameters macroParams, String content, MacroTransformationContext context)
throws MacroExecutionException
{
generateChart(macroParams, content, context);
String imageLocation = this.imageWriter.getURL(new ImageId(macroParams));
String title = macroParams.getTitle();
ResourceReference reference = new ResourceReference(imageLocation, ResourceType.URL);
ImageBlock imageBlock = new ImageBlock(new ResourceReference(imageLocation, ResourceType.URL), true);
imageBlock.setParameter("alt", title);
LinkBlock linkBlock = new LinkBlock(Collections.singletonList((Block) imageBlock), reference, true);
linkBlock.setParameter("title", title);
Block resultBlock;
if (context.isInline()) {
resultBlock = linkBlock;
} else {
resultBlock = new ParagraphBlock(Collections.singletonList((Block) linkBlock));
}
return Collections.singletonList(resultBlock);
}