I suggest that you look at the
General Program Mode template language documentation, and also use other templates as a pattern, such as the one I provided in a previous post.
The template you provided:
Code:
program:
if series_sort then
template (series/{author_sort[0]}/{author_sort}/{series}/{series_index:0>3s} - {title}/{author_sort} - {series} - {series_index:0>3s} - {title})
else
template ( single books/{author_sort[0]}/{author_sort:sublist(0,1,&)}/{title}/{author_sort} - {title})
is not sytactically correct. It is missing many quotes that delimit strings and is missing the final "fi" of the if-then-else statement. I also don't know why you are using "if series_sort". I suspect you mean "if series_sort()", but that does the same thing as "if $series" but more slowly.
Here is a corrected version that runs.
Code:
program:
if $series then
template('series/{author_sort[0]}/{author_sort}/{series}/{series_index:0>3s} - {title}/{author_sort} - {series} - {series_index:0>3s} - {title}')
else
template('single books/{author_sort[0]}/{author_sort:sublist(0,1,&)}/{title}/{author_sort} - {title}')
fi