From e8592b2f9037386385c4b87b6bb55e7fd56d8a6e Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Tue, 26 Apr 2011 19:41:56 +0100 Subject: [PATCH] Make the new author_sort -> author try to split the author_sort into its individual authors, then handle them one by one. --- src/calibre/gui2/metadata/basic_widgets.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index f7872b94b9..35d50c3d66 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -280,11 +280,16 @@ class AuthorSortEdit(EnLineEdit): aus = self.current_val meth = tweaks['author_sort_copy_method'] if aus: - ln, _, rest = aus.partition(',') - if rest: - if meth in ('invert', 'nocomma', 'comma'): - aus = rest.strip() + ' ' + ln.strip() - self.authors_edit.current_val = [aus] + ans = [] + for one in [a.strip() for a in aus.split('&')]: + if not one: + continue + ln, _, rest = one.partition(',') + if rest: + if meth in ('invert', 'nocomma', 'comma'): + one = rest.strip() + ' ' + ln.strip() + ans.append(one) + self.authors_edit.current_val = ans def auto_generate(self, *args): au = unicode(self.authors_edit.text())