Skip to content

Commit

Permalink
Merge pull request #107 from datacite/detect_crosscite_format_fix
Browse files Browse the repository at this point in the history
Change detection for crosscite format
  • Loading branch information
richardhallett authored Mar 24, 2021
2 parents ce4125e + e2c40b2 commit d5b6320
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bolognese/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def find_from_format_by_ext(string, options={})
"codemeta"
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("schemaVersion").to_s.start_with?("http://datacite.org/schema/kernel")
"datacite_json"
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("types")
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("types") && Maremma.from_json(string).to_h.dig("publication_year").present?
"crosscite"
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
"citeproc"
Expand All @@ -552,7 +552,7 @@ def find_from_format_by_string(string)
"codemeta"
elsif Maremma.from_json(string).to_h.dig("schema-version").to_s.start_with?("http://datacite.org/schema/kernel")
"datacite_json"
elsif Maremma.from_json(string).to_h.dig("types").present?
elsif Maremma.from_json(string).to_h.dig("types").present? && Maremma.from_json(string).to_h.dig("publication_year").present?
"crosscite"
elsif Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
"citeproc"
Expand Down

0 comments on commit d5b6320

Please sign in to comment.