lib/bolognese/utils.rb in bolognese-0.9.34 vs lib/bolognese/utils.rb in bolognese-0.9.35

- old
+ new

@@ -209,11 +209,11 @@ end def find_from_format_by_id(id) id = normalize_id(id) - if /\A(?:(http|https):\/(\/)?(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id) + if /\A(?:(http|https):\/(\/)?(dx\.)?(doi.org|doi.test.datacite.org)\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id) ra = get_doi_ra(id) %w(DataCite Crossref).include?(ra) ? ra.downcase : nil elsif /\A(?:(http|https):\/(\/)?orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id) "orcid" elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id) @@ -303,14 +303,14 @@ else nil end end - def normalize_id(id) + def normalize_id(id, options={}) return nil unless id.present? # check for valid DOI - doi = normalize_doi(id) + doi = normalize_doi(id, options) return doi if doi.present? # check for valid HTTP uri uri = Addressable::URI.parse(id) return nil unless uri && uri.host && %w(http https).include?(uri.scheme)