diff --git a/lib/whedon.rb b/lib/whedon.rb index f622e53..d955e43 100644 --- a/lib/whedon.rb +++ b/lib/whedon.rb @@ -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 diff --git a/lib/whedon/author.rb b/lib/whedon/author.rb index 79e6a0c..484b660 100644 --- a/lib/whedon/author.rb +++ b/lib/whedon/author.rb @@ -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 }