aboutsummaryrefslogtreecommitdiffstats
path: root/skate/reduce.go
diff options
context:
space:
mode:
authorMartin Czygan <martin@archive.org>2021-07-26 17:43:04 +0000
committerMartin Czygan <martin@archive.org>2021-07-26 17:43:04 +0000
commitaeaa60211e33cb49da98770b3461cbca2c2a65cc (patch)
tree1def8dfcd4d2c035a8b5ee6d88507a1ad53a8b40 /skate/reduce.go
parentbefd7895262e2469367e2a4f71f78148b9986dee (diff)
parent0d4c3ca311b1057bdb07144b0ac8ba860be2de55 (diff)
downloadrefcat-aeaa60211e33cb49da98770b3461cbca2c2a65cc.tar.gz
refcat-aeaa60211e33cb49da98770b3461cbca2c2a65cc.zip
Merge branch 'bnewbold-skate-tweaks' into 'master'
proposed changes and fixes to skate matching See merge request martin/cgraph!3
Diffstat (limited to 'skate/reduce.go')
-rw-r--r--skate/reduce.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/skate/reduce.go b/skate/reduce.go
index e2fa130..76b511e 100644
--- a/skate/reduce.go
+++ b/skate/reduce.go
@@ -408,6 +408,7 @@ func ZippyWayback(refs, cdx io.Reader, w io.Writer) error {
cdx.Summary.Ok, cdx.Line)
}
}
+ bref.MatchProvenance = ref.RefSource
bref.MatchStatus = StatusExact.Short()
bref.MatchReason = ReasonURLMatch.Short()
if err := enc.Encode(bref); err != nil {
@@ -574,16 +575,19 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [
var (
authors []CSLAuthor
isbn string
- year string
+ issued *CSLDate
)
- for _, name := range r.Biblio.ContribRawNames {
- authors = append(authors, CSLAuthor{Name: name})
+ for _, raw_name := range r.Biblio.ContribRawNames {
+ authors = append(authors, CSLAuthor{RawName: raw_name})
}
if len(r.Biblio.Extra.ISBN) > 0 {
isbn = r.Biblio.Extra.ISBN[0]
}
- if r.Biblio.Year > 1500 && r.Biblio.Year < 2022 {
- year = fmt.Sprintf("%d", r.Biblio.Year)
+ // TODO: need to update this "max year" number frequently?
+ if r.Biblio.Year > 1500 && r.Biblio.Year <= 2025 {
+ issued = &CSLDate{Parts: [][]int{{int(r.Biblio.Year)}}}
+ } else {
+ issued = &CSLDate{}
}
bref.TargetCSL = &CSL{
Author: authors,
@@ -598,12 +602,11 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [
Title: r.Biblio.Title,
URL: r.Biblio.Url,
Volume: r.Biblio.Volume,
- Issued: CSLDate{
- Raw: year,
- },
+ Issued: issued,
}
}
// Reuse fields for debugging, for now.
+ bref.MatchProvenance = r.RefSource
bref.MatchStatus = StatusUnmatched.Short()
bref.MatchReason = ReasonUnknown.Short()
matched = append(matched, &bref)