parent
6125d65bc2
commit
f4bf918f35
1 changed files with 18 additions and 1 deletions
|
@ -131,6 +131,16 @@ Zotero.Translate.Sandbox = {
|
||||||
}
|
}
|
||||||
item = newItem;
|
item = newItem;
|
||||||
|
|
||||||
|
if (item.title) {
|
||||||
|
item.title = translate._cleanTitle(item.title, item.itemType);
|
||||||
|
// Short Title is added before this in the web itemDone, so if we removed
|
||||||
|
// a suffix (e.g., ": a novel") and the short title now matches the title,
|
||||||
|
// remove it
|
||||||
|
if (item.title == item.shortTitle) {
|
||||||
|
delete item.shortTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clean empty creators
|
// Clean empty creators
|
||||||
if (item.creators) {
|
if (item.creators) {
|
||||||
for (var i=0; i<item.creators.length; i++) {
|
for (var i=0; i<item.creators.length; i++) {
|
||||||
|
@ -1597,6 +1607,13 @@ Zotero.Translate.Base.prototype = {
|
||||||
return errorString;
|
return errorString;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_cleanTitle: function (title, itemType) {
|
||||||
|
if (itemType == 'book' || itemType == 'bookSection') {
|
||||||
|
return title.replace(/\s*:\s*a novel\s*$/i, '');
|
||||||
|
}
|
||||||
|
return title;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Canonicalize an array of tags such that they are all objects with the tag stored in the
|
* Canonicalize an array of tags such that they are all objects with the tag stored in the
|
||||||
* "tag" property and a type (if specified) is stored in the "type" property
|
* "tag" property and a type (if specified) is stored in the "type" property
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue