%{ var table=[]; function make_sorted_table(table) { table.sort(); let ranges_list = []; let new_ranges = []; let prefix = table[0].split(':')[0]; const max = table.length; for (let i = 0; i < max; i++) { let current_prefix = table[i].split(':')[0]; let current_suffix = table[i].split(':')[1]; let next_suffix = (i == max - 1) ? 0 : parseInt(table[i + 1].split(':')[1]); let sufix = parseInt(current_suffix) + 1; if (current_prefix == prefix && sufix == next_suffix) { ranges_list.push(table[i]) } else if (current_prefix == prefix && sufix != next_suffix) { if (ranges_list.length > 0) { ranges_list.push(table[i]) new_ranges.push(make_ranges(ranges_list, prefix)) ranges_list = [] } else { new_ranges.push(table[i]) } } else if (current_prefix != prefix) { prefix = current_prefix ranges_list = [] ranges_list.push(table[i]) } } return new_ranges.join('\r\n'); }; function make_ranges(ranges_list, prefix) { return prefix + ':' + ranges_list[0].split(':')[1] + '-' + ranges_list[ranges_list.length - 1].split(':')[1]; }; #{for links} #{if (%{'${Links[n].LinkType}'.equals('is blocked by')})} table.push('${Links[n].Summary}') #{end} #{end} #{for links} #{if (%{'${Links[n].LinkType}'.equals('relates to') })} #{for i=JQLIssuesCount|clause=issuekey = ${Links[n].Key}} #{for j=JQLIssues[i].LinksCount} #{if (%{'${JQLIssues[i].Links[j].LinkType}'.equals('is cloned by') })} table.push('${JQLIssues[i].Links[j].Summary}') #{end} #{end} #{end} #{end} #{end} make_sorted_table(table).toString(); }