Quote:
Originally Posted by capink
Unfortunatly, this is not possible. Custom columns in calibre do not support ampersands as a separator. I opened a bug report a while back about this issue, but it was not addressed because of technical difficulties.
The solution for your problem is to do away with ampersands as separator and fall back to using commas. You can do this by modifying the template function as below
Code:
def evaluate(self, formatter, kwargs, mi, locals, val, col_name, user_cat_prefix):
new_val = ''
if hasattr(mi, '_proxy_metadata'):
all_cats = mi._proxy_metadata.user_categories
cats = {k:v for k,v in all_cats.items() if k.startswith(user_cat_prefix)}
SEP = mi.metadata_for_field(col_name)['is_multiple'].get('list_to_ui', '')
new_val = set()
if SEP:
val_ = val.split(SEP)
else:
val_ = [val]
for user_cat, v in cats.items():
repl = user_cat.lstrip(user_cat_prefix)
for user_cat_item, src_cat in v:
if src_cat == col_name:
for item in val_[:]:
if item == user_cat_item:
new_val.add(repl)
val_.remove(item)
else:
new_val.add(item)
if new_val:
return ', '.join(list(new_val))
return val
Note, however, that this will break author names with commas in them.
|
Unfortunately the problem is back. Two names separated by "&" are treated as one again
Edit: Nevermind. I swapped to this method, which works a bit better in my eyes.
https://www.mobileread.com/forums/sh...77#post4333077