mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More fixes for broken ODT files generated by mk4ht
This commit is contained in:
parent
b4f15bb8ca
commit
26c1fd0689
@ -26,7 +26,7 @@ class Extract(ODF2XHTML):
|
|||||||
if not os.path.exists('Pictures'):
|
if not os.path.exists('Pictures'):
|
||||||
os.makedirs('Pictures')
|
os.makedirs('Pictures')
|
||||||
for name in zf.namelist():
|
for name in zf.namelist():
|
||||||
if name.startswith('Pictures'):
|
if name.startswith('Pictures') and name not in {'Pictures', 'Pictures/'}:
|
||||||
data = zf.read(name)
|
data = zf.read(name)
|
||||||
with open(name, 'wb') as f:
|
with open(name, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
@ -97,6 +97,7 @@ def manifestlist(manifestxml):
|
|||||||
|
|
||||||
inpsrc = InputSource()
|
inpsrc = InputSource()
|
||||||
inpsrc.setByteStream(StringIO(manifestxml))
|
inpsrc.setByteStream(StringIO(manifestxml))
|
||||||
|
parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs
|
||||||
parser.parse(inpsrc)
|
parser.parse(inpsrc)
|
||||||
|
|
||||||
return odhandler.manifest
|
return odhandler.manifest
|
||||||
|
@ -598,6 +598,7 @@ def __loadxmlparts(z, manifest, doc, objectpath):
|
|||||||
|
|
||||||
inpsrc = InputSource()
|
inpsrc = InputSource()
|
||||||
inpsrc.setByteStream(StringIO(xmlpart))
|
inpsrc.setByteStream(StringIO(xmlpart))
|
||||||
|
parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs
|
||||||
parser.parse(inpsrc)
|
parser.parse(inpsrc)
|
||||||
del doc._parsing
|
del doc._parsing
|
||||||
except KeyError, v: pass
|
except KeyError, v: pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user