www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 723213f11fef05a2ff99218730caf9d418de01c8
parent 695cb4710669a6580a74b28989f06932c9162793
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed,  4 Jul 2012 18:24:17 -0400

Merge branch '3.0'

Conflicts:
	chrome/content/zotero/xpcom/translation/translate_firefox.js
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf

Diffstat:
Mchrome/content/zotero/xpcom/citeproc.js | 113+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
Mchrome/content/zotero/xpcom/connector/translate_item.js | 6+++---
Mchrome/content/zotero/xpcom/translation/translate.js | 13++++++++-----
Mchrome/content/zotero/xpcom/utilities.js | 2+-
Mchrome/content/zotero/xpcom/zotero.js | 2+-
Mresource/schema/repotime.txt | 2+-
6 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js @@ -57,7 +57,7 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.0.351", + PROCESSOR_VERSION: "1.0.353", STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g, STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/, STATUTE_SUBDIV_STRINGS: { @@ -9590,7 +9590,7 @@ CSL.Transform = function (state) { secondary_tok.strings.prefix = " "; } for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) { - if (secondary_tok.decorations[i][0] === '@quotes') { + if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(secondary_tok.decorations[i].join('/')) > -1) { secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1)) } } @@ -9604,7 +9604,7 @@ CSL.Transform = function (state) { tertiary_tok.strings.prefix = " "; } for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) { - if (tertiary_tok.decorations[i][0] === '@quotes') { + if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(tertiary_tok.decorations[i].join('/')) > -1) { tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1)) } } @@ -10531,66 +10531,83 @@ CSL.Util.Dates.year.numeric = function (state, num) { } return (pre + num); }; -CSL.Util.Dates.month = {}; -CSL.Util.Dates.month.numeric = function (state, num) { - if (num) { - num = parseInt(num, 10); - if (num > 12) { - num = ""; +CSL.Util.Dates.normalizeMonth = function (num, useSeason) { + var ret; + if (!num) { + num = 0; + } + num = "" + num; + if (!num.match(/^[0-9]+$/)) { + num = 0; + } + num = parseInt(num, 10); + if (useSeason) { + var res = {stub: "month-", num: num}; + if (res.num < 1 || res.num > 20) { + res.num = 0; + } else if (res.num > 16) { + res.stub = "season-"; + res.num = res.num - 16; + } else if (res.num > 12) { + res.stub = "season-"; + res.num = res.num - 12; + } + ret = res; + } else { + if (num < 1 || num > 12) { + num = 0; } + ret = num; } - var ret = "" + num; return ret; +} +CSL.Util.Dates.month = {}; +CSL.Util.Dates.month.numeric = function (state, num) { + var num = CSL.Util.Dates.normalizeMonth(num); + if (!num) { + num = ""; + } + return num; }; CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) { + var num = CSL.Util.Dates.normalizeMonth(num); if (!num) { - num = 0; - } - num = parseInt(num, 10); - if (num > 12) { - num = 0; - } - num = "" + num; - while (num.length < 2) { - num = "0" + num; + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; + } } - return num.toString(); + return num; }; CSL.Util.Dates.month["long"] = function (state, num) { - var stub = "month-"; - num = parseInt(num, 10); - if (num > 12) { - stub = "season-"; - if (num > 16) { - num = num - 16; - } else { - num = num - 12; + var res = CSL.Util.Dates.normalizeMonth(num, true); + var num = res.num; + if (!num) { + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; } + num = state.getTerm(res.stub + num, "long", 0); } - num = "" + num; - while (num.length < 2) { - num = "0" + num; - } - num = stub + num; - return state.getTerm(num, "long", 0); + return num; }; CSL.Util.Dates.month["short"] = function (state, num) { - var stub = "month-"; - num = parseInt(num, 10); - if (num > 12) { - stub = "season-"; - if (num > 16) { - num = num - 16; - } else { - num = num - 12; + var res = CSL.Util.Dates.normalizeMonth(num, true); + var num = res.num; + if (!num) { + num = ""; + } else { + num = "" + num; + while (num.length < 2) { + num = "0" + num; } + num = state.getTerm(res.stub + num, "short", 0); } - num = "" + num; - while (num.length < 2) { - num = "0" + num; - } - num = "month-" + num; - return state.getTerm(num, "short", 0); + return num; }; CSL.Util.Dates.day = {}; CSL.Util.Dates.day.numeric = function (state, num) { diff --git a/chrome/content/zotero/xpcom/connector/translate_item.js b/chrome/content/zotero/xpcom/connector/translate_item.js @@ -195,7 +195,7 @@ Zotero.Translate.ItemSaver.prototype = { } var me = this; - Zotero.OAuth.createItem({"items":newItems}, null, function(statusCode, response) { + Zotero.API.createItem({"items":newItems}, null, function(statusCode, response) { if(statusCode !== 201) { callback(false, new Error("Save to server failed")); } else { @@ -258,7 +258,7 @@ Zotero.Translate.ItemSaver.prototype = { }); } - Zotero.OAuth.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) { + Zotero.API.createItem({"items":attachmentPayload}, itemKey, function(statusCode, response) { var err; if(statusCode === 201) { try { @@ -430,7 +430,7 @@ Zotero.Translate.ItemSaver.prototype = { Zotero.Translate.ItemSaver._attachmentCallbacks[attachment.id] = function(status, error) { attachmentCallback(attachment, status, error); }; - Zotero.OAuth.uploadAttachment(attachment); + Zotero.API.uploadAttachment(attachment); }, /** diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -1406,7 +1406,6 @@ Zotero.Translate.Base.prototype = { Zotero.debug(string, level); } }, - /** * Generates a string from an exception * @param {String|Exception} error @@ -1416,13 +1415,17 @@ Zotero.Translate.Base.prototype = { if(typeof(error) == "string") { errorString = "\nthrown exception => "+error; } else { + var haveStack = false; for(var i in error) { if(typeof(error[i]) != "object") { + if(i === "stack") haveStack = true; errorString += "\n"+i+' => '+error[i]; } } - if(error) { - errorString += "\nstring => "+error.toString(); + errorString += "\nstring => "+error.toString(); + if(!haveStack && error.stack) { + // In case the stack is not enumerable + errorString += "\nstack => "+error.stack.toString(); } } @@ -1569,7 +1572,7 @@ Zotero.Translate.Web.prototype._translateTranslatorLoaded = function() { }, function(obj) { me._translateRPCComplete(obj) }); } else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER) { var me = this; - Zotero.OAuth.createItem({"url":this.document.location.href.toString()}, null, + Zotero.API.createItem({"url":this.document.location.href.toString()}, null, function(statusCode, response) { me._translateServerComplete(statusCode, response); }); @@ -1618,7 +1621,7 @@ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, r var me = this; this._runHandler("select", response, function(selectedItems) { - Zotero.OAuth.createItem({ + Zotero.API.createItem({ "url":me.document.location.href.toString(), "items":selectedItems }, null, diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -956,7 +956,7 @@ Zotero.Utilities = { }; } - if(!(elements instanceof Array)) elements = [elements]; + if(!("length" in elements)) elements = [elements]; var results = []; for(var i=0, n=elements.length; i<n; i++) { diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -35,7 +35,7 @@ const ZOTERO_CONFIG = { API_URL: 'https://api.zotero.org/', PREF_BRANCH: 'extensions.zotero.', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', - VERSION: "3.5a1.SOURCE" + VERSION: "3.0.8.SOURCE" }; /* diff --git a/resource/schema/repotime.txt b/resource/schema/repotime.txt @@ -1 +1 @@ -2012-05-04 03:15:00 +2012-07-03 23:35:00