diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 1cc6e09c80..bae1880878 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -1303,6 +1303,12 @@ Zotero.Utilities.Internal = { return true; } + // Skip for now, since we don't support date ranges + // https://github.com/zotero/zotero/issues/3030 + if (key == 'issued') { + return true; + } + // Fields let possibleFields = fieldNames.get(key); // No valid fields diff --git a/test/tests/utilities_internalTest.js b/test/tests/utilities_internalTest.js index 63df823e09..79dccb20bf 100644 --- a/test/tests/utilities_internalTest.js +++ b/test/tests/utilities_internalTest.js @@ -248,7 +248,7 @@ describe("Zotero.Utilities.Internal", function () { assert.equal(creators[0].name, 'Bar'); }); - it("should extract a CSL date field", function () { + it.skip("should extract a CSL date field", function () { var str = 'issued: 2000'; var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str); assert.equal(fields.size, 1); @@ -286,11 +286,13 @@ describe("Zotero.Utilities.Internal", function () { }); it("should extract the citeproc-js cheater syntax", function () { - var issued = '{:number-of-pages:11}\n{:issued:2014}'; + //var issued = '{:number-of-pages:11}\n{:issued:2014}'; + var issued = '{:number-of-pages:11}\n{:archive_location:Location}'; var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(issued); assert.equal(fields.size, 2); assert.equal(fields.get('numPages'), 11); - assert.equal(fields.get('date'), 2014); + assert.equal(fields.get('archiveLocation'), 'Location'); + //assert.equal(fields.get('date'), 2014); assert.strictEqual(extra, ''); }); @@ -308,6 +310,15 @@ describe("Zotero.Utilities.Internal", function () { assert.equal(fields.size, 0); assert.equal(extra, "Event Place: Foo\nPublisher Place: Bar"); }); + + // Re-enable "should extract a CSL date field" and cheater-syntax lines above when removed + it("should ignore Issued (temporary)", function () { + var str = "Issued: 1994/1998"; + var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str); + Zotero.debug([...fields.entries()]); + assert.equal(fields.size, 0); + assert.equal(extra, "Issued: 1994/1998"); + }); }); describe("#combineExtraFields", function () {