diff options
-rw-r--r-- | skate/unstructured.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/skate/unstructured.go b/skate/unstructured.go index 082c685..85ef0fe 100644 --- a/skate/unstructured.go +++ b/skate/unstructured.go @@ -6,15 +6,14 @@ import ( ) var ( - PatDOI = regexp.MustCompile(`10[.][0-9]{1,8}/[^ ]*[\w]`) - PatDOINoHyphen = regexp.MustCompile(`10[.][0-9]{1,8}/[^ -]*[\w]`) - PatArxivPDF = regexp.MustCompile(`https?://arxiv.org/pdf/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`) - PatArxivAbs = regexp.MustCompile(`https?://arxiv.org/abs/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`) - - urlPrefixes = []string{ + PatDOI = regexp.MustCompile(`10[.][0-9]{1,8}/[^ ]*[\w]`) + PatDOINoHyphen = regexp.MustCompile(`10[.][0-9]{1,8}/[^ -]*[\w]`) + PatArxivPDF = regexp.MustCompile(`https?://arxiv.org/pdf/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`) + PatArxivAbs = regexp.MustCompile(`https?://arxiv.org/abs/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`) + DOILinkPrefixes = []string{ "http://doi.org/", - "https://doi.org/", "http://dx.doi.org/", + "https://doi.org/", "https://dx.doi.org/", } ) @@ -43,7 +42,7 @@ func ParseUnstructured(ref *Ref) error { ref.Biblio.DOI = v } // DOI in URL - for _, prefix := range urlPrefixes { + for _, prefix := range DOILinkPrefixes { if ref.Biblio.DOI != "" && strings.HasPrefix(ref.Biblio.Url, prefix) { ref.Biblio.DOI = strings.Replace(ref.Biblio.Url, prefix, "", -1) } |