View Single Post
Old 02-21-2023, 01:55 PM   #19
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: 596
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
“Joe Schmoe, MD” and whose author_sort is set to “Schmoe, Joe, MD”, then it comes out as: “Joe, MD Schmoe”. While this looks odd I guess it will almost your needs since the last name should be detected properly.
Yes, but when I set the author_sort for "special" names like this I set it to "Schmoe, Joe MD" without the extra comma. Since this only affects how it is sorted, and not how it's displayed, it works fine.
Quote:
Simply add an extra re() call to replace commas with something that looks comma-like to you but is treated differently by the software – previously I had used @ as a placeholder, but now that I do a quick search, my first suggestion is Unicode codepoint 0x2e32, “TURNED COMMA”. Here is a turned comma and then a regular comma, for the sake of comparison:
Code:
⸲,
That's a good idea. Not needed at the moment, but I'll bear it in mind.
Quote:
So my refinement to what you've arrived at (which I agree, seems to (very nearly!) capture your desired logic efficiently enough ) is the following:

Code:
{author_sort:'re(re(list_re($, '&', '^([^,]*)(,(.*))?$', '\3 \1'), ',', '⸲'),'&',', ')'}
For a book with authors like “Joe Schmoe, MD & Aesop” (where I have paid attention to tweak Joe's author_sort to be like “Schmoe, Joe, MD”), this template transforms them into: “Joe⸲ MD Schmoe, Aesop” (the first comma is that TURNED COMMA so your Kobo will detect this as two authors: “Joe⸲ MD Schmoe”, and “Aesop”). I've also tested the template on books with single authors and it works fine for them, as well. But I invite you to test it further, given the size of your collection. Edge cases love to sneak in.

Hope that helps more, and good luck!
Thanks!
Phssthpok is offline   Reply With Quote