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