aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-05 22:51:52 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-05 22:51:52 +0200
commit6967f14e37bf8dbc192ea31749f223cfbb598b4b (patch)
tree58949a76150c477672a201a6109da7bfcbf2aa53
parent0678efbe38c4832baba0206f4f0aca37fce9965d (diff)
downloadrefcat-6967f14e37bf8dbc192ea31749f223cfbb598b4b.tar.gz
refcat-6967f14e37bf8dbc192ea31749f223cfbb598b4b.zip
a bit clearer name
-rw-r--r--skate/unstructured.go15
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)
}