Glad you found template program mode!
Quote:
Originally Posted by Ruskie_it
Here's the logic (I did not find relational operators, otherwise it might have been simpler):
|
The strcmp function provides comparison relationals. The test function provides equality relationals.
Quote:
Therefore, when {series} has a value the whole template will be:
series_name/""/book_title (and calibre will convert it to series_name/book_title)
When {series} has not a value the template will be:
""/author_name/book_title (and calibre, I expect, will convert it to author_name/book_title)
|
I assume that the above is in effect a requirements statement.
First, the /""/ will be converted to //, which will convert to /. As such, there isn't much point in generating it, although it doesn't hurt anything. Second, the test function can be used to test for != '', which eliminates the need for the subfunction by directly testing if series is not empty.
Combining the above with my understanding of your requirements, I think that this template satisfies your requirements.
Code:
{series:'test($, $, field('author_sort'))'}/{series_index:0>2s|| - }{title} - {authors}