- closes #700, Update csledit.xul to use new citation API (I think)

- closes #640, Improve user-entered text character handling
- addresses #701, Other CSL issues
- might add support for <text value="(text)"/> (I haven't tested this)
- fixes a bug where the document preferences window would appear when adding the second reference after Firefox or the document had been opened and closed (introduced in r1577)
- fixes a bug in purging deleted citations

again, this has not been tested in OOo or WinWord
This commit is contained in:
Simon Kornblith 2007-08-08 10:02:14 +00:00
parent b78b7eb777
commit 81120865e7
3 changed files with 16 additions and 36 deletions

View File

@ -162,7 +162,7 @@ Zotero.CSL.prototype.createCitation = function(itemSet, items, format, position,
}
var returnString = new Zotero.CSL.FormattedString(this, format);
returnString.append(string.get(), context.layout);
returnString.append(string.get(), context.layout, false, true);
return returnString.get();
}
@ -522,6 +522,8 @@ Zotero.CSL.prototype._processElements = function(item, element, formattedString,
formattedString.concat(newString, child);
dataAppended = true;
}
} else if(child.@value.length()) {
formattedString.append(child.@value.toString(), child);
}
} else if(name == "label") {
var form = child.@form.toString();
@ -766,32 +768,6 @@ Zotero.CSL.Global = new function() {
this.getMonthStrings = getMonthStrings;
this.cleanXML = cleanXML;
this.parseLocales = parseLocales;
// for types
this.typeInheritance = {
"article-magazine":"article",
"article-newspaper":"article",
"article-journal":"article",
"bill":"article",
"figure":"article",
"graphic":"article",
"interview":"article",
"legal-case":"article",
"manuscript":"book",
"map":"article",
"motion picture":"book",
"musical score":"article",
"pamphlet":"book",
"paper-conference":"chapter",
"patent":"article",
"personal communication":"article",
"report":"book",
"song":"article",
"speech":"article",
"thesis":"book",
"treaty":"article",
"webpage":"article",
}
this.ns = "http://purl.org/net/xbiblio/csl";
@ -1293,12 +1269,14 @@ Zotero.CSL.ItemSet.prototype.add = function(items) {
* or item IDs
*/
Zotero.CSL.ItemSet.prototype.remove = function(items) {
Zotero.debug("removing!")
for(var i in items) {
if(items[i] instanceof Zotero.CSL.Item) {
var item = items[i];
} else {
var item = this.itemsById[items[i]];
}
Zotero.debug("old index was "+this.items.indexOf(item))
this.itemsById[item.getID()] = undefined;
this.items.splice(this.items.indexOf(item), 1);
}

View File

@ -302,7 +302,7 @@ Zotero.CSL.Compat.ItemSet.prototype.remove = function(items) {
if(items[i] instanceof Zotero.Item) {
var item = items[i];
} else {
var item = this.itemsById[items[i]];
var item = Zotero.Items.get(i);
}
this.items.splice(this.items.indexOf(item), 1);
}

View File

@ -98,20 +98,21 @@ Zotero.Integration = new function() {
vars[0] = "";
var i = 0;
colonIndex = input.indexOf(":");
var lastIndex = 0;
var colonIndex = input.indexOf(":", lastIndex);
while(colonIndex != -1) {
if(input[colonIndex+1] == ":") { // escaped
vars[i] += input.substr(0, colonIndex+1);
input = input.substr(colonIndex+2);
vars[i] += input.substring(lastIndex, colonIndex+1);
lastIndex = colonIndex+2;
} else { // not escaped
vars[i] += input.substr(0, colonIndex);
vars[i] += input.substring(lastIndex, colonIndex);
i++;
vars[i] = "";
input = input.substr(colonIndex+1);
lastIndex = colonIndex+1;
}
colonIndex = input.indexOf(":");
colonIndex = input.indexOf(":", lastIndex);
}
vars[i] += input;
vars[i] += input.substr(lastIndex);
} else {
var vars = null;
}
@ -778,7 +779,8 @@ Zotero.Integration.CitationFactory.prototype.updateItems = function(citationSet,
if(addedItems.length) {
this.itemSet.add(addedItems);
} else if(missingItems.length || deletedItems.length) {
}
if(missingItems.length || deletedItems.length) {
this.itemSet.remove(missingItems.concat(deletedItems));
}