Quote:
Originally Posted by eschwartz
|
So, for this it looks like I'd simply make a custom column with a template written as a GPM such that the column would simply contain the desired end product, right? In order to do this, it seems I need to input a multi-line program in the Template field of a custom column? Because my Calibre only seems to give me a single line edit field, and if I paste a multiline snippet in it still becomes a single line.
Edit: Ah, I think I've got it. Add more tabs, then paste.
Edit2: nope, that still chokes on anything more than 1 line.
Edit3: The most obvious way to go seemed to be:
Code:
program:
f_s = field('#format_str')
f_s.format(str(field('series_index'))
return f_s
But that gives me a template error, quite possibly simply because it's multiple lines. I've also tried a bunch of variants including a one-liner:
Code:
program:
str(field('#format_str').format(field('series_index')))
(the wrapping str() was a desperation move)
Which also doesn't work. The only moderately complex one I;ve gotten to give me anything was one from the docs:
Code:
program:
strcat(
re(field('series'), '([^\s])[^\s]+(\s|$)', '\1'),
finish_formatting(field('series_index'), '0>2s', ' - ', ' - '),
field('title')
)
But that, being a single function call, is of course a plausible one-liner.