From 43e649399732ff07c0a25af8cabbb36aca3fd7a5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 21 Dec 2020 01:09:23 -0500 Subject: [PATCH] Don't convert "Type: article" in Extra to Document item CSL 1.0.2 clarified that type 'article' is meant for preprints and working papers, so until we have a Preprint item type, just leave it in Extra. Discussion: https://github.com/zotero/translators/pull/2248#discussion_r492009958 --- chrome/content/zotero/xpcom/utilities_internal.js | 6 ++++-- test/tests/itemTest.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index f512f9fc38..d100911bce 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -1229,8 +1229,10 @@ Zotero.Utilities.Internal = { if (!key || key != 'type' || skipKeys.has(key) - // Ignore 'type: note' and 'type: attachment' - || ['note', 'attachment'].includes(value)) { + // 1) Ignore 'type: note' and 'type: attachment' + // 2) Ignore 'article' until we have a Preprint item type + // (https://github.com/zotero/translators/pull/2248#discussion_r546428184) + || ['note', 'attachment', 'article'].includes(value)) { return true; } diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 650da004c7..a6d29c1883 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -1896,6 +1896,17 @@ describe("Zotero.Item", function () { assert.equal(item.getField('extra'), 'Pages: 123'); }); + it("shouldn't convert 'Type: article' from Extra into Document item", function () { + var json = { + itemType: "report", + extra: "Type: article" + }; + var item = new Zotero.Item; + item.fromJSON(json); + assert.equal(Zotero.ItemTypes.getName(item.itemTypeID), 'report'); + assert.equal(item.getField('extra'), 'Type: article'); + }); + it("should ignore creator field in Extra", async function () { var json = { itemType: "journalArticle",