src/cm/converters/__init__.py
changeset 360 bfaab8740995
parent 259 0371caf8bcc6
child 416 5573b959131d
--- a/src/cm/converters/__init__.py	Thu Jun 16 09:27:56 2011 +0200
+++ b/src/cm/converters/__init__.py	Thu Jul 21 09:42:33 2011 +0200
@@ -3,7 +3,7 @@
 from cm.utils.string_utils import to_unicode 
 import re
 import os
-from cm.converters.oo_converters import extract_css_body
+from oo_converters import extract_css_body
 
 
 # TODO: move that in text_base: save images
@@ -18,16 +18,26 @@
     attachs = []
     attachs_dir = None
     ##############################
+    # OO/MS-Word
     if mime_type in ['application/vnd.oasis.opendocument.text',
                      'application/msword',
+                     'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
                      ]:
         
-        html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input)
-        if format == 'html':
+        from cm.cm_settings import USE_ABI
+        if USE_ABI:
+          from abi_converters import AbiFileConverter
+          converter = AbiFileConverter()
+          html_input, attachs = converter.convert_to_html(input)
+          html_input = re.sub(r' awml:style="[^"]*"', '', html_input)
+          converted_input = pandoc_convert(html_input, 'html', format)
+        else:
+          html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input)
+          if format == 'html':
                 _not_used_css, converted_input = extract_css_body(xhtml_input)
                 #converted_input = xhtml_input
         
-        converted_input = pandoc_convert(html_input, 'html', format)
+          converted_input = pandoc_convert(html_input, 'html', format)
         
     ##############################
     # latex
@@ -136,4 +146,4 @@
     CODE_INDICATOR = "    " # 4 spaces
     return '\n'.join([CODE_INDICATOR + line for line in code.split('\n')])
 
-        
\ No newline at end of file
+