28 |
28 |
29 from cm.cm_settings import USE_ABI |
29 from cm.cm_settings import USE_ABI |
30 if USE_ABI: |
30 if USE_ABI: |
31 from abi_converters import AbiFileConverter |
31 from abi_converters import AbiFileConverter |
32 converter = AbiFileConverter() |
32 converter = AbiFileConverter() |
33 html_input, attachs = converter.convert_to_html(input) |
33 try: |
34 html_input = re.sub(r' awml:style="[^"]*"', '', html_input) |
34 html_input, attachs = converter.convert_to_html(input) |
35 converted_input = pandoc_convert(html_input, 'html', format) |
35 html_input = re.sub(r' awml:style="[^"]*"', '', html_input) |
|
36 converted_input = pandoc_convert(html_input, 'html', format) |
|
37 except: |
|
38 # If Abiword fails for any reason, try libreoffice |
|
39 html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input) |
|
40 if format == 'html': |
|
41 _not_used_css, converted_input = extract_css_body(xhtml_input) |
|
42 #converted_input = xhtml_input |
|
43 |
|
44 converted_input = pandoc_convert(html_input, 'html', format) |
36 else: |
45 else: |
37 html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input) |
46 html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input) |
38 if format == 'html': |
47 if format == 'html': |
39 _not_used_css, converted_input = extract_css_body(xhtml_input) |
48 _not_used_css, converted_input = extract_css_body(xhtml_input) |
40 #converted_input = xhtml_input |
49 #converted_input = xhtml_input |