mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-20 22:12:37 -04:00
When updating EPUB 2 to EPUB 3 ensure only a single dc:date element is present in the OPF
This commit is contained in:
@@ -105,7 +105,10 @@ def upgrade_date(root, data):
|
||||
found = False
|
||||
for date in XPath('./opf:metadata/dc:date')(root):
|
||||
val = date.text
|
||||
if val:
|
||||
if not val:
|
||||
remove_element(date, data.refines)
|
||||
continue
|
||||
if not found:
|
||||
found = True
|
||||
continue
|
||||
if not val or found: # only one dc:date allowed
|
||||
|
||||
Reference in New Issue
Block a user