Temporarily disable extracting Issued from Extra

Until we can parse ranges in the Date field. See #3030.

citeproc-js will still use it (which is the point).
This commit is contained in:
Dan Stillman 2023-03-21 05:49:16 -04:00
parent e024449732
commit 8a1dd3637c
2 changed files with 20 additions and 3 deletions

View file

@ -1277,6 +1277,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

View file

@ -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 () {