Extract username tagging

This commit is contained in:
phase 2015-10-25 11:12:16 -07:00 committed by Olle Jonsson
parent df31f98ce3
commit 4c737c9373

View File

@ -160,7 +160,7 @@ module GitHubChangelogGenerator
# Parse issue and generate single line formatted issue line. # Parse issue and generate single line formatted issue line.
# #
# Example output: # Example output:
# - Add coveralls integration [\#223](https://github.com/skywinder/github-changelog-generator/pull/223) ([skywinder](https://github.com/skywinder)) # - Add coveralls integration [\#223](https://github.com/skywinder/github-changelog-generator/pull/223) (@skywinder)
# #
# @param [Hash] issue Fetched issue from GitHub # @param [Hash] issue Fetched issue from GitHub
# @return [String] Markdown-formatted single issue # @return [String] Markdown-formatted single issue
@ -168,21 +168,22 @@ module GitHubChangelogGenerator
encapsulated_title = encapsulate_string issue[:title] encapsulated_title = encapsulate_string issue[:title]
title_with_number = "#{encapsulated_title} [\\##{issue[:number]}](#{issue.html_url})" title_with_number = "#{encapsulated_title} [\\##{issue[:number]}](#{issue.html_url})"
issue_line_with_user(title_with_number, issue)
end
unless issue.pull_request.nil? private
if @options[:author]
if issue.user.nil? def issue_line_with_user(line, issue)
title_with_number += " ({Null user})" return line if !@options[:author] || issue.pull_request.nil?
user = issue.user
return "#{line} ({Null user})" unless user
if user.html_url.include?("github.com")
"#{line} (@#{user.login})"
else else
if issue.user.html_url.exclude? "github.com" "#{line} ([#{user.login}](#{user.html_url}))"
title_with_number += " ([#{issue.user.login}](#{issue.user.html_url}))"
else
title_with_number += " (@#{issue.user.login})"
end end
end end
end end
end end
title_with_number
end
end
end