mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -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:
parent
00de2544a2
commit
d0ea6b31c4
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user