Quote:
Originally Posted by ownedbycats
Thanks 
|
The solution bothered me. Reconstructing the identifier should be easier. I have submitted changes for that.
Once the changes are accepted, this template does the same thing as the previous one. The changes are in the function build_url(). If you call identifier_in_list() with two arguments then it returns the id:val pair, otherwise the empty string. You no longer need to use select() to get the identifier value. Of course, calling it with four arguments behaves as it did before.
Code:
program:
def build_url(id):
v = identifier_in_list($identifiers, id);
if v then urls_from_identifiers(v, 1) & ',' fi
fed;
list_join(
', ',
## trimmed out other lines for length
switch_if(
$publisher=='Archive of Our Own', build_url('ao3') & build_url('ffnet'),
$publisher=='FanFiction.net', build_url('ffnet') & build_url('ao3'),
build_url('ao3') & build_url('ffnet')
), ',',
)