Extracting Comments in HTML code

Hey guys,
I’m having a Problem again.

I want to export Comments to a separate HTML file, but I only get a Wiki Markup String like this:

  • dfgdfg * dsf_ssd_f * s+dfs+df * s{color:red}df^sd^f * sdfsd{color}(y) ()(x)(?) {code:java} // Some comments here public String getFoo() { return foo; } {code} ||Heading 1||Heading 2|| |Col A1|Col A2

But I would like to have it look like this:

Is there any good way of doing this ?

I already found AtlassianWikiRenderer and DefaultCommentFieldRenderer, but I don´t really know how to use them.

OK,
I got it working.
Maybe this can help someone in the Future:

I used AtlassianWikiRenderer, for that I needed to add the JIRA-Core dependency in the POM.xml.

The code to render the Wiki annotated string to an HTML annotated string looks something like this:

AtlassianWikiRenderer atlassianWikiRenderer = new AtlassianWikiRenderer(eventPublisher, ComponentAccessor.getApplicationProperties(), velocityRequestContextFactory);
dataMap.put("commentHtml", atlassianWikiRenderer.render(comment.getBody(), new IssueRenderContext(issue)));

I’m putting this in to a map because I want to render the output with Velocity, that´s also the reason why the Key ends with “Html”, because when that´s the case Velocity is not going to escape the String and it is going to be displayed properly.

If someone else has a better Idea though, please let me know.

1 Like

I’m having difficultly in finding the jar to download for this class. Is it still in Maven?

Thanks