View Single Post
Old 06-17-2025, 07:11 AM   #846
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This isn't as repetitive, but is a bit harder to understand.
Code:
program: 
	def add_icon_name(res, fmt):
		return res & 'formats_' & fmt & '.png:'
	fed;

	result = '';
	formats = approximate_formats();
	formats_for_book = list_intersection('azw3, cbz, epub, html, mobi, paperbook, pdf, txt', formats, ',');
	for format in formats_for_book:
		result = add_icon_name(result, format)
	rof;
	if "(overdrive|paperloan)" inlist formats then result = add_icon_name(result, 'overdrive') fi;
	if list_difference(formats, formats_for_book & ',overdrive,paperloan', ',') then
		result = add_icon_name(result, 'unknown')
	fi;
	re(result, ':$', '')
chaley is offline   Reply With Quote