From 69b4e499ff852d492d577b50b5a09b907275d700 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Sun, 28 Jun 2020 13:30:44 -0400
Subject: [PATCH 1/6] input: Add EDTF as an alternative date representation

This adds EDTF, part of ISO 8601-2, as an alernative to the current,
more verbose, representation.
---
 schemas/input/csl-data.json | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index cee136b0..6c66c9b5 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -422,9 +422,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
+          }
         ]
       }
     },
@@ -468,8 +473,18 @@
         }
       ]
     },
+    "edtf-datatype": {
+      "title": "EDTF datatype pattern",
+      "description": "CSL input supports EDTF, validated against this regular expression.",
+      "type": "string"
+    },
     "date-variable": {
+      "title": "Date content model.",
+      "description": "The CSL input model supports two different date representations: an EDTF string, and a more structured equivalent.",
       "anyOf": [
+        {
+          "$ref": "#/definitions/edtf-datatype"
+        },
         {
           "properties": {
             "date-parts": {
@@ -496,6 +511,9 @@
             },
             "raw": {
               "type": "string"
+            },
+            "edtf": {
+              "$ref": "#/definitions/edtf-datatype"
             }
           },
           "additionalProperties": false

From b0fff2a3b79b7c4adf2e68093ef8cf3eac650fad Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Mon, 29 Jun 2020 20:08:29 -0400
Subject: [PATCH 2/6] add basic regex

---
 schemas/input/csl-data.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index 6c66c9b5..ba6df966 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -476,7 +476,8 @@
     "edtf-datatype": {
       "title": "EDTF datatype pattern",
       "description": "CSL input supports EDTF, validated against this regular expression.",
-      "type": "string"
+      "type": "string",
+      "pattern": "[0-9,\-,%,~,X,?,..,\/]"
     },
     "date-variable": {
       "title": "Date content model.",

From 00412663cee29f630e8a112abf751fce6c9c1748 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Mon, 29 Jun 2020 20:12:30 -0400
Subject: [PATCH 3/6] fix regex

---
 schemas/input/csl-data.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index ba6df966..7986cdab 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -477,7 +477,7 @@
       "title": "EDTF datatype pattern",
       "description": "CSL input supports EDTF, validated against this regular expression.",
       "type": "string",
-      "pattern": "[0-9,\-,%,~,X,?,..,\/]"
+      "pattern": "[0-9,-,%,~,X,?,..,\/]"
     },
     "date-variable": {
       "title": "Date content model.",

From bf6ef4bd719b28d0cd0b4d1c196c0190bbefdc81 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Tue, 30 Jun 2020 08:15:28 -0400
Subject: [PATCH 4/6] Add preference for EDTF representation

---
 schemas/input/csl-data.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index 7986cdab..e62f4a6e 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -481,7 +481,7 @@
     },
     "date-variable": {
       "title": "Date content model.",
-      "description": "The CSL input model supports two different date representations: an EDTF string, and a more structured equivalent.",
+      "description": "The CSL input model supports two different date representations: a preferred EDTF string, and a more structured alternative.",
       "anyOf": [
         {
           "$ref": "#/definitions/edtf-datatype"

From 95ee3ec2990a63b6b8e0b311940df3e95aead92b Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Tue, 30 Jun 2020 10:25:48 -0400
Subject: [PATCH 5/6] Update regex

---
 schemas/input/csl-data.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index e62f4a6e..e79e692b 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -477,7 +477,7 @@
       "title": "EDTF datatype pattern",
       "description": "CSL input supports EDTF, validated against this regular expression.",
       "type": "string",
-      "pattern": "[0-9,-,%,~,X,?,..,\/]"
+      "pattern": "^[0-9-%~X?.\/]{4,}$"
     },
     "date-variable": {
       "title": "Date content model.",

From 5b4e4320d331494d9a4bf9672a068cb3c2a08a99 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Tue, 30 Jun 2020 10:28:31 -0400
Subject: [PATCH 6/6] tweak description

---
 schemas/input/csl-data.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schemas/input/csl-data.json b/schemas/input/csl-data.json
index e79e692b..55f93a45 100644
--- a/schemas/input/csl-data.json
+++ b/schemas/input/csl-data.json
@@ -481,7 +481,7 @@
     },
     "date-variable": {
       "title": "Date content model.",
-      "description": "The CSL input model supports two different date representations: a preferred EDTF string, and a more structured alternative.",
+      "description": "The CSL input model supports two different date representations: an EDTF string (preferred), and a more structured alternative.",
       "anyOf": [
         {
           "$ref": "#/definitions/edtf-datatype"