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)
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
|
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
# License as published by the Free Software Foundation; either
|
# License as published by the Free Software Foundation; either
|
||||||
# version 2.1 of the License, or (at your option) any later version.
|
# version 2.1 of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This library is distributed in the hope that it will be useful,
|
# This library is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# Lesser General Public License for more details.
|
# Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# License along with this library; if not, write to the Free Software
|
# License along with this library; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
@ -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