- use priority exclusively for translator ordering
- full disambiguation support (including adding additional authors to disambiguate, adding first names, or adding a letter after the year) - brings Zotero into line with current CSL revision - fixes miscellaneous issues with new CSL interpreter - closes #614, Same-Year Citation Suffix problems
This commit is contained in:
parent
8e8bd4dc9c
commit
2615dc9684
|
@ -356,13 +356,13 @@ var Zotero_File_Interface = new function() {
|
||||||
|
|
||||||
var csl = Zotero.Cite.getStyle(style);
|
var csl = Zotero.Cite.getStyle(style);
|
||||||
var itemSet = csl.generateItemSet(items);
|
var itemSet = csl.generateItemSet(items);
|
||||||
var itemIDs = [];;
|
var itemIDs = [];
|
||||||
for (var i=0; i<items.length; i++) {
|
for (var i=0; i<items.length; i++) {
|
||||||
itemIDs.push(items[i]);
|
itemIDs.push(items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add HTML
|
// add HTML
|
||||||
var bibliography = csl.createCitation(itemSet, itemIDs, "HTML", 1, null, null);
|
var bibliography = csl.createCitation(itemSet, itemSet.getItemsByIds(itemIDs), "HTML", 1, null, null);
|
||||||
var str = Components.classes["@mozilla.org/supports-string;1"].
|
var str = Components.classes["@mozilla.org/supports-string;1"].
|
||||||
createInstance(Components.interfaces.nsISupportsString);
|
createInstance(Components.interfaces.nsISupportsString);
|
||||||
str.data = bibliography;
|
str.data = bibliography;
|
||||||
|
@ -370,7 +370,7 @@ var Zotero_File_Interface = new function() {
|
||||||
transferable.setTransferData("text/html", str, bibliography.length*2);
|
transferable.setTransferData("text/html", str, bibliography.length*2);
|
||||||
|
|
||||||
// add text
|
// add text
|
||||||
var bibliography = csl.createCitation(itemSet, itemIDs, "Text", 1, null, null);
|
var bibliography = csl.createCitation(itemSet, itemSet.getItemsByIds(itemIDs), "Text", 1, null, null);
|
||||||
var str = Components.classes["@mozilla.org/supports-string;1"].
|
var str = Components.classes["@mozilla.org/supports-string;1"].
|
||||||
createInstance(Components.interfaces.nsISupportsString);
|
createInstance(Components.interfaces.nsISupportsString);
|
||||||
str.data = bibliography;
|
str.data = bibliography;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -279,14 +279,42 @@ Zotero.CSL.Compat.Global = new function() {
|
||||||
* of items
|
* of items
|
||||||
*/
|
*/
|
||||||
Zotero.CSL.Compat.prototype.generateItemSet = function(items) {
|
Zotero.CSL.Compat.prototype.generateItemSet = function(items) {
|
||||||
Zotero.debug("CSL: preprocessing items");
|
return new Zotero.CSL.Compat.ItemSet(items, this);
|
||||||
|
}
|
||||||
this._ignore = null;
|
|
||||||
|
Zotero.CSL.Compat.ItemSet = function(items, csl) {
|
||||||
|
this.items = [];
|
||||||
|
this.csl = csl;
|
||||||
|
this.add(items);
|
||||||
|
this.resort();
|
||||||
|
}
|
||||||
|
|
||||||
|
Zotero.CSL.Compat.ItemSet.prototype.getItemsByIds = function(ids) {
|
||||||
|
return Zotero.Items.get(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
Zotero.CSL.Compat.ItemSet.prototype.add = function(items) {
|
||||||
|
this.items = this.items.concat(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
Zotero.CSL.Compat.ItemSet.prototype.remove = function(items) {
|
||||||
|
for(var i in items) {
|
||||||
|
if(items[i] instanceof Zotero.Item) {
|
||||||
|
var item = items[i];
|
||||||
|
} else {
|
||||||
|
var item = this.itemsById[items[i]];
|
||||||
|
}
|
||||||
|
this.items.splice(this.items.indexOf(item), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Zotero.CSL.Compat.ItemSet.prototype.resort = function() {
|
||||||
|
var oldDisambiguation = {};
|
||||||
|
|
||||||
// get data necessary to generate citations before sorting
|
// get data necessary to generate citations before sorting
|
||||||
for(var i in items) {
|
for(var i in this.items) {
|
||||||
var item = items[i];
|
var item = this.items[i];
|
||||||
var dateModified = this._getField(item, "dateModified");
|
var dateModified = this.csl._getField(item, "dateModified");
|
||||||
|
|
||||||
if(!item._csl || item._csl.dateModified != dateModified) {
|
if(!item._csl || item._csl.dateModified != dateModified) {
|
||||||
// namespace everything in item._csl so there's no chance of overlap
|
// namespace everything in item._csl so there's no chance of overlap
|
||||||
|
@ -294,34 +322,38 @@ Zotero.CSL.Compat.prototype.generateItemSet = function(items) {
|
||||||
item._csl.dateModified = dateModified;
|
item._csl.dateModified = dateModified;
|
||||||
|
|
||||||
// separate item into authors, editors, translators
|
// separate item into authors, editors, translators
|
||||||
var creators = this._separateItemCreators(item);
|
var creators = this.csl._separateItemCreators(item);
|
||||||
item._csl.authors = creators[0];
|
item._csl.authors = creators[0];
|
||||||
item._csl.editors = creators[1];
|
item._csl.editors = creators[1];
|
||||||
item._csl.translators = creators[2];
|
item._csl.translators = creators[2];
|
||||||
|
|
||||||
// parse date
|
// parse date
|
||||||
item._csl.date = Zotero.CSL.Compat.prototype._processDate(this._getField(item, "date"));
|
item._csl.date = Zotero.CSL.Compat.prototype._processDate(this.csl._getField(item, "date"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear disambiguation and subsequent author substitute
|
// clear disambiguation and subsequent author substitute
|
||||||
if(item._csl.date && item._csl.date.disambiguation) item._csl.date.disambiguation = undefined;
|
if(item._csl.date && item._csl.date.disambiguation) {
|
||||||
|
oldDisambiguation[item.getID()] = item._csl.date.disambiguation;
|
||||||
|
item._csl.date.disambiguation = undefined;
|
||||||
|
}
|
||||||
if(item._csl.subsequentAuthorSubstitute) item._csl.subsequentAuthorSubstitute = undefined;
|
if(item._csl.subsequentAuthorSubstitute) item._csl.subsequentAuthorSubstitute = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort by sort order
|
// sort by sort order
|
||||||
if(this._bib.sortOrder) {
|
if(this.csl._bib.sortOrder) {
|
||||||
Zotero.debug("CSL: sorting items");
|
Zotero.debug("CSL: sorting this.items");
|
||||||
var me = this;
|
var me = this.csl;
|
||||||
items.sort(function(a, b) {
|
this.items.sort(function(a, b) {
|
||||||
return me._compareItem(a, b);
|
return me._compareItem(a, b);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// disambiguate items after preprocessing and sorting
|
// disambiguate this.items after preprocessing and sorting
|
||||||
var usedCitations = new Array();
|
var usedCitations = new Array();
|
||||||
var lastAuthors;
|
var lastAuthors;
|
||||||
|
|
||||||
for(var i in items) {
|
for(var i in this.items) {
|
||||||
var item = items[i];
|
var item = this.items[i];
|
||||||
|
|
||||||
// handle subsequent author substitutes
|
// handle subsequent author substitutes
|
||||||
if(item._csl.authors.length && lastAuthors) {
|
if(item._csl.authors.length && lastAuthors) {
|
||||||
|
@ -340,7 +372,7 @@ Zotero.CSL.Compat.prototype.generateItemSet = function(items) {
|
||||||
lastAuthors = item._csl.authors;
|
lastAuthors = item._csl.authors;
|
||||||
|
|
||||||
// handle (2006a) disambiguation for author-date styles
|
// handle (2006a) disambiguation for author-date styles
|
||||||
if(this.class == "author-date") {
|
if(this.csl.class == "author-date") {
|
||||||
var year = item._csl.date.year;
|
var year = item._csl.date.year;
|
||||||
|
|
||||||
if(authorsAreSame) {
|
if(authorsAreSame) {
|
||||||
|
@ -378,13 +410,17 @@ Zotero.CSL.Compat.prototype.generateItemSet = function(items) {
|
||||||
item._csl.number = i;
|
item._csl.number = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for compatibility, create an itemSet object
|
// see which items have changed
|
||||||
var me = this;
|
var returnItems = [];
|
||||||
itemSet = new Object();
|
for each(var item in this.items) {
|
||||||
itemSet.items = items;
|
if(item._csl.date && item._csl.date.disambiguation) {
|
||||||
itemSet.resort = function() { this.items = me.generateItemSet(items).items };
|
var oldDisambig = oldDisambiguation[item.getID()];
|
||||||
|
if(!oldDisambig || oldDisambig != item._csl.date.disambiguation) {
|
||||||
return itemSet;
|
returnItems += item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.CSL.Compat._locatorTerms = {
|
Zotero.CSL.Compat._locatorTerms = {
|
||||||
|
@ -393,9 +429,7 @@ Zotero.CSL.Compat._locatorTerms = {
|
||||||
l:"line"
|
l:"line"
|
||||||
};
|
};
|
||||||
|
|
||||||
Zotero.CSL.Compat.prototype.createCitation = function(itemSet, ids, format, position, locators, locatorTypes) {
|
Zotero.CSL.Compat.prototype.createCitation = function(itemSet, items, format, position, locators, locatorTypes) {
|
||||||
var items = Zotero.Items.get(ids);
|
|
||||||
|
|
||||||
var string = new Zotero.CSL.Compat.FormattedString(this, format);
|
var string = new Zotero.CSL.Compat.FormattedString(this, format);
|
||||||
if(position == "ibid" || position == "ibid-pages") { // indicates ibid
|
if(position == "ibid" || position == "ibid-pages") { // indicates ibid
|
||||||
var term = this._getTerm("ibid");
|
var term = this._getTerm("ibid");
|
||||||
|
@ -406,7 +440,7 @@ Zotero.CSL.Compat.prototype.createCitation = function(itemSet, ids, format, posi
|
||||||
var locator = locators[0];
|
var locator = locators[0];
|
||||||
|
|
||||||
if(locator) {
|
if(locator) {
|
||||||
var locatorType = Zotero.CSL.Compat._locatorTerms[locatorTypes[0]];
|
var locatorType = locatorTypes[0];
|
||||||
|
|
||||||
// search for elements with the same serialization
|
// search for elements with the same serialization
|
||||||
var element = this._getFieldDefaults("locator");
|
var element = this._getFieldDefaults("locator");
|
||||||
|
@ -429,7 +463,7 @@ Zotero.CSL.Compat.prototype.createCitation = function(itemSet, ids, format, posi
|
||||||
var locatorType = false;
|
var locatorType = false;
|
||||||
var locator = false;
|
var locator = false;
|
||||||
if(locators) {
|
if(locators) {
|
||||||
locatorType = Zotero.CSL.Compat._locatorTerms[locatorTypes[i]];
|
locatorType = locatorTypes[i];
|
||||||
locator = locators[i];
|
locator = locators[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,7 +1122,7 @@ Zotero.CSL.Compat.prototype._processCreators = function(type, element, creators,
|
||||||
|
|
||||||
// check whether to use a serial comma
|
// check whether to use a serial comma
|
||||||
Zotero.debug(child["delimiter-precedes-last"]);
|
Zotero.debug(child["delimiter-precedes-last"]);
|
||||||
if((authorStrings.length == 2 && child["delimiter-precedes-last"] != "always") ||
|
if((authorStrings.length == 2 && (useEtAl || child["delimiter-precedes-last"] != "always")) ||
|
||||||
(authorStrings.length > 2 && child["delimiter-precedes-last"] == "never")) {
|
(authorStrings.length > 2 && child["delimiter-precedes-last"] == "never")) {
|
||||||
var lastString = authorStrings.pop();
|
var lastString = authorStrings.pop();
|
||||||
authorStrings[authorStrings.length-1] = authorStrings[authorStrings.length-1]+" "+lastString;
|
authorStrings[authorStrings.length-1] = authorStrings[authorStrings.length-1]+" "+lastString;
|
||||||
|
|
|
@ -376,9 +376,7 @@ Zotero.Integration.SOAP = new function() {
|
||||||
for(var i=3; i<vars.length; i+=2) {
|
for(var i=3; i<vars.length; i+=2) {
|
||||||
if(vars[i+1] == "X") {
|
if(vars[i+1] == "X") {
|
||||||
// get a new citation for a field with an X
|
// get a new citation for a field with an X
|
||||||
var io = new function() {
|
var io = new function() { this.wrappedJSObject = this; }
|
||||||
this.wrappedJSObject = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
watcher.openWindow(null, 'chrome://zotero/content/addCitationDialog.xul', '',
|
watcher.openWindow(null, 'chrome://zotero/content/addCitationDialog.xul', '',
|
||||||
'chrome,modal'+(Zotero.isWin ? ',popup' : ''), io, true);
|
'chrome,modal'+(Zotero.isWin ? ',popup' : ''), io, true);
|
||||||
|
@ -564,7 +562,7 @@ Zotero.Integration.Session = function(styleID, useEndnotes) {
|
||||||
|
|
||||||
Zotero.Integration.Session.prototype.setStyle = function(styleID) {
|
Zotero.Integration.Session.prototype.setStyle = function(styleID) {
|
||||||
this.styleID = styleID;
|
this.styleID = styleID;
|
||||||
this.citationSet.style = this.citationFactory.style = this.style = Zotero.Cite.getStyle(styleID);
|
this.citationSet.style = this.citationFactory.style = this.style = Zotero.Cite.getStyle(styleID);
|
||||||
this.citationFactory.clearCache();
|
this.citationFactory.clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,104 +702,85 @@ Zotero.Integration.CitationFactory = function(style) {
|
||||||
if(style) this.style = style;
|
if(style) this.style = style;
|
||||||
this.cache = new Object();
|
this.cache = new Object();
|
||||||
this.dateModified = new Object();
|
this.dateModified = new Object();
|
||||||
this.items = new Array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.Integration.CitationFactory.prototype.updateItems = function(citationSet, session, updateCitations) {
|
Zotero.Integration.CitationFactory.prototype.updateItems = function(citationSet, session, updateCitations) {
|
||||||
if(session) {
|
var addedItems = [];
|
||||||
// check to see if an update is really necessary
|
var deletedItems = [];
|
||||||
var regenerateItemList = false;
|
var missingItems = [];
|
||||||
var item, itemID;
|
var updateItems = [];
|
||||||
for(var i in this.items) {
|
var resort = false;
|
||||||
item = this.items[i]
|
|
||||||
itemID = item.getID();
|
|
||||||
|
|
||||||
// see if old items were deleted or changed
|
|
||||||
if(!citationSet.citationsByID[itemID] ||
|
|
||||||
(this.dateModified[itemID] != item.getField("dateModified"))) {
|
|
||||||
regenerateItemList = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!regenerateItemList) {
|
|
||||||
for(var i in citationSet.citationsByID) {
|
|
||||||
// see if new items were added
|
|
||||||
if(!session.citationSet.citationsByID[i]) {
|
|
||||||
regenerateItemList = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// leave if it's not
|
|
||||||
if(!regenerateItemList) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.items = new Array();
|
this.items = new Array();
|
||||||
var updateCheck = new Array();
|
var updateCheck = new Array();
|
||||||
var disambiguation = new Array();
|
var disambiguation = new Array();
|
||||||
|
|
||||||
var missingItems = [];
|
|
||||||
|
|
||||||
for(var i in citationSet.citationsByID) {
|
for(var i in citationSet.citationsByID) {
|
||||||
var item = Zotero.Items.get(i);
|
var item = Zotero.Items.get(i);
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
missingItems.push(i)
|
deletedItems.push(i);
|
||||||
|
resort = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.items.push(item);
|
// see if new items were added
|
||||||
|
if(!session || !this.itemSet || !session.citationSet.citationsByID[i]) {
|
||||||
if(this.dateModified[i] && this.dateModified[i] != item.getField("dateModified")) {
|
addedItems.push(item);
|
||||||
// so that we can update modified this.items
|
resort = true;
|
||||||
updateCheck[i] = true;
|
this.dateModified[i] = item.getField("dateModified", true, true);
|
||||||
}
|
|
||||||
|
|
||||||
if(item._csl && item._csl.date.disambiguation) {
|
|
||||||
// keep track of disambiguation data
|
|
||||||
disambiguation[i] = item._csl.date.disambiguation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.itemSet = this.style.generateItemSet(this.items);
|
if(!this.itemSet) {
|
||||||
|
this.itemSet = this.style.generateItemSet(addedItems);
|
||||||
/*var tempCache = new Object();
|
} else {
|
||||||
for(var i in this.items) {
|
// see if old items were deleted or changed
|
||||||
var itemID = this.items[i].getID();
|
for each(var item in this.itemSet.items) {
|
||||||
this.dateModified[itemID] = this.items[i].getField("dateModified");
|
var itemID = item.getID();
|
||||||
|
|
||||||
|
if(!citationSet.citationsByID[itemID]) {
|
||||||
|
missingItems.push(itemID);
|
||||||
|
resort = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item.zoteroItem && this.dateModified[itemID] != item.zoteroItem.getField("dateModified", true, true)) {
|
||||||
|
// so that we can update modified this.items
|
||||||
|
updateItems.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(session) {
|
if(addedItems.length) {
|
||||||
// check to see if disambiguation has changed
|
this.itemSet.add(addedItems);
|
||||||
if(this.items[i]._csl.date.disambiguation != disambiguation[itemID]) {
|
} else if(missingItems.length || deletedItems.length) {
|
||||||
for each(var citation in citationSet.citationsByID[itemID]) {
|
this.itemSet.remove(missingItems.concat(deletedItems));
|
||||||
updateCitations[citation.index] = true;
|
}
|
||||||
citation.updateText = true;
|
|
||||||
this.cache[citation.serialization] = null;
|
if(resort) {
|
||||||
}
|
var citationChanged = this.itemSet.resort();
|
||||||
} else if(updateCheck[itemID]) {
|
updateItems = updateItems.concat(citationChanged);
|
||||||
// check against cache to see if updated item has changed
|
}
|
||||||
for each(var citation in citationSet.citationsByID[itemID]) {
|
|
||||||
if(this.cache[citation.serializedType][citation.serialization]) {
|
for each(var item in updateItems) {
|
||||||
var citationText = this.getCitation(citation, tempCache);
|
itemID = item.getID();
|
||||||
if(citationText != this.cache[citation.serializedType][citation.serialization]) {
|
this.dateModified[itemID] = item.zoteroItem.getField("dateModified", true, true);
|
||||||
updateCitations[citation.index] = true;
|
|
||||||
citation.updateText = true;
|
for each(var citation in citationSet.citationsByID[itemID]) {
|
||||||
this.cache[citation.serializedType][citation.serialization] = citationText;
|
updateCitations[citation.index] = true;
|
||||||
}
|
citation.updateText = true;
|
||||||
}
|
if(citation.serializedType && citation.serialization) {
|
||||||
|
this.cache[citation.serializedType][citation.serialization] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// TODO: clear missing items from cache?
|
// TODO: clear missing items from cache?
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Zotero.Integration.CitationFactory._locatorMap = {p:"page", g:"paragraph", l:"line"};
|
||||||
Zotero.Integration.CitationFactory.prototype.getCitation = function(citation, usingCache) {
|
Zotero.Integration.CitationFactory.prototype.getCitation = function(citation, usingCache) {
|
||||||
// Return "!" for deleted items
|
// Return "!" for deleted items
|
||||||
for (var i=0; i<citation.itemIDs.length; i++) {
|
for (var i=0; i<citation.itemIDs.length; i++) {
|
||||||
|
@ -816,10 +795,21 @@ Zotero.Integration.CitationFactory.prototype.getCitation = function(citation, us
|
||||||
return usingCache[citation.serializedType][citation.serialization];
|
return usingCache[citation.serializedType][citation.serialization];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.itemSet) {
|
||||||
|
throw "Zotero.Integration.CitationFactory: getCitation called before updateCitations";
|
||||||
|
}
|
||||||
|
|
||||||
citation.loadLocators();
|
citation.loadLocators();
|
||||||
var citationText = this.style.createCitation(this.itemSet, citation.itemIDs, "Integration",
|
// map locators to proper term names
|
||||||
|
var locatorTerms = [];
|
||||||
|
for each(var type in citation.locatorTypes) {
|
||||||
|
locatorTerms.push(Zotero.Integration.CitationFactory._locatorMap[type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var items = this.itemSet.getItemsByIds(citation.itemIDs);
|
||||||
|
var citationText = this.style.createCitation(this.itemSet, items, "Integration",
|
||||||
Zotero.Integration.citationTypes[citation.citationType], citation.locators,
|
Zotero.Integration.citationTypes[citation.citationType], citation.locators,
|
||||||
citation.locatorTypes);
|
locatorTerms);
|
||||||
|
|
||||||
if(!usingCache[citation.serializedType]) {
|
if(!usingCache[citation.serializedType]) {
|
||||||
usingCache[citation.serializedType] = new Object();
|
usingCache[citation.serializedType] = new Object();
|
||||||
|
@ -832,4 +822,5 @@ Zotero.Integration.CitationFactory.prototype.getCitation = function(citation, us
|
||||||
Zotero.Integration.CitationFactory.prototype.clearCache = function() {
|
Zotero.Integration.CitationFactory.prototype.clearCache = function() {
|
||||||
this.cache = new Object();
|
this.cache = new Object();
|
||||||
this.dateModified = new Object();
|
this.dateModified = new Object();
|
||||||
|
this.itemSet = undefined;
|
||||||
}
|
}
|
|
@ -159,7 +159,7 @@ Zotero.Translate.init = function() {
|
||||||
// fetch translator list
|
// fetch translator list
|
||||||
var translators = Zotero.DB.query("SELECT translatorID, translatorType, label, "+
|
var translators = Zotero.DB.query("SELECT translatorID, translatorType, label, "+
|
||||||
"target, detectCode IS NULL as noDetectCode FROM translators "+
|
"target, detectCode IS NULL as noDetectCode FROM translators "+
|
||||||
"ORDER BY target IS NULL, priority, label");
|
"ORDER BY priority, label");
|
||||||
var detectCodes = Zotero.DB.query("SELECT translatorID, detectCode FROM translators WHERE target IS NULL");
|
var detectCodes = Zotero.DB.query("SELECT translatorID, detectCode FROM translators WHERE target IS NULL");
|
||||||
|
|
||||||
Zotero.Translate.cache = new Object();
|
Zotero.Translate.cache = new Object();
|
||||||
|
@ -492,7 +492,7 @@ Zotero.Translate.prototype.getTranslators = function() {
|
||||||
} else {
|
} else {
|
||||||
var sql = "SELECT translatorID, label, target, detectCode IS NULL as "+
|
var sql = "SELECT translatorID, label, target, detectCode IS NULL as "+
|
||||||
"noDetectCode FROM translators WHERE translatorType IN ("+this._numericTypes+") "+
|
"noDetectCode FROM translators WHERE translatorType IN ("+this._numericTypes+") "+
|
||||||
"ORDER BY target IS NULL, priority, label";
|
"ORDER BY priority, label";
|
||||||
var translators = Zotero.DB.query(sql);
|
var translators = Zotero.DB.query(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
310
scrapers.sql
310
scrapers.sql
|
@ -1,4 +1,4 @@
|
||||||
-- 252
|
-- 253
|
||||||
|
|
||||||
-- ***** BEGIN LICENSE BLOCK *****
|
-- ***** BEGIN LICENSE BLOCK *****
|
||||||
--
|
--
|
||||||
|
@ -22,10 +22,10 @@
|
||||||
|
|
||||||
|
|
||||||
-- Set the following timestamp to the most recent scraper update date
|
-- Set the following timestamp to the most recent scraper update date
|
||||||
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-07-31 19:40:00'));
|
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-08-04 23:15:00'));
|
||||||
|
|
||||||
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-06-21 20:00:00', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
|
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-06-21 20:00:00', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
|
||||||
'function detectWeb(doc, url) {
|
'function detectWeb(doc, url) {
|
||||||
|
|
||||||
var suffixRe = new RegExp("https?://(?:www\.)?amazon\.([^/]+)/");
|
var suffixRe = new RegExp("https?://(?:www\.)?amazon\.([^/]+)/");
|
||||||
var suffixMatch = suffixRe.exec(url);
|
var suffixMatch = suffixRe.exec(url);
|
||||||
|
@ -6593,7 +6593,7 @@ function doSearch(item) {
|
||||||
lookupPMIDs([getPMID(item.contextObject)]);
|
lookupPMIDs([getPMID(item.contextObject)]);
|
||||||
}');
|
}');
|
||||||
|
|
||||||
REPLACE INTO translators VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '1.0.0b3.r1', '', '2006-12-12 23:41:00', 1, 100, 4, 'Embedded RDF', 'Simon Kornblith', NULL,
|
REPLACE INTO translators VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '1.0.0b3.r1', '', '2007-08-04 23:15:00', 1, 400, 4, 'Embedded RDF', 'Simon Kornblith', NULL,
|
||||||
'function detectWeb(doc, url) {
|
'function detectWeb(doc, url) {
|
||||||
var metaTags = doc.getElementsByTagName("meta");
|
var metaTags = doc.getElementsByTagName("meta");
|
||||||
|
|
||||||
|
@ -6647,7 +6647,7 @@ REPLACE INTO translators VALUES ('951c027d-74ac-47d4-a107-9c3069ab7b48', '1.0.0b
|
||||||
rdf.doImport();
|
rdf.doImport();
|
||||||
}');
|
}');
|
||||||
|
|
||||||
REPLACE INTO translators VALUES ('05d07af9-105a-4572-99f6-a8e231c0daef', '1.0.0b3.r1', '', '2006-12-15 03:40:00', 1, 100, 4, 'COinS', 'Simon Kornblith', NULL,
|
REPLACE INTO translators VALUES ('05d07af9-105a-4572-99f6-a8e231c0daef', '1.0.0b3.r1', '', '2007-08-04 23:15:00', 1, 300, 4, 'COinS', 'Simon Kornblith', NULL,
|
||||||
'function detectWeb(doc, url) {
|
'function detectWeb(doc, url) {
|
||||||
var spanTags = doc.getElementsByTagName("span");
|
var spanTags = doc.getElementsByTagName("span");
|
||||||
|
|
||||||
|
@ -6824,7 +6824,7 @@ function doWeb(doc, url) {
|
||||||
}
|
}
|
||||||
}');
|
}');
|
||||||
|
|
||||||
REPLACE INTO translators VALUES ('e7e01cac-1e37-4da6-b078-a0e8343b0e98', '1.0.0b4.r1', '', '2007-03-20 17:50:13', '1', '90', '4', 'unAPI', 'Simon Kornblith', '',
|
REPLACE INTO translators VALUES ('e7e01cac-1e37-4da6-b078-a0e8343b0e98', '1.0.0b4.r1', '', '2007-08-04 23:15:00', '1', '200', '4', 'unAPI', 'Simon Kornblith', '',
|
||||||
'var RECOGNIZABLE_FORMATS = ["mods", "marc", "endnote", "ris", "bibtex", "rdf"];
|
'var RECOGNIZABLE_FORMATS = ["mods", "marc", "endnote", "ris", "bibtex", "rdf"];
|
||||||
var FORMAT_GUIDS = {
|
var FORMAT_GUIDS = {
|
||||||
"mods":"0e2235e7-babf-413c-9acf-f27cce5f059c",
|
"mods":"0e2235e7-babf-413c-9acf-f27cce5f059c",
|
||||||
|
@ -15598,156 +15598,156 @@ function doExport() {
|
||||||
}
|
}
|
||||||
}');
|
}');
|
||||||
|
|
||||||
REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2007-07-14 22:56:53', 'American Psychological Association',
|
REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2007-08-04 23:15:00', 'American Psychological Association',
|
||||||
'<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
|
'<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
|
||||||
<info>
|
<info>
|
||||||
<title>American Psychological Association</title>
|
<title>American Psychological Association</title>
|
||||||
<id>http://purl.org/net/xbiblio/csl/styles/apa.csl</id>
|
<id>http://purl.org/net/xbiblio/csl/styles/apa.csl</id>
|
||||||
<link>http://purl.org/net/xbiblio/csl/styles/apa.csl</link>
|
<link>http://purl.org/net/xbiblio/csl/styles/apa.csl</link>
|
||||||
<author>
|
<author>
|
||||||
<name>Simon Kornblith</name>
|
<name>Simon Kornblith</name>
|
||||||
<email>simon@simonster.com</email>
|
<email>simon@simonster.com</email>
|
||||||
</author>
|
</author>
|
||||||
<category term="psychology"/>
|
<category term="psychology"/>
|
||||||
<category term="generic-base"/>
|
<category term="generic-base"/>
|
||||||
<updated>2007-07-11T14:27:56+08:00</updated>
|
<updated>2007-08-04T15:15:00+08:00</updated>
|
||||||
</info>
|
</info>
|
||||||
<macro name="editor-translator">
|
<macro name="editor-translator">
|
||||||
<names variable="editor translator" prefix="(" suffix=")" delimiter=", ">
|
<names variable="editor translator" prefix="(" suffix=")" delimiter=", ">
|
||||||
<name and="symbol" initialize-with="." delimiter=", "/>
|
<name and="symbol" initialize-with="." delimiter=", "/>
|
||||||
<label form="short" prefix=", " text-transform="capitalize" suffix="."/>
|
<label form="short" prefix=", " text-transform="capitalize" suffix="."/>
|
||||||
</names>
|
</names>
|
||||||
</macro>
|
</macro>
|
||||||
<macro name="author">
|
<macro name="author">
|
||||||
<names variable="author">
|
<names variable="author">
|
||||||
<name name-as-sort-order="all" and="symbol"
|
<name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with="."
|
||||||
sort-separator=", " initialize-with="." delimiter=", "
|
delimiter=", " delimiter-precedes-last="always"/>
|
||||||
delimiter-precedes-last="always"/>
|
<label form="short" prefix=" (" suffix=".)" text-transform="capitalize"/>
|
||||||
<label form="short" prefix=" (" suffix=".)" text-transform="capitalize"/>
|
<substitute>
|
||||||
<substitute>
|
<names variable="editor"/>
|
||||||
<names variable="editor"/>
|
<names variable="translator"/>
|
||||||
<names variable="translator"/>
|
<text macro="title"/>
|
||||||
<text macro="title"/>
|
</substitute>
|
||||||
</substitute>
|
</names>
|
||||||
</names>
|
</macro>
|
||||||
</macro>
|
<macro name="author-short">
|
||||||
<macro name="author-short">
|
<names variable="author">
|
||||||
<names variable="author">
|
<name form="short" and="symbol" delimiter=", " initialize-with="."/>
|
||||||
<name form="short" and="symbol" delimiter=", "
|
<substitute>
|
||||||
initialize-with="."/>
|
<names variable="editor"/>
|
||||||
<substitute>
|
<names variable="translator"/>
|
||||||
<names variable="editor"/>
|
<choose>
|
||||||
<names variable="translator"/>
|
<if type="book">
|
||||||
<choose>
|
<text variable="title" form="short" font-style="italic"/>
|
||||||
<if type="book">
|
</if>
|
||||||
<text variable="title" form="short" font-style="italic"/>
|
<else>
|
||||||
</if>
|
<text variable="title" form="short" quotes="true"/>
|
||||||
<else>
|
</else>
|
||||||
<text variable="title" form="short" quotes="true"/>
|
</choose>
|
||||||
</else>
|
</substitute>
|
||||||
</choose>
|
</names>
|
||||||
</substitute>
|
</macro>
|
||||||
</names>
|
<macro name="access">
|
||||||
</macro>
|
<group>
|
||||||
<macro name="access">
|
<text term="retrieved" text-transform="capitalize" suffix=" "/>
|
||||||
<group>
|
<date variable="accessed" suffix=", ">
|
||||||
<text term-name="retrieved" text-transform="capitalize" suffix=" "/>
|
<date-part name="month" suffix=" "/>
|
||||||
<date variable="accessed" suffix=", ">
|
<date-part name="day" suffix=", "/>
|
||||||
<date-part name="month" suffix=" "/>
|
<date-part name="year"/>
|
||||||
<date-part name="day" suffix=", "/>
|
</date>
|
||||||
<date-part name="year"/>
|
<group>
|
||||||
</date>
|
<text term="from" suffix=" "/>
|
||||||
<group>
|
<text variable="URL"/>
|
||||||
<text term-name="from" suffix=" "/>
|
</group>
|
||||||
<text variable="URL"/>
|
</group>
|
||||||
</group>
|
</macro>
|
||||||
</group>
|
<macro name="title">
|
||||||
</macro>
|
<choose>
|
||||||
<macro name="title">
|
<if type="book">
|
||||||
<choose>
|
<text variable="title" font-style="italic"/>
|
||||||
<if type="book">
|
</if>
|
||||||
<text variable="title" font-style="italic"/>
|
<else>
|
||||||
</if>
|
<text variable="title"/>
|
||||||
<else>
|
</else>
|
||||||
<text variable="title"/>
|
</choose>
|
||||||
</else>
|
</macro>
|
||||||
</choose>
|
<macro name="publisher">
|
||||||
</macro>
|
<group delimiter=": ">
|
||||||
<macro name="publisher">
|
<text variable="publisher-place"/>
|
||||||
<group delimiter=": ">
|
<text variable="publisher"/>
|
||||||
<text variable="published-place"/>
|
</group>
|
||||||
<text variable="publisher"/>
|
</macro>
|
||||||
</group>
|
<citation>
|
||||||
</macro>
|
<option name="et-al-min" value="6"/>
|
||||||
<citation>
|
<option name="et-al-use-first" value="6"/>
|
||||||
<option name="et-al-min" value="6"/>
|
<option name="et-al-subsequent-min" value="6"/>
|
||||||
<option name="et-al-use-first" value="6"/>
|
<option name="et-al-subsequent-use-first" value="1"/>
|
||||||
<option name="et-al-subsequent-min" value="6"/>
|
<option name="disambiguate-add-year-suffix" value="true"/>
|
||||||
<option name="et-al-subsequent-use-first" value="1"/>
|
<option name="disambiguate-add-names" value="true"/>
|
||||||
<layout prefix="(" suffix=")" delimiter="; ">
|
<option name="disambiguate-add-givenname" value="true"/>
|
||||||
<text macro="author-short"/>
|
<layout prefix="(" suffix=")" delimiter="; ">
|
||||||
<date variable="published" prefix=", ">
|
<text macro="author-short"/>
|
||||||
<date-part name="year"/>
|
<date variable="issued" prefix=", ">
|
||||||
</date>
|
<date-part name="year"/>
|
||||||
<locator prefix=": "/>
|
</date>
|
||||||
</layout>
|
<text variable="locator" prefix=": "/>
|
||||||
</citation>
|
</layout>
|
||||||
<bibliography>
|
</citation>
|
||||||
<option name="hanging-indent" value="true"/>
|
<bibliography>
|
||||||
<option name="sort-algorithm" value="author-date"/>
|
<option name="hanging-indent" value="true"/>
|
||||||
<option name="et-al-min" value="6"/>
|
<option name="sort-algorithm" value="author-date"/>
|
||||||
<option name="et-al-use-first" value="6"/>
|
<option name="et-al-min" value="6"/>
|
||||||
<option name="disambiguate-year-suffix" value="true"/>
|
<option name="et-al-use-first" value="6"/>
|
||||||
<option name="disambiguate-add-givenname" value="true"/>
|
<layout>
|
||||||
<option name="disambiguate-add-names" value="true"/>
|
<text macro="author" suffix="."/>
|
||||||
<layout>
|
<date variable="issued" prefix=" (" suffix=").">
|
||||||
<text macro="author" suffix="."/>
|
<date-part name="year"/>
|
||||||
<date variable="published" prefix=" (" suffix=").">
|
</date>
|
||||||
<date-part name="year"/>
|
<choose>
|
||||||
</date>
|
<if type="book">
|
||||||
<choose>
|
<group suffix=".">
|
||||||
<if type="book">
|
<text macro="title" prefix=" "/>
|
||||||
<group suffix=".">
|
<text macro="editor-translator" prefix=" "/>
|
||||||
<text macro="title" prefix=" "/>
|
</group>
|
||||||
<text macro="editor-translator" prefix=" "/>
|
<text prefix=" " suffix="." macro="publisher"/>
|
||||||
</group>
|
</if>
|
||||||
<text prefix=" " suffix="." macro="publisher"/>
|
<else-if type="chapter">
|
||||||
</if>
|
<text macro="title" prefix=" "/>
|
||||||
<else-if type="chapter">
|
<group class="container" prefix=". ">
|
||||||
<text macro="title" prefix=" "/>
|
<text term="in" text-transform="capitalize"/>
|
||||||
<group class="container" prefix=". ">
|
<names variable="editor translator" prefix=" " suffix="," delimiter=", ">
|
||||||
<text term-name="in" text-transform="capitalize"/>
|
<name and="symbol" sort-separator=", " initialize-with="."/>
|
||||||
<names variable="editor translator" prefix=" " suffix="," delimiter=", ">
|
<label form="short" prefix=" (" suffix=".)" text-transform="capitalize"/>
|
||||||
<name and="symbol" sort-separator=", " initialize-with="."/>
|
</names>
|
||||||
<label form="short" prefix=" (" suffix=".)" text-transform="capitalize"/>
|
<text variable="container-title" font-style="italic" prefix=" " suffix="."/>
|
||||||
</names>
|
<text variable="collection-title" prefix=" " suffix="."/>
|
||||||
<text variable="container-title" font-style="italic" prefix=" " suffix="."/>
|
<group suffix=".">
|
||||||
<text variable="collection-title" prefix=" " suffix="."/>
|
<text macro="publisher" prefix=" "/>
|
||||||
<group suffix=".">
|
<group prefix=" (" suffix=")">
|
||||||
<text macro="publisher" prefix=" "/>
|
<label variable="page" form="short" suffix=". "/>
|
||||||
<group prefix=" (" suffix=")">
|
<text variable="page"/>
|
||||||
<text term-name="page" plural="true" form="short" suffix=". "/>
|
</group>
|
||||||
<text variable="pages"/>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</else-if>
|
||||||
</group>
|
<else>
|
||||||
</else-if>
|
<group suffix=".">
|
||||||
<else>
|
<text macro="title" prefix=" "/>
|
||||||
<group suffix=".">
|
<text macro="editor-translator" prefix=" "/>
|
||||||
<text macro="title" prefix=" "/>
|
</group>
|
||||||
<text macro="editor-translator" prefix=" "/>
|
<group class="container" prefix=" " suffix=".">
|
||||||
</group>
|
<text variable="container-title" font-style="italic"/>
|
||||||
<group class="container" prefix=" " suffix=".">
|
<group prefix=", ">
|
||||||
<text variable="container-title" font-style="italic"/>
|
<text variable="volume" font-style="italic"/>
|
||||||
<text variable="volume" prefix=", " font-style="italic"/>
|
<text variable="issue" prefix="(" suffix=")"/>
|
||||||
<text variable="issue" prefix="(" suffix=")"/>
|
</group>
|
||||||
<text variable="pages" prefix=", "/>
|
<text variable="page" prefix=", "/>
|
||||||
</group>
|
</group>
|
||||||
</else>
|
</else>
|
||||||
</choose>
|
</choose>
|
||||||
<text prefix=" " macro="access"/>
|
<text prefix=" " macro="access"/>
|
||||||
</layout>
|
</layout>
|
||||||
</bibliography>
|
</bibliography>
|
||||||
</style>');
|
</style>');
|
||||||
|
|
||||||
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2007-04-25 23:40:00', 'Chicago Manual of Style (Author-Date)',
|
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2007-04-25 23:40:00', 'Chicago Manual of Style (Author-Date)',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user