Ignore numeric values for Type:
lines in Extra
https://forums.zotero.org/discussion/comment/433334/#Comment_433334
This commit is contained in:
parent
eaef035062
commit
947fa2b558
2 changed files with 20 additions and 7 deletions
|
@ -1086,10 +1086,12 @@ Zotero.Utilities.Internal = {
|
|||
if (!key
|
||||
|| key != 'type'
|
||||
|| skipKeys.has(key)
|
||||
// 1) Ignore 'type: note' and 'type: attachment'
|
||||
// 1) Ignore 'type: note', 'type: attachment', 'type: annotation'
|
||||
// 2) Ignore 'article' until we have a Preprint item type
|
||||
// (https://github.com/zotero/translators/pull/2248#discussion_r546428184)
|
||||
|| ['note', 'attachment', 'article'].includes(value)) {
|
||||
|| ['note', 'attachment', 'annotation', 'article'].includes(value)
|
||||
// Ignore numeric values
|
||||
|| parseInt(value) == value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,11 +142,22 @@ describe("Zotero.Utilities.Internal", function () {
|
|||
|
||||
|
||||
describe("#extractExtraFields()", function () {
|
||||
it("should ignore 'type: note' and 'type: attachment'", function () {
|
||||
var str = 'type: note';
|
||||
var { itemType, extra } = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.isNull(itemType);
|
||||
assert.equal(extra, 'type: note');
|
||||
it("should ignore 'Type: note', 'Type: attachment', and 'Type: annotation'", function () {
|
||||
for (let type of ['note', 'attachment', 'annotation']) {
|
||||
let str = `Type: ${type}`;
|
||||
let { itemType, extra } = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.isNull(itemType, type);
|
||||
assert.equal(extra, `Type: ${type}`, type);
|
||||
}
|
||||
});
|
||||
|
||||
it("should ignore numeric values for Type", function () {
|
||||
for (let type of ['3']) {
|
||||
let str = `Type: ${type}`;
|
||||
let { itemType, extra } = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
assert.isNull(itemType, type);
|
||||
assert.equal(extra, `Type: ${type}`, type);
|
||||
}
|
||||
});
|
||||
|
||||
it("should use the first mapped Zotero type for a CSL type", function () {
|
||||
|
|
Loading…
Reference in a new issue