[%-#
# expected args:
# toc - an array with keys: link, stitle, title, abstract, subs
# (subs is optional and includes a similar array)
-%]
[%- numbers = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'] -%]
[%- IF toc.size -%]
[%- IF toc.0.group_title.defined;
SET counter = 0;
FOREACH group = toc;
"Part ${numbers.$counter}: ${group.group_title}";
PROCESS index_toc_section subs=group.subs;
counter = counter + 1;
END;
ELSE;
INCLUDE index_toc_section subs=toc;
END;
-%]
[%- END -%]