The easiest way to handle this situation is to use a prefix in the template. The prefix is added only if the field is not empty. For example, warning would be
Code:
{#warnings:|Warning: |}
and genre would be
for more explanation, see
Advanced formatting in the user manual.
Of course, it could be done with the test function. For example, the following examples in
template program mode and
general program mode work. However, unless the computation is more complicated than strcat, it isn't worth the trouble.
Code:
{#warnings:'test($, strcat('Warning: ', $), '')'}
or
Code:
program:
v = field('#warnings');
test(v, strcat('Warning: ', v), '')