View Single Post
Old 07-25-2014, 06:59 AM   #10
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,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I added a new formatter function "author_links()". It probably will be in next week's release.

The documentation for the function is:
Quote:
author_links(val_separator, pair_separator) -- returns a string containing a list of authors and that author's link values in the form author1 val_separator author1link pair_separator author2 val_separator author2link etc. An author is separated from its link value by the val_separator string with no added spaces. author:linkvalue pairs are separated by the pair_separator string argument with no added spaces. It is up to you to choose separator strings that do not occur in author names or links. An author is included even if the author link is empty.
You would use this new function in a composite column (col built from other cols). In your case where the links are really lists of keywords separated by (I assume) commas, the following template would strip the author names then merge all the keywords into a single list, removing duplicates. I don't know if that is what you want.
Code:
program: 
	list_union(
		'', 
		re(
			list_re(author_links(':', ' & '),
				' & ', 
				'^.*:(.)', 
				'\1'), 
			'&', 
			','),
		',')
EDIT: the new function is in source now and will be in the next calibre release.

EDIT2: If you are up to making a python custom template function, the map from author to the associated link is "mi.author_link_map".

Last edited by chaley; 07-25-2014 at 09:30 AM. Reason: edit: fix when probably available. I thought today was Thursday.
chaley is offline   Reply With Quote