src/cm/converters/__init__.py
changeset 555 5d79dc4e50a3
parent 452 8f1d6a6cd7f6
--- a/src/cm/converters/__init__.py	Mon Oct 21 16:50:41 2013 +0200
+++ b/src/cm/converters/__init__.py	Tue Oct 22 15:00:56 2013 +0200
@@ -30,9 +30,18 @@
         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)
+          try:
+            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)
+          except:
+            # If Abiword fails for any reason, try libreoffice
+            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)
         else:
           html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input)
           if format == 'html':