View Single Post
Old 12-18-2022, 06:08 AM   #2828
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Wiggo View Post
Unfortunately it doesn't work well.

All books get subtitles (=title), even if there is no colon in the title, and the plugboard changes the title to the subtitle.

If I test
Code:
program:
	list_split($title, ':', 'v_0');
in the template editor the result is always "subtitle", no matter what 'v_n' I fill in.
That template is wrong.

It should be the one below, slightly modified from the one I suggested above because I forgot to initialize v_1. In particular the last line must be there, either v_0 if you want the title or v_1 if you want the subtitle. You can remove the comments (the lines beginning with #).
Code:
program:
	v_1 = '';
	list_split($title, ':', 'v');
# Enter v_0 for the text before the colon, v_1 for the text after the colon
# This doesn't work if the title or subtitle part contains extra colons
# v_1 is empty if there are no colons at all
	v_1
The template you wrote will always return the subtitle if there is one, otherwise it will return the title.
chaley is offline   Reply With Quote