Quote:
Originally Posted by maddz
Well, in the end I created a custom column for the various nominations and used the following template:
{#subseries:|| {#subseries_index} - } {#myshelves} {#hugonominees:|| - {#hugonominees}}
|
As said in the calibre template documentation, don't use subtemplates
Single Function Mode.
Quote:
However, I don't understand why it isn't inserting the hyphen between my shelves and the nominations list when there is an entry in the latter field.
|
Are you are referring to the last expression?
Code:
{#hugonominees:|| - {#hugonominees}}
The expression doesn't make sense to me. It appears to be trying to include #hugonominees twice, with a hyphen between them. And again, the subtemplate shouldn't be used.
I think you want
Code:
{#hugonominees:| - |}
Quote:
Ideally, I want each section to be on a separate line, but I can't figure out newlines in the template language. I am guessing I should use something like character('newline') or \n...
|
The character() function works only in
General Program Mode.
I think this GPM template gets close to what you want.
Code:
program:
# This template produces a three line result.
# Line 1 is the subseries, or - if there isn't one.
# Line 2 is the shelves, or '-' if there aren't any
# Line 3 is the hugo nominees, or '-' if there aren't any
ss = $subseries;
ssi = $subseries_index;
if ss then
ss_res = ss & ' - ' & ssi
else
ss_res = '-'
fi;
shelves = ifempty($#myshelves, '-');
hugo = ifempty($hugonominees, '-');
return ss_res & character('newline') & shelves & character('newline') & hugo