fix trimming for issues

This commit is contained in:
Petr Korolev 2014-12-03 16:08:20 +02:00
parent 188ba7e073
commit 2ad014d5c7
2 changed files with 11 additions and 5 deletions

View File

@ -30,7 +30,7 @@ module GitHubChangelogGenerator
@github = Github.new oauth_token: @github_token @github = Github.new oauth_token: @github_token
end end
generator = Generator.new(@options) @generator = Generator.new(@options)
@all_tags = self.get_all_tags @all_tags = self.get_all_tags
@pull_requests = self.get_all_closed_pull_requests @pull_requests = self.get_all_closed_pull_requests
@ -142,7 +142,7 @@ module GitHubChangelogGenerator
output_filename = "#{@options[:output]}" output_filename = "#{@options[:output]}"
File.open(output_filename, 'w') { |file| file.write(log) } File.open(output_filename, 'w') { |file| file.write(log) }
puts "Done! Generated log placed in #{output_filename}" puts "Done! Generated log placed in #{`pwd`.strip!}/#{output_filename}"
end end
@ -268,7 +268,7 @@ module GitHubChangelogGenerator
if @options[:pulls] if @options[:pulls]
# Generate pull requests: # Generate pull requests:
pull_requests.each { |pull_request| pull_requests.each { |pull_request|
merge = generator.get_string_for_pull_request(pull_request) merge = @generator.get_string_for_pull_request(pull_request)
log += "- #{merge}" log += "- #{merge}"
} if pull_requests } if pull_requests
@ -314,6 +314,9 @@ module GitHubChangelogGenerator
intro = 'Implemented enhancement' intro = 'Implemented enhancement'
end end
dict[:title].gsub! '>', '\>'
dict[:title].gsub! '*', '\*'
dict[:title].gsub! '_', '\_'
merge = "*#{intro}:* #{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n" merge = "*#{intro}:* #{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n"
log += "- #{merge}" log += "- #{merge}"
} }

View File

@ -6,8 +6,11 @@ module GitHubChangelogGenerator
end end
def get_string_for_pull_request(pull_request) def get_string_for_pull_request(pull_request)
trimmed_title = pull_request[:title].gsub '>', '/>' pull_request[:title].gsub! '>', '\>'
merge = "#{@options[:merge_prefix]}#{trimmed_title} [\\##{pull_request[:number]}](#{pull_request.html_url})" pull_request[:title].gsub! '*', '\*'
pull_request[:title].gsub! '_', '\_'
merge = "#{@options[:merge_prefix]}#{pull_request[:title]} [\\##{pull_request[:number]}](#{pull_request.html_url})"
if @options[:author] if @options[:author]
merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n" merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
else else