From cbaa443e065841705c8288281368c8e1fd52568b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Feb 2011 13:09:59 -0700 Subject: [PATCH] EPUB Output: Do not set the file-as attribute on title elements in the OPF as the current OPF spec does not support file-as. Instead use a calibre extension to OPF. Fixes #9109 (Calibre Inserts "file-as" for author sort name and title sort name) --- src/calibre/ebooks/oeb/base.py | 2 +- src/calibre/ebooks/oeb/transforms/metadata.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 9389964962..ccc452f1f8 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -515,7 +515,7 @@ class Metadata(object): 'publisher', 'relation', 'rights', 'source', 'subject', 'title', 'type']) CALIBRE_TERMS = set(['series', 'series_index', 'rating', 'timestamp', - 'publication_type']) + 'publication_type', 'title_sort']) OPF_ATTRS = {'role': OPF('role'), 'file-as': OPF('file-as'), 'scheme': OPF('scheme'), 'event': OPF('event'), 'type': XSI('type'), 'lang': XML('lang'), 'id': 'id'} diff --git a/src/calibre/ebooks/oeb/transforms/metadata.py b/src/calibre/ebooks/oeb/transforms/metadata.py index f1ce31f25b..19c209b74d 100644 --- a/src/calibre/ebooks/oeb/transforms/metadata.py +++ b/src/calibre/ebooks/oeb/transforms/metadata.py @@ -18,7 +18,8 @@ def meta_info_to_oeb_metadata(mi, m, log, override_input_metadata=False): if mi.title_sort: if not m.title: m.add('title', mi.title_sort) - m.title[0].file_as = mi.title_sort + m.clear('title_sort') + m.add('title_sort', mi.title_sort) if not mi.is_null('authors'): m.filter('creator', lambda x : x.role.lower() in ['aut', '']) for a in mi.authors: