diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-07-25 15:54:38 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-07-25 15:54:42 -0700 |
commit | 1c1c2cb5eb983ae26a8a445aee081b147cf0f652 (patch) | |
tree | ecff9aa94d6aaf91ad710d840a9c206f5a0ccd41 /skate | |
parent | 3d6ea95540d1e5b225b2507808d5318ecea05b6b (diff) | |
download | refcat-1c1c2cb5eb983ae26a8a445aee081b147cf0f652.tar.gz refcat-1c1c2cb5eb983ae26a8a445aee081b147cf0f652.zip |
skate unstructured: don't parse DOI out of key
DOIs in keys, usually from Crossref, are the DOI of the *source* of the
reference, not the *target* of the reference. Thus, they should not be
parsed and copied to the ref.biblio.doi field.
Diffstat (limited to 'skate')
-rw-r--r-- | skate/unstructured.go | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/skate/unstructured.go b/skate/unstructured.go index f2c1d21..39821a1 100644 --- a/skate/unstructured.go +++ b/skate/unstructured.go @@ -24,33 +24,17 @@ func ParseUnstructured(ref *Ref) error { v string vs []string ) - // Handle things like: 10.1111/j.1550-7408.1968.tb02138.x-BIB5|cit5, - // 10.1111/j.1558-5646.1997.tb02431.x-BIB0008|evo02431-cit-0008, ... - if strings.Contains(strings.ToLower(ref.Key), "-bib") && ref.Biblio.DOI == "" { - parts := strings.Split(strings.ToLower(ref.Key), "-bib") - ref.Biblio.DOI = parts[0] - } // DOI v = PatDOI.FindString(uns) if v != "" && ref.Biblio.DOI == "" { ref.Biblio.DOI = v } - // DOI in Key - v = PatDOINoHyphen.FindString(ref.Key) - if v != "" && ref.Biblio.DOI == "" { - ref.Biblio.DOI = v - } // DOI in URL for _, prefix := range DOILinkPrefixes { if ref.Biblio.DOI != "" && strings.HasPrefix(ref.Biblio.Url, prefix) { ref.Biblio.DOI = strings.Replace(ref.Biblio.Url, prefix, "", -1) } } - // Another DOI pattern. - v = PatDOINoHyphen.FindString(ref.Key) - if v != "" && ref.Biblio.DOI == "" { - ref.Biblio.DOI = v - } // Arxiv vs = PatArxiv.FindStringSubmatch(uns) if len(vs) != 0 && ref.Biblio.ArxivId == "" { |