View Single Post
Old 02-21-2023, 09:02 AM   #10
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 580
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
This is quite surprising to me. You're using author_sort which means you are specifically starting out with Lastname, Firstname. Then you swap around the comma? Aren't you just manually putting them back into Firstname Lastname? If I understand list_re properly, this will also DROP any authors who do not have a comma in their names (which can happen even in author_sort mode – consider mononym authors such as “Ęsop” for instance).

Did you try out the second suggestion from my comment above, using list_join() and re()? If so then what was insufficient about it? (Also, as you can see from my original example, only the trailing space is needed. The commas do not require a space in front.)
No, I'm using author_sort because it's a sanitised version of authors, consisting of "last, first" (with some special values for people with suffixes like Jr on their published names). So I wanted to avoid using the raw names in favour of the sanitised ones. I would then have to replace "," with another delimiter, replace "&" with ",", then put the commas back in. So I did it this way instead for "simpkicity".

When I tried with a trailing space only it didn't seem to work. Maybe I fubared it when I copy/pasted to the plugboard. I'll try it again.

Anyway, what I'm doing with list_re is splitting the list of multiple authors on "&" (NOT on the commas!), reversing "last, first" to "first last" in each case, and then replacing the "&" separators with (space-surrounded) commas. So for example:
Quote:
Walter M. Miller Jr. & Jack C. Haldeman II (ed.)
has as its author_sort string the following:
Quote:
Miller Jr., Walter M. & Haldeman II, Jack C.
(And come to think of it, I could leave the "(ed.)" bit in the author_sort version without affecting the sort order...)

"Miller Jr., Walter M." is then rearranged back to "Walter M. Miller Jr.", "Haldeman II, Jack C." is rearranged back to "Jack C. Haldeman II (ed.)", and the final result is
Quote:
Walter M. Miller Jr. , Jack C. Haldeman II
which givesnthe desired result.

And for single author books, list_re() returns a list of one item, which is then rearranged.

But you're right, it doesn't seem to work for single-name authors. No comma, no match in the RE. Hmm...

Last edited by Phssthpok; 02-21-2023 at 09:06 AM.
Phssthpok is offline   Reply With Quote