Skip to content

Commit

Permalink
Change detection for crosscite format
Browse files Browse the repository at this point in the history
Look for snake case field to determine if it's crosscite.
This is because it's very similiar to datacite_json,
the difference being it is camelCase vs snakeCase
  • Loading branch information
richardhallett committed Mar 23, 2021
1 parent a7335c1 commit e2c40b2
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 e2c40b2

Please sign in to comment.