#!/usr/bin/env python3 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from msodumper import globals, docstream import sys if not globals.PY3: sys = reload(sys) sys.setdefaultencoding("utf-8") class DOCDumper: def __init__(self, filepath, params): self.filepath = filepath self.params = params def dump(self): file = open(self.filepath, 'rb') strm = docstream.createDOCFile(file.read(), self.params) file.close() dirnames = strm.getDirectoryNames() print('\n' % strm.getName()) if strm.error: print('' % strm.error) for dirname in dirnames: if len(dirname) == 0 or dirname in [b'Root Entry']: continue strm.getDirectoryStreamByName(dirname).dump() print('') def main(args): params = globals.Params() dumper = DOCDumper(args[1], params) dumper.dump() if __name__ == '__main__': main(sys.argv) # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: