From 6967f14e37bf8dbc192ea31749f223cfbb598b4b Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 5 May 2021 22:51:52 +0200 Subject: a bit clearer name --- skate/unstructured.go | 15 +++++++-------- 1 file 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) } -- cgit v1.2.3