mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not delete titles in EPUB 3
In EPUB 3 titles are not titles they can be series or sub titles or hobgoblins and we have no well defined way to find out what they are, so just replace the first title and call it quits.
This commit is contained in:
parent
8a1f46a389
commit
aad985ad06
@ -793,11 +793,13 @@ class OPF(object): # {{{
|
||||
def fset(self, val):
|
||||
val = (val or '').strip()
|
||||
titles = self.title_path(self.metadata)
|
||||
if not val or self.package_version < 3:
|
||||
if self.package_version < 3:
|
||||
# EPUB 3 allows multiple title elements containing sub-titles,
|
||||
# series and other things. We all loooove EPUB 3.
|
||||
for title in titles:
|
||||
title.getparent().remove(title)
|
||||
titles = ()
|
||||
if val:
|
||||
titles = self.title_path(self.metadata)
|
||||
title = titles[0] if titles else self.create_metadata_element('title')
|
||||
title.text = re.sub(r'\s+', ' ', unicode(val))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user