Don't extract 'type: note' or 'type: attachment' from Extra
This commit is contained in:
parent
3247391914
commit
3f2998bb6b
2 changed files with 12 additions and 0 deletions
|
@ -1012,6 +1012,11 @@ Zotero.Utilities.Internal = {
|
|||
if (key == 'type') {
|
||||
let possibleType = itemTypes.get(value);
|
||||
if (possibleType) {
|
||||
// Ignore 'type: note' and 'type: attachment'
|
||||
if (['note', 'attachment'].includes(possibleType)) {
|
||||
keepLines.push(line);
|
||||
continue;
|
||||
}
|
||||
// Ignore item type that's the same as the item
|
||||
if (!item || possibleType != Zotero.ItemTypes.getName(itemTypeID)) {
|
||||
itemType = possibleType;
|
||||
|
|
|
@ -114,6 +114,13 @@ 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 extract a CSL type", function () {
|
||||
var str = 'type: motion_picture';
|
||||
var { itemType, fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str);
|
||||
|
|
Loading…
Reference in a new issue