Is it possible to use the AtlassianWikiRenderer from releasenotes-html.vm?

Alex Taylor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 12, 2012

Like it says :-) We're currently using a customised release-notes script which picks up the 'Description' field from our issues and writes it into the notes. Unfortunately, this doesn't parse the wiki-syntax... :-)

Is there any way to get releasenotes-html.vm to call the AtlassianWikiRenderer on this field prior to passing it to $textUtils.htmlEncode()?

3 answers

0 votes
Andriy Zhdanov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 13, 2015

It possible to do this also using public-api:

FieldLayoutItem fieldLayoutItem = ComponentAccessor.getFieldLayoutManager()
.getFieldLayout().getFieldLayoutItem(IssueFieldConstants.COMMENT); // CommentSystemField
JiraRendererPlugin rendererForField = ComponentAccessor.getRendererManager().getRendererForField(fieldLayoutItem);
return rendererForField.render("*test*", new IssueRenderContext(null)); // or issue.getIssueRenderContext()
0 votes
ConradR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2012

I just had a similar problem. For some reason you cant get AtlassianWikiRenderer directly with ComponentAccessor, but this code works(with Jira 5.1.8):

EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class);
        VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class);
        AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory);

        String wikiString = "*bold*";
        String htmlString = wikiRenderer.render(wikiString, null); // "<p><b>bold</b></p>"

Jeroen Kottier November 28, 2012

Hi conro,

Thanks for your input. I'm not that formiliar with adapting JIRA.
How can I implement this solution so I'm able to render a wiki string in the releasenotes template?

0 votes
Jeroen Kottier November 7, 2012

I'm interested in an answer to your question as well.

Suggest an answer

Log in or Sign up to answer