Quote:
Originally Posted by ownedbycats
Question: Could a stored template be used to share the same code between a column icon and emblem?
|
Yes.
Quote:
I saved some templates I have in both places (reading_status, kobo_status, and format_icons) but I am not quite sure how to get them to work. The dialog says to use the 'call' function but I think I did it wrong as I just got an error about it being unknown.
|
The documentation is wrong. I will fix it.
You use a stored template just as you use a template function, stored_template_name(args).
If you update source you will see some improvements in the stored template dialog. The most important is there is now a "test" button that opens a subsidiary template tester so you can try the stored template(s) without leaving the preferences dialog.
Example of definition and use of a stored template:
Definition:

The program text:
Code:
program:
arguments(lst='No list argument given', items='');
r = '';
for l in items:
if !r then
r = str_in_list(lst, ',', l, l, '')
fi
rof;
if !r then
r = sublist(list_sort(lst, 0, ','), 0, 1, ',')
fi;
r;
How to call it
Code:
program: list_priority_item($tags, 'foo')