From b88fcdb8af62a5d1a80a842ba1d5f58a9916076c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Jan 2011 10:39:42 -0700 Subject: [PATCH] Fix #8539 (Author sort default should not put Inc. at the front for companies) --- src/calibre/ebooks/metadata/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 02401b25e6..847d69597c 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -36,9 +36,10 @@ def author_to_author_sort(author): return author author = _bracket_pat.sub('', author).strip() tokens = author.split() - tokens = tokens[-1:] + tokens[:-1] - if len(tokens) > 1 and method != 'nocomma': - tokens[0] += ',' + if tokens[-1] not in ('Inc.', 'Inc'): + tokens = tokens[-1:] + tokens[:-1] + if len(tokens) > 1 and method != 'nocomma': + tokens[0] += ',' return ' '.join(tokens) def authors_to_sort_string(authors):