commit 574e6197a2a4da0d7e79b5d22bd3a5e6ac60e7e1
parent 9d9d4faffb460726016e3bf92f9cff67036d8f1a
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 20 Dec 2008 16:16:01 +0000
Fixes bug in test for quoted string when value is numeric
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/csl.js b/chrome/content/zotero/xpcom/csl.js
@@ -1824,8 +1824,7 @@ Zotero.CSL.Item.prototype.getVariable = function(variable, form) {
}
for each(var zoteroField in zoteroFields) {
- var value = this.zoteroItem.getField(zoteroField, false, true);
- value = value + '';
+ var value = this.zoteroItem.getField(zoteroField, false, true).toString();
if(value != "") {
// Strip enclosing quotes
if(value.match(Zotero.CSL._quotedRegexp)) {
@@ -1911,7 +1910,7 @@ Zotero.CSL.Item.prototype.getNumericVariable = function(variable, form) {
var matches;
for each(var zoteroField in zoteroFields) {
- var value = this.zoteroItem.getField(zoteroField, false, true);
+ var value = this.zoteroItem.getField(zoteroField, false, true).toString();
// Quoted strings are never numeric
if(value.match(Zotero.CSL._quotedRegexp)) {
@@ -1919,7 +1918,7 @@ Zotero.CSL.Item.prototype.getNumericVariable = function(variable, form) {
}
var matches;
- if(value != "" && (matches = value.toString().match(Zotero.CSL._numberRegexp)) ) {
+ if(value != "" && (matches = value.match(Zotero.CSL._numberRegexp)) ) {
value = matches[0];
if (form == "ordinal") {
return this.makeOrdinal(value);