diff --git a/ebook_converter/ebooks/odt/input.py b/ebook_converter/ebooks/odt/input.py index a0708f0..54dc462 100644 --- a/ebook_converter/ebooks/odt/input.py +++ b/ebook_converter/ebooks/odt/input.py @@ -14,6 +14,7 @@ from odf.draw import Frame as odFrame, Image as odImage from odf.namespaces import TEXTNS as odTEXTNS from ebook_converter.utils import directory +from ebook_converter.ebooks.oeb import parse_utils from ebook_converter.ebooks.oeb.base import _css_logger from ebook_converter import polyglot @@ -21,7 +22,7 @@ from ebook_converter import polyglot class Extract(ODF2XHTML): - def extract_pictures(self, zf): + def _extract_pictures(self, zf): if not os.path.exists('Pictures'): os.makedirs('Pictures') for name in zf.namelist(): @@ -31,8 +32,8 @@ class Extract(ODF2XHTML): with open(name, 'wb') as f: f.write(data) - def apply_list_starts(self, root, log): - if not self.list_starts: + def _apply_list_starts(self, root, log): + if not hasattr(self, "list_starts") or not self.list_starts: return list_starts = frozenset(self.list_starts) for ol in root.xpath('//*[local-name() = "ol" and @class]'): @@ -47,7 +48,7 @@ class Extract(ODF2XHTML): self.filter_css(root, log) self.extract_css(root, log) self.epubify_markup(root, log) - self.apply_list_starts(root, log) + self._apply_list_starts(root, log) html = etree.tostring(root, encoding='utf-8', xml_declaration=True) return html @@ -85,22 +86,21 @@ class Extract(ODF2XHTML): return rule def epubify_markup(self, root, log): - from ebook_converter.ebooks.oeb.base import XPath, XHTML # Fix empty title tags - for t in XPath('//h:title')(root): + for t in parse_utils.XPath('//h:title')(root): if not t.text: t.text = u' ' # Fix