From 574e6197a2a4da0d7e79b5d22bd3a5e6ac60e7e1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 20 Dec 2008 16:16:01 +0000 Subject: [PATCH] Fixes bug in test for quoted string when value is numeric --- chrome/content/zotero/xpcom/csl.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/csl.js b/chrome/content/zotero/xpcom/csl.js index 76560b9166..4f0a4aa0b9 100644 --- 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);