src/cm/converters/pandoc_converters.py
changeset 355 c926868cf7e6
parent 352 07a1fba18fff
child 356 52569110fb34
equal deleted inserted replaced
354:4c7feb67d4a0 355:c926868cf7e6
    13 from cm.utils.string_utils import to_unicode
    13 from cm.utils.string_utils import to_unicode
    14 from xml.dom.minidom import parseString
    14 from xml.dom.minidom import parseString
    15 import re
    15 import re
    16 
    16 
    17 PANDOC_BIN = "pandoc"
    17 PANDOC_BIN = "pandoc"
    18 PANDOC_OPTIONS = " --sanitize-html --email-obfuscation=none  "
    18 PANDOC_OPTIONS = " --sanitize-html --email-obfuscation=none "
    19 PANDOC_OPTIONS_RAW = " -R --email-obfuscation=none "
    19 PANDOC_OPTIONS_RAW = " -R --email-obfuscation=none "
    20 
    20 
    21 MARKDOWN2PDF_BIN = "markdown2pdf"
    21 MARKDOWN2PDF_BIN = "markdown2pdf"
    22 
    22 
    23 # make sure binaries are available
    23 # make sure binaries are available
   200       stdoutdata = re.sub(r"^\s+", '', stdoutdata)
   200       stdoutdata = re.sub(r"^\s+", '', stdoutdata)
   201       # add new line before closing bracket
   201       # add new line before closing bracket
   202       stdoutdata = re.sub(r"(\/?)>", r"\n\1>", stdoutdata)
   202       stdoutdata = re.sub(r"(\/?)>", r"\n\1>", stdoutdata)
   203       # do not split closing tag with following opening tag
   203       # do not split closing tag with following opening tag
   204       stdoutdata = re.sub(r">\n<", r"><", stdoutdata)
   204       stdoutdata = re.sub(r">\n<", r"><", stdoutdata)
   205       # nest headers tags 
   205       # nest headers tags
   206       #stdoutdata = re.sub(r'<h(\d) id="([^"]+)"\n>', r'<div id="\2"><h\1>', stdoutdata)
   206       #stdoutdata = re.sub(r'<h(\d) id="([^"]+)"\n>', r'<div id="\2"><h\1>', stdoutdata)
   207       #stdoutdata = re.sub(r'<\/h(\d)\n>', r'</h\1></div>', stdoutdata)
   207       #stdoutdata = re.sub(r'<\/h(\d)\n>', r'</h\1></div>', stdoutdata)
   208       return stdoutdata
   208       return stdoutdata
   209 
   209 
   210     cmd_args = ' %s -o %s ' %(p_options,output_temp_name) 
   210     cmd_args = ' %s -o %s ' %(p_options,output_temp_name)