View Single Post
Old 10-19-2014, 11:10 AM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Hey, BR, thanks for the recommendation. (I was offline for the holidays, and can end up missing a lot of stuff.)

@bittenfig, I thiink this should give you what you want.

title:
Just regex the title and replace ":.*" with nothing.
Code:
program:

strcat(
	'<b>',
	re(
		field('title'),
		':.*$',
		''
	)
)
subtitle:
Use the default template (converted to general program mode) but first check for title-contains-a-colon. If so we use the title and replace "^[^:]*:" with nothing, if not, we continue as we did before. (You can also replace the test block with a blank, or do whatever else you would've otherwise done if the title doesn't have a colon.)
Code:
program:

contains(
	field('title'),
	':',
	re(
		field('title'),
		'^[^:]*:',
		''
	),
	test(
		field('series'),
		strcat(
			'<i>',field('series'),'</i> - ',
			raw_field('formatted_series_index')
		),
		''
	)
)
What do you want done if the title has a subtitle and there is also a series?

Last edited by eschwartz; 10-19-2014 at 11:24 AM.
eschwartz is offline   Reply With Quote