View Single Post
Old 05-01-2021, 05:19 PM   #92
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,482
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Thanks

Any ideas why the second part of this template isn't removing the URIs?

Attachment 186872

Code:
program:
	publisher = $publisher;
	ids = $identifiers;
	u = select(ids, 'uri');
	g = select(ids, 'gutenberg');

	if publisher == 'Project Gutenberg' && u != g then
		n = re(u, '^http://www.gutenberg.org/(\d+)', '\1');
		ids = list_union(ids, strcat('gutenberg:', n), ',')
	fi;

	if publisher == 'Project Gutenberg' && u && g then
		ids = list_difference(ids, strcat('uri:', u), ',')
	fi;
	ids
Are you certain that the conditions in the second 'if' are all True, that both 'ids' are set when the template starts? Run it using breakpoints to check (and record) the values.

Also, both conditions check for "publisher == 'Project Gutenberg'". You could test that once and put the other tests as nested ifs.
chaley is offline   Reply With Quote