diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js
index 53a2f9ef1..eefc5f498 100644
--- a/chrome/content/zotero/bibliography.js
+++ b/chrome/content/zotero/bibliography.js
@@ -110,6 +110,11 @@ var Zotero_File_Interface_Bibliography = new function() {
document.getElementById("fields-file-format-notice").textContent = Zotero.getString("integration."+formatOption+".fileFormatNotice");
document.getElementById("bookmarks-file-format-notice").textContent = Zotero.getString("integration.fields.fileFormatNotice");
}
+ if(document.getElementById("storeReferences")) {
+ if(_io.storeReferences || _io.storeReferences === undefined) {
+ document.getElementById("storeReferences").checked = true;
+ }
+ }
// set style to false, in case this is cancelled
_io.style = false;
@@ -157,6 +162,7 @@ var Zotero_File_Interface_Bibliography = new function() {
if(document.getElementById("displayAs")) {
_io.useEndnotes = document.getElementById("displayAs").selectedIndex;
_io.fieldType = (document.getElementById("formatUsing").selectedIndex == 0 ? _io.primaryFieldType : _io.secondaryFieldType);
+ _io.storeReferences = document.getElementById("storeReferences").checked;
}
// save style (this happens only for "Export Bibliography," or Word
diff --git a/chrome/content/zotero/integration/integrationDocPrefs.xul b/chrome/content/zotero/integration/integrationDocPrefs.xul
index c7bc04fcc..f80ee1a13 100644
--- a/chrome/content/zotero/integration/integrationDocPrefs.xul
+++ b/chrome/content/zotero/integration/integrationDocPrefs.xul
@@ -36,7 +36,8 @@
onload="Zotero_File_Interface_Bibliography.init();"
ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- persist="screenX screenY">
+ persist="screenX screenY"
+ style="width: 600px">
@@ -65,5 +66,8 @@
&zotero.integration.prefs.bookmarks.caption;
+
+
+ &zotero.integration.prefs.storeReferences.caption;
\ No newline at end of file
diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js
index 347b39e87..980db1d6d 100644
--- a/chrome/content/zotero/xpcom/cite.js
+++ b/chrome/content/zotero/xpcom/cite.js
@@ -102,13 +102,28 @@ Zotero.Cite.System._quotedRegexp = /^".+"$/;
Zotero.Cite.System._cache = new Object();
Zotero.Cite.System.retrieveItem = function(item){
+ var zoteroItem, slashIndex;
if(item instanceof Zotero.Item) {
//if(this._cache[item.id]) return this._cache[item.id];
- var zoteroItem = item;
+ zoteroItem = item;
} else {
- // is an item ID
- //if(this._cache[item]) return this._cache[item];
- var zoteroItem = Zotero.Items.get(item);
+ var type = typeof item;
+ if(type === "string" && (slashIndex = item.indexOf("/")) !== -1) {
+ // is an embedded item
+ var sessionID = item.substr(0, slashIndex);
+ var session = Zotero.Integration.sessions[sessionID]
+ if(session) {
+ var embeddedCitation = session.embeddedItems[item.substr(slashIndex+1)];
+ if(embeddedCitation) {
+ embeddedCitation.id = item;
+ return embeddedCitation;
+ }
+ }
+ } else {
+ // is an item ID
+ //if(this._cache[item]) return this._cache[item];
+ zoteroItem = Zotero.Items.get(item);
+ }
}
if(!zoteroItem) {
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
index 65515740f..13d27cd25 100644
--- a/chrome/content/zotero/xpcom/integration.js
+++ b/chrome/content/zotero/xpcom/integration.js
@@ -1017,31 +1017,33 @@ Zotero.Integration.Document.JSEnumerator.prototype.getNext = function() {
*/
Zotero.Integration.Session = function() {
// holds items not in document that should be in bibliography
- this.uncitedItems = new Object();
- this.omittedItems = new Object();
- this.customBibliographyText = new Object();
- this.reselectedItems = new Object();
- this.citationIDs = new Object();
+ this.uncitedItems = {};
+ this.omittedItems = {};
+ this.customBibliographyText = {};
+ this.reselectedItems = {};
+ this.citationIDs = {};
}
/**
* Resets per-request variables in the CitationSet
*/
Zotero.Integration.Session.prototype.resetRequest = function(doc) {
- this.citationsByItemID = new Object();
- this.citationsByIndex = new Array();
+ this.citationsByItemID = {};
+ this.citationsByIndex = [];
+ this.embeddedItems = {};
+ this.embeddedItemsByURI = {};
this.uriMap = new Zotero.Integration.URIMap(this);
this.regenerateAll = false;
this.bibliographyHasChanged = false;
this.bibliographyDataHasChanged = false;
- this.updateItemIDs = new Object();
- this.updateIndices = new Object();
- this.newIndices = new Object();
+ this.updateItemIDs = {};
+ this.updateIndices = {};
+ this.newIndices = {};
this.oldCitationIDs = this.citationIDs;
- this.citationIDs = new Object();
- this.citationText = new Object();
+ this.citationIDs = {};
+ this.citationText = {};
this.doc = doc;
}
@@ -1108,6 +1110,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se
io.fieldType = this.data.prefs.fieldType;
io.primaryFieldType = primaryFieldType;
io.secondaryFieldType = secondaryFieldType;
+ io.storeReferences = this.data.prefs.storeReferences;
}
this._displayDialog('chrome://zotero/content/integration/integrationDocPrefs.xul', '', io);
@@ -1119,6 +1122,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se
data.sessionID = oldData.sessionID;
data.style.styleID = io.style;
data.prefs.fieldType = io.fieldType;
+ data.prefs.storeReferences = io.storeReferences;
this.setData(data);
// need to do this after setting the data so that we know if it's a note style
this.data.prefs.noteType = this.style && this.styleClass == "note" ? io.useEndnotes+1 : 0;
@@ -1166,7 +1170,9 @@ Zotero.Integration.Session.prototype.reselectItem = function(exception) {
*/
Zotero.Integration.Session.prototype.getCitationField = function(citation) {
const saveProperties = ["custom", "unsorted"];
- const saveCitationItems = ["locator", "label", "suppress-author", "author-only", "prefix", "suffix", "uri"];
+ const saveCitationItemKeys = ["locator", "label", "suppress-author", "author-only", "prefix",
+ "suffix"];
+ var addSchema = false;
var type;
var field = [];
@@ -1178,15 +1184,52 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) {
field.push('"properties":'+properties);
}
- var citationItems = [];
- for(var j=0; j
+
+
+