diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-14 18:25:18 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-14 18:25:18 +0000 |
| commit | d1c89c3245a2142de24a8697af98ace8b00d667e (patch) | |
| tree | b2c79c6997cdd2368a0416046bb56b1ed31beeb4 | |
| parent | 457b14e82e0b0b0aeaec8b63d75b81cfc96371e3 (diff) | |
Add --styles argument to CLI
| -rw-r--r-- | scripts/mammoth | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/mammoth b/scripts/mammoth index 4de4120..0aeb93d 100644 --- a/scripts/mammoth +++ b/scripts/mammoth @@ -10,9 +10,15 @@ import mammoth def main(): args = _parse_args() + if args.styles is None: + styles = None + else: + with open(args.styles) as styles_fileobj: + styles = styles_fileobj.read() + with _open_output(args.output) as output: with open(args.path, "rb") as docx_fileobj: - result = mammoth.convert_to_html(docx_fileobj) + result = mammoth.convert_to_html(docx_fileobj, styles=styles) for message in result.messages: sys.stderr.write(message.message) sys.stderr.write("\n") @@ -35,6 +41,7 @@ def _parse_args(): parser = argparse.ArgumentParser() parser.add_argument("path") parser.add_argument("output", nargs="?") + parser.add_argument("--styles", required=False) return parser.parse_args() |
