lib/bolognese/utils.rb in bolognese-0.9.25 vs lib/bolognese/utils.rb in bolognese-0.9.26
- old
+ new
@@ -262,19 +262,23 @@
"codemeta"
end
end
def orcid_from_url(url)
- Array(/\A:(http|https)\/\/orcid\.org\/(.+)/.match(url)).last
+ Array(/\A:(http|https):\/\/orcid\.org\/(.+)/.match(url)).last
end
def orcid_as_url(orcid)
"https://orcid.org/#{orcid}" if orcid.present?
end
def validate_orcid(orcid)
orcid = Array(/\A(?:(http|https):\/\/(www\.)?orcid\.org\/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\z/.match(orcid)).last
orcid.gsub(/[[:space:]]/, "-") if orcid.present?
+ end
+
+ def validate_orcid_scheme(orcid_scheme)
+ Array(/\A(http|https):\/\/(www\.)?(orcid\.org)/.match(orcid_scheme)).last
end
def validate_url(str)
if /\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(str)
"DOI"