def __init__(self, document, args): self.document = document self.keep_css_class = args.keep_css_class self.insert_split_marker = args.insert_split_marker self.verbose = args.verbose self.inline_css = args.inline_css fname, _ = os.path.splitext(args.odtfilename) self.htmlfilename = '%s.html' % fname if self.verbose > 0: print(_gt('Output: %s') % self.htmlfilename)
def parse(self): if self.verbose > 0: print(_gt('Parsing: %s') % self.odtfilename) with zipfile.ZipFile(self.odtfilename) as odtfile: tagHandler = TagHandler(self.args) ostr = odtfile.read('styles.xml') parse(BytesIO(ostr), tagHandler) ostr = odtfile.read('content.xml') parse(BytesIO(ostr), tagHandler) generator = HTMLGenerator(tagHandler, self.args) generator.write()