On Mon, 2011-02-07 at 15:22 +0100, Jiří Pavlovský wrote:
> Hi,
>
> I Have a block like below. It will produce the following output when
> included with the 'collapse' filter.:
>
> "- name1 , name2 , and name 3 en".
[%
# non-destructive copy
# drop .merge if you don't care if it is destructive
authors = COLUMN.list_authors.merge;
first = authors.pop;
IF authors.size > 1;
authors.join(', '); ', and ';
ELSIF authors.size == 1;
authors.shift; ' and ';
END;
first;
%]
Note: In English, we don't use "a, b, and c", but "a, b and c", which
would make the above:
[%
authors = COLUMN.list_authors.merge;
first = authors.pop;
IF authors.size;
authors.join(', '); ' and ';
END;
first;
%]
clint
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates