More fixes for broken ODT files generated by mk4ht

This commit is contained in:
Kovid Goyal 2013-10-19 10:22:12 +05:30
parent b4f15bb8ca
commit 26c1fd0689
3 changed files with 6 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class Extract(ODF2XHTML):
if not os.path.exists('Pictures'):
os.makedirs('Pictures')
for name in zf.namelist():
if name.startswith('Pictures'):
if name.startswith('Pictures') and name not in {'Pictures', 'Pictures/'}:
data = zf.read(name)
with open(name, 'wb') as f:
f.write(data)

View File

@ -1,17 +1,17 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# 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,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -97,6 +97,7 @@ def manifestlist(manifestxml):
inpsrc = InputSource()
inpsrc.setByteStream(StringIO(manifestxml))
parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs
parser.parse(inpsrc)
return odhandler.manifest

View File

@ -598,6 +598,7 @@ def __loadxmlparts(z, manifest, doc, objectpath):
inpsrc = InputSource()
inpsrc.setByteStream(StringIO(xmlpart))
parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs
parser.parse(inpsrc)
del doc._parsing
except KeyError, v: pass