From 85cc3f93c01312a907fd017d34bc2e5542cac670 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 14 Dec 2013 17:33:13 +0000 Subject: Plumbing to get full stack working --- mammoth/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'mammoth/__init__.py') diff --git a/mammoth/__init__.py b/mammoth/__init__.py index 92278f7..3c212ac 100644 --- a/mammoth/__init__.py +++ b/mammoth/__init__.py @@ -1,6 +1,17 @@ from .results import Result -from . import docx, conversion +from . import docx, conversion, style_reader def convert_to_html(fileobj): - return docx.read(fileobj).bind(conversion.convert_document_element_to_html) + return docx.read(fileobj).bind(lambda document: + conversion.convert_document_element_to_html(document, styles=_create_default_styles()) + ) + + +def _create_default_styles(): + lines = filter(None, map(lambda line: line.strip(), _default_styles.split("\n"))) + return map(style_reader.read_style, lines) + +_default_styles = """ +p:unordered-list(1) => ul > li:fresh +""" -- cgit v1.2.3