View Single Post
Old 02-21-2023, 06:44 AM   #6
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: 583
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by isarl View Post
The linked post deliberately chooses to use “and” for the last separator, which may affect the metadata parsing on the Kobo (though I haven't tested). Nickel expects the authors to be comma-separated in order to parse them properly and display books under the correct entry in the Authors view of your library. I use the following template, but I also clean up my authors metadata and remove suffices such as “, MD” or “, PhD”. (Otherwise, you end up with an “author” in the Kobo database whose name is literally “MD” or “PhD” or what have you.)

Code:
program: raw_list('authors', ', ')
If you wish to support authors with commas in their names without experiencing the above problem then I suggest finding a character similar to a comma (I will use an @ symbol below as a placeholder, for the sake of example) and doing two substitutions, one to change out author-internal commas, and a second to replace Calibre's default separator of an ampersand with the comma expected by Nickel:

Code:
program: list_join(', ', re($authors, ',', '@'), '&')
Thanks. All of the above has led me to use author_sort as a basis (which I have already set up to turn the likes of "Walter M. Miller, Jr" and "Gardner Dozois (ed.)" into "Miller Jr, Walter M." and "Dozois, Gardner").

So the final result is this:
Quote:
{author_sort:'re(list_re($, '&', '^(.*),(.*?)$', '\2 \1'),'&',' , ')'}
(having found out the hard way that the separating commas need spaces around them -- a comma without spaces seems to be treated as part of the name, and if there is a trailing space it is removed).

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