www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 998d52ec6d5ac22081217303c987a45ae961c9fd
parent beb77864cb9f002b3950301ac730a9cc428b58de
Author: aurimasv <aurimas.dev@gmail.com>
Date:   Thu,  8 Mar 2012 22:23:07 -0600

Place periods after all initials in first name

Diffstat:
Mchrome/content/zotero/xpcom/utilities.js | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -176,7 +176,23 @@ Zotero.Utilities = { } firstName = newFirstName.substr(1); } - + + //add periods after all the initials + if(firstName) { + var names = firstName.replace(/^[\s\.]+/,'') + .replace(/[\s\,]+$/,'') + //remove spaces surronding any dashes + .replace(/\s*([\u002D\u00AD\u2010-\u2015\u2212\u2E3A\u2E3B])\s*/,'$1') + .split(/[\s\.]+/); + var newFirstName = ''; + for(var i=0, n=names.length; i<n; n++) { + newFirstName += names[i]; + if(names[i].length == 1) newFirstName += '.'; + newFirstName += ' '; + } + firstName = newFirstName.trim(); + } + return {firstName:firstName, lastName:lastName, creatorType:type}; },