View Single Post
Old 05-09-2023, 01:36 PM   #623
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,477
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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')
		), ',',
	)
chaley is offline   Reply With Quote