src/cm/converters/__init__.py
branchpreserve_html
changeset 259 0371caf8bcc6
parent 253 a844469257b0
child 360 bfaab8740995
equal deleted inserted replaced
258:a79a3c91d9b5 259:0371caf8bcc6
    24         
    24         
    25         html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input)
    25         html_input, xhtml_input, attachs = convert_oo_to_html_and_xhtml(input)
    26         if format == 'html':
    26         if format == 'html':
    27                 _not_used_css, converted_input = extract_css_body(xhtml_input)
    27                 _not_used_css, converted_input = extract_css_body(xhtml_input)
    28                 #converted_input = xhtml_input
    28                 #converted_input = xhtml_input
    29         else:
    29         
    30             converted_input = pandoc_convert(html_input, 'html', format)
    30         converted_input = pandoc_convert(html_input, 'html', format)
    31         
    31         
    32     ##############################
    32     ##############################
    33     # latex
    33     # latex
    34     elif mime_type in ['application/x-latex','text/x-tex',]:
    34     elif mime_type in ['application/x-latex','text/x-tex',]:
    35         converted_input = pandoc_convert(to_unicode(input), 'latex', format)
    35         converted_input = pandoc_convert(to_unicode(input), 'latex', format)
    42     ##############################
    42     ##############################
    43     # html
    43     # html
    44     elif mime_type in ['text/html', 'application/xhtml+xml']:
    44     elif mime_type in ['text/html', 'application/xhtml+xml']:
    45         if format == 'html':
    45         if format == 'html':
    46             converted_input = input
    46             converted_input = input
    47         else:
    47         
    48             converted_input = pandoc_convert(input, 'html', format)
    48         converted_input = pandoc_convert(input, 'html', format)
    49     ##############################
    49     ##############################
    50     # anything looks like text -> markdown
    50     # anything looks like text -> markdown
    51     elif mime_type in ['text/plain',
    51     elif mime_type in ['text/plain',
    52                        'text/english',
    52                        'text/english',
    53                        'text/enriched'
    53                        'text/enriched'