Quote:
Originally Posted by chaley
It says in the single-function section of the manual: "All arguments must be constants; there is no sub-evaluation." Your template is using sub-evaluation because "{isbn}" is inside the series_index template expression.
|
Is it really sub-evaluation? I thought there is no sub-evaluation, because there is no function after ":". All I have is a prefix/suffix which is a field, not an argument of any function.
Quote:
Originally Posted by chaley
The use of template expressions within template expressions is highly unreliable. I consider it a bug that it works at all, and would take it out except that doing so would cause the people for whom it works to yell very loudly. You have hit one of the problems -- expecting { ... } to nest. There are cases where they do not, one of which is references to series_index in save_to_disk templates. In the failure case a { is paired with the nearest }, not with the matching nested }. In other words, the { in front of "series_index" is matched against the } following "isbn", not against the one following the '|' character.
|
This is a weird behavior. I think it should be either taken completely out or implemented completely, or at least documented in the manual.
Quote:
Originally Posted by chaley
You can express the equivalent of {series_index:|{isbn}|}{title} without nesting by using the following " template program mode" template.
Code:
{series_index:'test($, strcat(field('isbn'), $), '')'}{title}
For completeness, an equivalent template in general program mode is
Code:
program:
s = field('series_index');
strcat(test(s, strcat(field('isbn'), s), ''), field('title'))
|
Thanks! I think, I will use the general program mode.