Quote:
Originally Posted by amely
hi
I searched forum and read this whole thread and even though question was asked few times but answers aren't really what I need.
when saving to disk if series index has decimal point (I don't know technical term) I need to switch to different template to save it the way I like or to rename when saved.
How I like series to look is series 01 , series 02 , series 02.10 etc...
to achieve that I use
Code:
{authors}/{series}/{authors} - {series} {series_index:0>2s| | - }{title}
for regular numbers
and
Code:
{authors}/{series}/{authors} - {series} {series_index:0>5.2f| | - }{title}
for decimal ones.
Is there a way to tell calibre to recognise that series index has decimal point and to use second template?
I don't know if it is possible nor how to write that command so any help would be appreciated, even if it is just to say it isn't possible at all.

|
Post 550 gives you the clue -- how to determine if a number (a series index) is an integer or has a decimal point. However, after some thought I came up with a more efficient way to do it. Here is an example template in
General Program Mode:
Code:
program:
no_decimal = template('{authors}/{series}/{authors} - {series} {series_index:0>2s| | - }{title}');
has_decimal = template('{authors}/{series}/{authors} - {series} {series_index:0>5.2f| | - }{title}');
contains(
field('series_index'),
'\.',
has_decimal,
no_decimal)