diff options
Diffstat (limited to 'skate/schema.go')
-rw-r--r-- | skate/schema.go | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/skate/schema.go b/skate/schema.go index dd088c2..afd9034 100644 --- a/skate/schema.go +++ b/skate/schema.go @@ -424,7 +424,66 @@ type BiblioRef struct { MatchStatus string `json:"match_status,omitempty"` MatchReason string `json:"match_reason,omitempty"` TargetUnstructured string `json:"target_unstructured,omitempty"` - TargetCSL string `json:"target_csl,omitempty"` + TargetCSL *CSL `json:"target_csl,omitempty"` +} + +// CSL is a subset of citation style language schema. +// https://github.com/citation-style-language/schema, +// https://navneethg.github.io/jsonschemaviewer/. This is a subset only. +type CSL struct { + Accessed CSLDate `json:"accessed,omitempty"` + Author []CSLAuthor `json:"author,omitempty"` + CollectionTitle string `json:"collection-title"` + ContainerTitle string `json:"container-title,omitempty"` + ContainerTitleShort string `json:"container-title-short,omitempty"` + DOI string `json:"DOI,omitempty"` + ID string `json:"id,omitempty"` + ISBN string `json:"ISBN,omitempty"` + ISSN string `json:"ISSN,omitempty"` + Issue string `json:"issue,omitempty"` + Issued CSLDate `json:"issued,omitempty"` + JounralAbbreviation string `json:"journalAbbreviation"` + Language string `json:"language"` + NumberOfPages string `json:"number-of-pages,omitempty"` + OriginalTitle string `json:"original-title,omitempty"` + PMCID string `json:"PMCID,omitempty"` + PMID string `json:"PMID,omitempty"` + Page string `json:"page,omitempty"` + PageFirst string `json:"page-first,omitempty"` + Publisher string `json:"publisher,omitempty"` + Source string `json:"source,omitempty"` + Status string `json:"status,omitempty"` + Title string `json:"title,omitempty"` + TitleShort string `json:"title-short,omitempty"` + Type string `json:"type,omitempty"` + URL string `json:"URL,omitempty"` + Volume string `json:"volume,omitempty"` + VolumeTitle string `json:"volume-title,omitempty"` + VolumeTitleShort string `json:"volume-title-short,omitempty"` + YearSuffix string `json:"year-suffix,omitempty"` +} + +// A date field is a complex field that expresses a date or a range of dates. +// An example date field in CSL is issued, which identifies the date an item +// was issued or published. Date fields can be expressed in two different +// formats. The first format is an array format (note the double-nesting of the +// array). To express a date range in this format, the ending date would be set +// as a second array. The second date format is a raw string. The recommended +// encoding is a string that represents the date in a numberic year-month-day +// format. +type CSLDate struct { + Raw string `json:"raw,omitempty"` + Parts [][]int `json:"date-parts,omitempty"` +} + +// Some personal names are represented by a single field (e.g. mononyms such as +// “Prince” or “Plato”). In such cases, the name can be delivered as a lone +// family element. Institutional names may be delivered in the same way, but it +// is preferred to set them instead as a literal element. +type CSLAuthor struct { + Family string `json:"family,omitempty"` + Given string `json:"given,omitempty"` + Literal string `json:"literal,omitempty"` } func (b *BiblioRef) Reset() { @@ -447,7 +506,7 @@ func (b *BiblioRef) Reset() { b.MatchStatus = "" b.MatchReason = "" b.TargetUnstructured = "" - b.TargetCSL = "" + b.TargetCSL = nil } // Hash returns a string that will be the same, if source and target are |