View Single Post
Old 05-05-2014, 11:28 AM   #4
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)
No big deal, it works just fine here too. But the other thread is handy since I and several other template gurus are subscribed already, so we are sure to see questions.

To answer your question, template programming mode (that's where we get to use functions) looks like this:
Code:
{fieldname:formatting:'function(arguments)'|prefix|suffix}
The four sections -- metadata field, formatting, function(s), and prefix-suffix pair -- are each optional. The ":" divides each section (except the last). The one after "fieldname" is required, even if there is no fieldname, if anyhing other than "{fieldname}" is being used. So if you just use a function, you need to begin with ":" -- same goes with separating the fieldname and prefix-suffix (even though normally there is no separator).

".1" is formatting, so you will want to use
Code:
{series:.1:'ifempty($, field("title"))'}/{series}{series_index:| [|] - }{title} ({authors})
I took the liberty of making the brackets space and hyphen around the series_index dependent on there being one, by using a prefix-suffix pair.

Last edited by eschwartz; 05-19-2014 at 11:05 AM. Reason: template typo -- thanks, chaley!
eschwartz is offline   Reply With Quote