aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-03-30 02:38:42 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-03-30 02:38:42 +0200
commita7381838fa51e4ad62d76b8b5a013047969718a8 (patch)
treeab0ff6e9d81cdf9f8b5b1e4b21d89caf45239a0c /skate
parent1fa58a706f655c98b468fb006462d2a54d1d286d (diff)
downloadrefcat-a7381838fa51e4ad62d76b8b5a013047969718a8.tar.gz
refcat-a7381838fa51e4ad62d76b8b5a013047969718a8.zip
generete a doi list
Diffstat (limited to 'skate')
-rw-r--r--skate/cmd/skate-biblioref-from-wikipedia/main.go12
-rw-r--r--skate/schema.go5
2 files changed, 12 insertions, 5 deletions
diff --git a/skate/cmd/skate-biblioref-from-wikipedia/main.go b/skate/cmd/skate-biblioref-from-wikipedia/main.go
index 61b590e..86fba1a 100644
--- a/skate/cmd/skate-biblioref-from-wikipedia/main.go
+++ b/skate/cmd/skate-biblioref-from-wikipedia/main.go
@@ -2,6 +2,7 @@ package main
import (
"flag"
+ "fmt"
"log"
"os"
"runtime"
@@ -25,12 +26,13 @@ func main() {
if err := json.Unmarshal(p, &w); err != nil {
return nil, err
}
- b, err := json.Marshal(w.ParseIDList())
- if err != nil {
- return nil, err
+ idl := w.ParseIDList()
+ if idl.DOI == "" {
+ return nil, nil
}
- b = append(b, bytesNewline...)
- return b, nil
+ s := fmt.Sprintf("%s\t%s\n", idl.DOI, string(p))
+ return []byte(s), nil
+
})
pp.NumWorkers = *numWorkers
pp.BatchSize = *batchSize
diff --git a/skate/schema.go b/skate/schema.go
index 4a33be3..acb2601 100644
--- a/skate/schema.go
+++ b/skate/schema.go
@@ -275,6 +275,11 @@ type IDList struct {
OL string `json:"ol,omitempty"`
}
+func (l *IDList) IsZero() bool {
+ return l.ISBN == "" && l.DOI == "" && l.PMID == "" && l.ISSN == "" &&
+ l.JSTOR == "" && l.PMC == "" && l.ARXIV == "" && l.OL == ""
+}
+
func (c *MinimalCitations) ParseIDList() (result IDList) {
if len(c.IDList) < 3 {
return result