From f3664a8c6e99cab69eb723c4ee01699ef649af7b Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 23 Mar 2007 13:55:55 +0000 Subject: [PATCH] fix issues with initials with periods --- chrome/content/zotero/xpcom/utilities.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 862574f5c..f2dd558b0 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -45,6 +45,7 @@ Zotero.Utilities.prototype.strToDate = function(date) { /* * Cleans extraneous punctuation off an author name */ +Zotero.Utilities._allCapsRe = /^[A-Z]+$/; Zotero.Utilities.prototype.cleanAuthor = function(author, type, useComma) { if(typeof(author) != "string") { throw "cleanAuthor: author must be a string"; @@ -70,7 +71,7 @@ Zotero.Utilities.prototype.cleanAuthor = function(author, type, useComma) { var firstName = author.substring(0, spaceIndex); } - if(firstName && firstName.toUpperCase() == firstName && + if(firstName && Zotero.Utilities._allCapsRe.test(firstName) && firstName.length <= 4 && lastName.toUpperCase() != lastName) { // first name is probably initials var newFirstName = "";