View Single Post
Old 02-24-2023, 12:12 PM   #7
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
I think this template might do what you're after, if you're still interested in a template-based solution:

Code:
{title:'sublist($,-1,0,': ')'}
If you wanted another template for the title without the subtitle, you could use:

Code:
{title:'sublist($,0,-1,': ')'}
I included the space following the colon, but I don't think it's actually needed. I'm fairly sure that the sublist() function will trim each each entry after splitting them. Removing the space may result in a more permissive template if it's at all possible that some of your books might have a Title:Subtitle with no separating space.

After testing, the Title one will turn up empty if a title has no colon. Probably fine for the subtitle, but not the title. So I offer this refinement:

Code:
{title:'ifempty(sublist($,0, -1,': '), $)'}

Last edited by isarl; 02-24-2023 at 02:28 PM. Reason: OP asked for LAST colon – I should have used -1, not +1, as the sublist index. Fixed.
isarl is offline   Reply With Quote