View Single Post
Old 03-22-2013, 05:08 AM   #4
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You can do what you want using a general program mode template in the plugboard. One statement would use the contains function to pull out text that indicates that the series is already there, and assign the resulting text to a variable. Another statement would "test" the variable. If it is empty then you generate the text you want. If it is not empty then you pass the title through unchanged (or whatever you want to do). The "template" function would be useful when generating the text.

Something like
Code:
program:
	a=contains(field('title'), '\[', 'XX', '');
	test(a,
		field('title'),
		template('{series:||-}{series_index}{title}'))
Of course you could nest the contains into the test instead of assigning the result to a variable.
chaley is offline   Reply With Quote