When updating EPUB 2 to EPUB 3 ensure only a single dc:date element is present in the OPF

This commit is contained in:
Kovid Goyal 2018-04-21 18:03:00 +05:30
parent 00de2544a2
commit d0ea6b31c4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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