diff options
-rw-r--r-- | skate/unstructured.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/skate/unstructured.go b/skate/unstructured.go index a12507a..f2c1d21 100644 --- a/skate/unstructured.go +++ b/skate/unstructured.go @@ -8,8 +8,7 @@ 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)?`) + PatArxiv = regexp.MustCompile(`https?://arxiv.org/(pdf|abs)/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`) DOILinkPrefixes = []string{ "http://doi.org/", "http://dx.doi.org/", @@ -53,14 +52,9 @@ func ParseUnstructured(ref *Ref) error { ref.Biblio.DOI = v } // Arxiv - vs = PatArxivPDF.FindStringSubmatch(uns) + vs = PatArxiv.FindStringSubmatch(uns) if len(vs) != 0 && ref.Biblio.ArxivId == "" { - ref.Biblio.ArxivId = vs[1] - } else { - vs = PatArxivAbs.FindStringSubmatch(uns) - if len(vs) != 0 && ref.Biblio.ArxivId == "" { - ref.Biblio.ArxivId = vs[1] - } + ref.Biblio.ArxivId = vs[2] } // XXX: ISBN ref.Biblio.Extra.ISBN = ParseIsbn(uns) |