aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mammoth9
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()