Skip to content

Commit

Permalink
input: Add EDTF as an option for date representation (#284)
Browse files Browse the repository at this point in the history
As part of #278, and to harmonize the JSON and YAML representations 
around a much more concise and expressive date format, this adds a 
an option to use EDTF; either as a preferred string on any date, or as 
an "edtf" string property on the more verbose alternative object 
representation.

While EDTF was originally an initiative of the US Library of Congress, 
ISO adopted it as part of 8601-2 in 2019.

Note: The current regular expression pattern only checks for valid 
characters.
  • Loading branch information
bdarcus committed Jul 26, 2020
1 parent a67b633 commit c993500
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions schemas/input/csl-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,14 @@
"title": "Custom key-value pairs.",
"type": "object",
"description": "Used to store additional information that does not have a designated CSL JSON field. The note field can also store additional information, but custom is preferred for storing key-value pairs.",
"examples" : [
{"short_id": "xyz", "other-ids": ["alternative-id"]},
{"metadata-double-checked": true}
"examples": [
{
"short_id": "xyz",
"other-ids": ["alternative-id"]
},
{
"metadata-double-checked": true
}
]
}
},
Expand Down Expand Up @@ -492,8 +497,19 @@
}
]
},
"edtf-datatype": {
"title": "EDTF datatype pattern",
"description": "CSL input supports EDTF, validated against this regular expression.",
"type": "string",
"pattern": "^[0-9-%~X?.\/]{4,}$"
},
"date-variable": {
"title": "Date content model.",
"description": "The CSL input model supports two different date representations: an EDTF string (preferred), and a more structured alternative.",
"anyOf": [
{
"$ref": "#/definitions/edtf-datatype"
},
{
"properties": {
"date-parts": {
Expand All @@ -520,6 +536,9 @@
},
"raw": {
"type": "string"
},
"edtf": {
"$ref": "#/definitions/edtf-datatype"
}
},
"additionalProperties": false
Expand Down

0 comments on commit c993500

Please sign in to comment.