|
|
Thread Tools | Search this Thread |
07-18-2018, 06:56 PM | #1 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
{author_sort}. How to template-save the author's last name in capital letters?
Hello,
When I am using "saving ebooks to disc", there is a template that I can use to create the file name of that ebook that it is going to be save. Today, I am wondering about the {author_sort}. For example, I have a book where the author is "Aldous Huxley", and the title is "Brave New World". If I use the template "{author_sort}.{title}", the new ebook file name will be: Huxley, Aldous. Brave New World But I would like to have the last name in capital letters. How can I make it to be like this: ??? HUXLEY, Aldous. Brave New World How can I do that? Thanks! Last edited by Latios; 07-19-2018 at 12:38 AM. |
07-22-2018, 03:08 PM | #2 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
has anybody been able to do it or know how to do it?
|
Advert | |
|
10-28-2018, 01:00 AM | #3 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
any luck?? anyone knows??
|
10-28-2018, 01:50 AM | #4 |
null operator (he/him)
Posts: 20,933
Karma: 27620688
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
There are string case changing and string manipulation functions in the Template language, see ==>> Function classification
BR |
10-28-2018, 10:55 PM | #5 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
Thanks!! I have been reading it and trying options.
The only problem is that the command {author_sort} automatically grabs both FirstName and LastName and organizes them like "Huxley, Aldous" So with the string case functions, it looks that I just can do either all capital letters or all lower letters. How can I make ONLY the Last name to be in capital letters like "HUXLEY, Aldous"?? |
Advert | |
|
10-29-2018, 02:15 AM | #6 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Assuming all the author_sort names are in the format "LN, FN", then the following seems to work:
Code:
{author_sort:'strcat(uppercase(list_item($,0,',')),', ',list_item($,1,','))'} And thinking about this, the following will work for those cases as well: Code:
{author_sort:'contains($,",",strcat(uppercase(list_item($,0,",")),", ",list_item($,1,",")),uppercase($))'} |
10-29-2018, 04:39 AM | #7 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
YES, IT WORKS VERY GOOD!
I just tried this one: Code:
{author_sort:'contains($,",",strcat(uppercase(list_item($,0,",")),", ",list_item($,1,",")),uppercase($))'} - MADONNA - HUXLEY, Aldous So good!!! I couldnt even get to this point myself. But now the only problem is when there is more than one author. For example, with two authors: When Author sort's metadata shows: Smith, Sam & Dallas, Ken ...applying the code you gave me, comes up like: SMITH, Sam & Dallas For example, with more than two: When Author sort's metadata shows: Ronald, Alex & Chan, Liu & Tiffany, Megan ...applying the code you gave me, comes up like: RONALD, Alex & Chan It's weird, because it either omits the second author's first name, or also the other authors. I have tried other options, but it is going beyond my knowledge... Last edited by Latios; 10-29-2018 at 04:52 AM. |
10-29-2018, 05:11 PM | #8 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
I think I am getting close how to fix it:
I have modified the code template like this: Code:
{author_sort:'contains($,",",strcat(uppercase(list_item($,0,",")),", ",list_item($,1,","),", ",list_item($,2,","),", ",list_item($,3,",")),uppercase($))'} When Author sort's metadata shows: Smith, Sam & Dallas, Ken ...applying the code you gave me, comes up like: SMITH, Sam & Dallas, Ken For example, with more than two: When Author sort's metadata shows: Ronald, Alex & Chan, Liu & Tiffany, Megan ...applying the code you gave me, comes up like: RONALD, Alex & Chan, Liu & Megan, Tiffany The only thing missing now is to make the second and following last name's author into capital letters. what am I missing? |
10-29-2018, 10:33 PM | #9 | ||
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Quote:
Code:
{author_sort:'contains($,",",strcat(uppercase(list_item($,0,",")),", ",strcat(list_item(list_item($,1,","),0,"&")," & ",uppercase(list_item(list_item($,1,","),1,"&"))),", ",list_item($,2,","),", ",list_item($,3,",")),uppercase($))'} The way to do it is with a template function. To do this: Open the calibre preferences and go to "Template functions"
That seems to work here. There is probably a better way to do it, but, that's what comes to mind at the moment. |
||
10-30-2018, 09:52 AM | #10 | |
Grand Sorcerer
Posts: 11,938
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: list_re_group(field('author_sort'), ' & ', '.', '(.*?)(,|$)(.*)', '{$:uppercase()}') |
|
10-30-2018, 07:51 PM | #11 | |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
I'm not sure if I had read the description of the list_re and list_re_group functions. If I did, they didn't sink in. But, with that example, it's obvious what they do. |
|
10-31-2018, 05:04 AM | #12 |
Grand Sorcerer
Posts: 11,938
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
For completeness, here is the same solution in template program mode instead of general program mode:
Code:
{author_sort:'list_re_group($, ' & ', '.', '(.*?)(,|$)(.*)', '[[$:uppercase()]]')'} |
11-02-2018, 05:56 PM | #13 |
Member
Posts: 14
Karma: 10
Join Date: Jul 2018
Device: Kindle 4
|
@davidfor and @chaley !! IT COMPLETLY WORKS WITH EVERY SITUATION!!
One author, two, three, four... single word authors.. etc etc. nothing else to say but thank you and that you are great!!!! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nicknames - capital vs. small letters | bordovy | Lounge | 41 | 07-27-2015 07:27 PM |
formatting issue re: capital letters go missing! | Russellsstudent | Kindle Formats | 2 | 03-15-2013 09:20 AM |
{author} gives author_sort in template? | Jellby | Calibre | 2 | 01-21-2013 02:25 PM |
FN LN, author_sort, Initials dot, ", Jr", author template? | unboggling | Library Management | 0 | 08-09-2012 08:40 PM |
Chapters are just All Capital letters | kevn57 | Conversion | 4 | 01-18-2012 07:42 PM |