Skip to content

Commit

Permalink
added more format to default
Browse files Browse the repository at this point in the history
and set it up with contants
  • Loading branch information
kjgarza committed Apr 16, 2019
1 parent 431adeb commit d724330
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def safe_params
end

meta = xml.present? ? parse_xml(xml, doi: p[:doi]) : {}
p[:schemaVersion] = meta["from"] == "schema_org" ? "http://datacite.org/schema/kernel-4" : p[:schemaVersion]
p[:schemaVersion] = METADATA_FORMATS.include?(meta["from"]) ? LAST_SCHEMA_VERSION : p[:schemaVersion]
xml = meta["string"]

read_attrs = [p[:creators], p[:contributors], p[:titles], p[:publisher],
Expand Down
11 changes: 11 additions & 0 deletions config/initializers/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ class IdentifierError < RuntimeError; end
"EMEA" => "Europe, Middle East and Africa",
"AMER" => "Americas"
}

LAST_SCHEMA_VERSION = "http://datacite.org/schema/kernel-4"

METADATA_FORMATS = [
"schema_org",
"ris",
"bibtex",
"citeproc",
"crossref",
"codemeta"
]

0 comments on commit d724330

Please sign in to comment.