From dde68a51fee2bac1cf7fc46145e3edb4e7f56bef Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 10 Jul 2011 21:40:08 +0000 Subject: [PATCH] Closes #1859, Author misordering in COinS when rft.au and rft.aulast combine Thanks to Avram for the patch --- chrome/content/zotero/xpcom/openurl.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index 19d630cbf..b70924dce 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -358,14 +358,14 @@ Zotero.OpenURL = new function() { if(complexAu.length && !lastCreator.lastName && !lastCreator.institutional) { lastCreator.lastName = value; } else { - complexAu.push({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor")}); + complexAu.push({lastName:value, creatorType:(key == "rft.aulast" ? "author" : "inventor"), offset:item.creators.length}); } } else if(key == "rft.aufirst" || key == "rft.invfirst") { var lastCreator = complexAu[complexAu.length-1]; if(complexAu.length && !lastCreator.firstName && !lastCreator.institutional) { lastCreator.firstName = value; } else { - complexAu.push({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor")}); + complexAu.push({firstName:value, creatorType:(key == "rft.aufirst" ? "author" : "inventor"), offset:item.creators.length}); } } else if(key == "rft.au" || key == "rft.creator" || key == "rft.contributor" || key == "rft.inventor") { if(key == "rft.contributor") { @@ -439,10 +439,16 @@ Zotero.OpenURL = new function() { } } } + + // To maintain author ordering when complex and simple authors are combined, + // we remember where they were and the correct offsets + var inserted = 0; // combine two lists of authors, eliminating duplicates for(var i=0; i