Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Allow author to have no affiliation #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/whedon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def parse_authors(yaml)

# Loop through the authors block and build up the affiliation
authors_yaml.each do |author|
affiliation_index = author['affiliation']
returned << Author.new(author['name'], author['orcid'], affiliation_index, affiliations)
if author.has_key? 'affiliation'
returned << Author.new(author['name'], author['orcid'], affiliation_index, affiliations)
else
affiliation_index = author['affiliation']
returned << Author.new(author['name'], author['orcid'], nil, affiliations)
end
end

returned
Expand Down
2 changes: 1 addition & 1 deletion lib/whedon/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def build_affiliation_string(index, affiliations_yaml)
# to parse each one and build the affiliation string.
author_affiliations = []

return nil if index.nil? # Some authors don't have an affiliation
return '' if index.nil? # Some authors don't have an affiliation

affiliations = if index.to_s.include?(',')
index.split(',').map { |a| a.strip }
Expand Down