Problem with release notes velocity macro - wrong output

Fabian
Contributor
October 19, 2021

dear community,

I am currently trying to develop a release notes template with velocity.
For this i used the following documentation:
https://developer.atlassian.com/server/jira/platform/creating-a-custom-release-notes-template-containing-release-comments/

I want to create a confluence Wiki format with the release note template.
Here is the problem i have:
Strangely, when running macro, the # is also shown and a line break is made where there shouldn't be one.

 

This is my velocity macro:

#disable_html_escaping()
#macro (getReleaseNoteComment $issue $customFieldManager)
#set ($customFields = $customFieldManager.getCustomFieldObjects($issue.project.getLong("id"), $issue.issueType.getString("id")))
#foreach($customField in $customFields)
#if($customField.name.equals("Release Note"))
#if($customField.getValue($issue)) - Release Note: $textUtils.htmlEncode($customField.getValue($issue))#end
#end
#end
#end

##Text is escaped twice so that the characters generated in the text area display properly escaped (JRA-12184)
#macro (doubleEncode $html)
# $textUtils.htmlEncode($textUtils.htmlEncode($html))
#end

...

<textarea rows="40" cols="120" id="editcopy">
#doubleEncode($action.getText('release.notes.heading', $project, $version))
||Key||Issue Typ||conclusion||description||
#foreach ($issueType in $issueTypes)
#if($issueType.issues.size() > 0)
#foreach ($issue in $issueType.issues) |[$issue.key|$!requestContext.canonicalBaseUrl/browse/$issue.key]|#doubleEncode($issueType.name)|#doubleEncode($issue.summary)|#getReleaseNoteComment($issue $customFieldManager)|
#end
#end
#end
</textarea>

This is the result (Just copy and paste):

# Release Notes - Testprojekt_FL - Version Version 3
||Key||Issue Typ||conclusion||description||
|[TESFL-48|https://.../browse/TESFL-48]|# Failure
|# Eval work time
| - Release Note: Tonight we dine in hell |
|[TESFL-58|https://.../browse/TESFL-58]|# Failure
|# Test-Scope
| - Release Note: Das ist aber toll. Dinner für alle |
|[TESFL-7|https://.../browse/TESFL-7]|# Task
|# Test today
| - Release Note: This is sparta |

0 answers

Suggest an answer

Log in or Sign up to answer