mirror of
https://github.com/zotero/zotero.git
synced 2026-10-06 02:50:03 +00:00
Merge branch '3.0'
Conflicts: chrome/content/zotero/xpcom/translation/translate_item.js
This commit is contained in:
commit
9ea12d5561
11 changed files with 43 additions and 23 deletions
|
|
@ -231,10 +231,9 @@
|
|||
output = output.replace(entry[0], entry[1], "g");
|
||||
}
|
||||
|
||||
output = Zotero.Utilities.unescapeHTML(
|
||||
output.replace(" ", " ", "g"))
|
||||
.replace(highcharRe,
|
||||
function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+"{}" });
|
||||
output = Zotero.Utilities.unescapeHTML(output.replace(" ", " ", "g"))
|
||||
.replace("\u00A0", " ", "g")
|
||||
.replace(highcharRe, function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+"{}" });
|
||||
output = Zotero.Utilities.trim(output);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2288e745e7c13cac7a78bb294d09cf19ad2cf23e
|
||||
Subproject commit 36d26a584ac869f2dfbdd528f57141a3bbcf016f
|
||||
|
|
@ -160,7 +160,7 @@ Zotero.Translators = new function() {
|
|||
if(m) {
|
||||
// First, drop the 0- if it exists (this is an III invention)
|
||||
var host = m[2];
|
||||
if(host.substr(0, 2) === "0-") host = substr(2);
|
||||
if(host.substr(0, 2) === "0-") host = host.substr(2);
|
||||
var hostnames = host.split(".");
|
||||
for(var i=1; i<hostnames.length-2; i++) {
|
||||
if(TLDS[hostnames[i].toLowerCase()]) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ Zotero.MIMETypeHandler = new function () {
|
|||
// Not even trying
|
||||
this.addHandler("ris", _importHandler, true);
|
||||
}
|
||||
this.addHandler("text/x-csl", function(a1, a2) { Zotero.Styles.install(a1, a2) });
|
||||
this.addHandler("application/vnd.citationstyles.style+xml", function(a1, a2) { Zotero.Styles.install(a1, a2) });
|
||||
this.addHandler("text/x-csl", function(a1, a2) { Zotero.Styles.install(a1, a2) }); // deprecated
|
||||
this.addHandler("application/x-zotero-schema", Zotero.Schema.importSchema);
|
||||
this.addHandler("application/x-zotero-settings", Zotero.Prefs.importSettings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,7 +752,9 @@ Zotero.Schema = new function(){
|
|||
}
|
||||
}
|
||||
|
||||
var fileName = Zotero.File.getValidFileName(entry.label) + fileExt;
|
||||
var fileName = Zotero.Translators.getFileNameFromLabel(
|
||||
entry.label, translatorID
|
||||
);
|
||||
|
||||
var destFile = destDir.clone();
|
||||
destFile.append(fileName);
|
||||
|
|
@ -876,7 +878,9 @@ Zotero.Schema = new function(){
|
|||
}
|
||||
|
||||
if (mode == 'translator') {
|
||||
var fileName = Zotero.File.getValidFileName(newObj[titleField]) + fileExt
|
||||
var fileName = Zotero.Translators.getFileNameFromLabel(
|
||||
newObj[titleField], newObj.translatorID
|
||||
);
|
||||
}
|
||||
else if (mode == 'style') {
|
||||
var fileName = file.leafName;
|
||||
|
|
|
|||
|
|
@ -1125,7 +1125,7 @@ Zotero.Sync.Server = new function () {
|
|||
catch (e) {
|
||||
Zotero.debug(e);
|
||||
var msg = Zotero.getString('sync.error.loginManagerCorrupted1', Zotero.appName) + "\n\n"
|
||||
+ Zotero.getString('sync.error.loginManagerCorrupted2', Zotero.appName);
|
||||
+ Zotero.getString('sync.error.loginManagerCorrupted2', [Zotero.appName, Zotero.appName]);
|
||||
alert(msg);
|
||||
return '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
},
|
||||
|
||||
"_saveAttachmentFile":function(attachment, parentID, attachmentCallback) {
|
||||
const urlRe = /(([A-Za-z]+):\/\/[^\s]*)/i;
|
||||
const urlRe = /(([a-z][-+\.a-z0-9]*):\/\/[^\s]*)/i; //according to RFC3986
|
||||
Zotero.debug("Translate: Adding attachment", 4);
|
||||
|
||||
if(!attachment.url && !attachment.path) {
|
||||
|
|
@ -228,7 +228,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
if(!attachment.path) {
|
||||
// see if this is actually a file URL
|
||||
var m = urlRe.exec(attachment.url);
|
||||
var protocol = m ? m[2].toLowerCase() : "";
|
||||
var protocol = m ? m[2].toLowerCase() : "file";
|
||||
if(protocol == "file") {
|
||||
attachment.path = attachment.url;
|
||||
attachment.url = false;
|
||||
|
|
@ -294,7 +294,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
var uri = IOService.newURI(path, "", this._baseURI);
|
||||
}
|
||||
catch (e) {
|
||||
var msg = "Error parsing attachment path: " + attachment.path;
|
||||
var msg = "Error parsing attachment path: " + path;
|
||||
Zotero.logError(msg);
|
||||
Zotero.debug("Translate: " + msg, 2);
|
||||
return false;
|
||||
|
|
@ -303,14 +303,14 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
try {
|
||||
var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
|
||||
if (file.path == '/') {
|
||||
var msg = "Error parsing attachment path: " + attachment.path;
|
||||
var msg = "Error parsing attachment path: " + path;
|
||||
Zotero.logError(msg);
|
||||
Zotero.debug("Translate: " + msg, 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
var msg = "Error getting file from attachment path: " + attachment.path;
|
||||
var msg = "Error getting file from attachment path: " + path;
|
||||
Zotero.logError(msg);
|
||||
Zotero.debug("Translate: " + msg, 2);
|
||||
return false;
|
||||
|
|
@ -439,8 +439,13 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
// try to map from base field
|
||||
if(Zotero.ItemFields.isBaseField(fieldID)) {
|
||||
fieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(typeID, fieldID);
|
||||
|
||||
// Skip mapping if item field already exists
|
||||
var fieldName = Zotero.ItemFields.getName(fieldID);
|
||||
if(fieldName !== field && item[fieldName]) continue;
|
||||
|
||||
if(fieldID) {
|
||||
Zotero.debug("Translate: Mapping "+field+" to "+Zotero.ItemFields.getName(fieldID), 5);
|
||||
Zotero.debug("Translate: Mapping "+field+" to "+fieldName, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -455,6 +460,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
},
|
||||
|
||||
"_saveCreators":function(item, newItem) {
|
||||
var creatorIndex = 0;
|
||||
for(var i=0; i<item.creators.length; i++) {
|
||||
var creator = item.creators[i];
|
||||
|
||||
|
|
@ -505,7 +511,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
var creatorID = creator.save();
|
||||
}
|
||||
|
||||
newItem.setCreator(i, creator, creatorTypeID);
|
||||
newItem.setCreator(creatorIndex++, creator, creatorTypeID);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -305,8 +305,14 @@ Zotero.Translators = new function() {
|
|||
* @param {String} label
|
||||
* @return {String}
|
||||
*/
|
||||
this.getFileNameFromLabel = function(label) {
|
||||
return Zotero.File.getValidFileName(label) + ".js";
|
||||
this.getFileNameFromLabel = function(label, alternative) {
|
||||
var fileName = Zotero.Utilities.removeDiacritics(
|
||||
Zotero.File.getValidFileName(label)) + ".js";
|
||||
// Use translatorID if name still isn't ASCII (e.g., Cyrillic)
|
||||
if (alternative && !fileName.match(/^[\x00-\x7f]+$/)) {
|
||||
fileName = alternative + ".js";
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -361,7 +367,9 @@ Zotero.Translators = new function() {
|
|||
throw ("code not provided in Zotero.Translators.save()");
|
||||
}
|
||||
|
||||
var fileName = Zotero.Translators.getFileNameFromLabel(metadata.label);
|
||||
var fileName = Zotero.Translators.getFileNameFromLabel(
|
||||
metadata.label, metadata.translatorID
|
||||
);
|
||||
var destFile = Zotero.getTranslatorsDirectory();
|
||||
destFile.append(fileName);
|
||||
|
||||
|
|
|
|||
|
|
@ -1283,7 +1283,9 @@ Zotero.Utilities = {
|
|||
|
||||
// map from base field if possible
|
||||
if((itemFieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(typeID, fieldID))) {
|
||||
newItem[Zotero.ItemFields.getName(itemFieldID)] = val;
|
||||
var fieldName = Zotero.ItemFields.getName(itemFieldID);
|
||||
// Only map if item field does not exist
|
||||
if(fieldName !== field && !newItem[fieldName]) newItem[fieldName] = val;
|
||||
continue; // already know this is valid
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ sync.error.passwordNotSet = Password not set
|
|||
sync.error.invalidLogin = Invalid username or password
|
||||
sync.error.enterPassword = Please enter a password.
|
||||
sync.error.loginManagerCorrupted1 = Zotero cannot access your login information, likely due to a corrupted %S login manager database.
|
||||
sync.error.loginManagerCorrupted2 = Close %S, back up and delete signons.* from your %S profile, and re-enter your Zotero login information in the Sync pane of the Zotero preferences.
|
||||
sync.error.loginManagerCorrupted2 = Close %1$S, back up and delete signons.* from your %2$S profile, and re-enter your Zotero login information in the Sync pane of the Zotero preferences.
|
||||
sync.error.syncInProgress = A sync operation is already in progress.
|
||||
sync.error.syncInProgress.wait = Wait for the previous sync to complete or restart %S.
|
||||
sync.error.writeAccessLost = You no longer have write access to the Zotero group '%S', and files you've added or edited cannot be synced to the server.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit af463b24e40f0b426a40b55cf5f0d74dcab0d5b0
|
||||
Subproject commit f60972d26e97034438c36ef0e1d7efde3b4205ad
|
||||
Loading…
Add table
Reference in a new issue