src/cm/converters/pandoc_converters.py
changeset 358 3e58bf6b3f3e
parent 357 2f4587a37ff9
child 393 8806f683d0be
equal deleted inserted replaced
357:2f4587a37ff9 358:3e58bf6b3f3e
   124     # use markdown2pdf
   124     # use markdown2pdf
   125     retcode = call(MARKDOWN2PDF_BIN + cust_tex + ' ' + input_temp_name, shell=True, stderr=fp_error)
   125     retcode = call(MARKDOWN2PDF_BIN + cust_tex + ' ' + input_temp_name, shell=True, stderr=fp_error)
   126 
   126 
   127     # xetex seems to randomly cause "Invalid or incomplete multibyte or wide character" errors, try without it
   127     # xetex seems to randomly cause "Invalid or incomplete multibyte or wide character" errors, try without it
   128     if retcode:
   128     if retcode:
   129       retcode = call(MARKDOWN2PDF_BIN + ' ' + input_temp_name, shell=True, stderr=fp_error)
   129       # build absolute address for latex header file
       
   130       _tmp_ = __file__.split(os.path.sep)[:-1]
       
   131       _tmp_.append('latex_header.txt')
       
   132       _tmp_.insert(0, os.path.sep)
       
   133 
       
   134       LATEX_HEADER_PATH = os.path.join(*_tmp_)
       
   135 
       
   136       if not os.path.isfile(LATEX_HEADER_PATH):
       
   137         raise Exception('LATEX_HEADER_PATH is not a file!')
       
   138 
       
   139       # custom latex header
       
   140       cust_head_tex = " --custom-header=%s " %LATEX_HEADER_PATH
       
   141 
       
   142       retcode = call(MARKDOWN2PDF_BIN + cust_head_tex + ' ' + input_temp_name, shell=True, stderr=fp_error)
   130 
   143 
   131     fp_error.close()
   144     fp_error.close()
   132     
   145     
   133     fp_error = file(error_temp_name)
   146     fp_error = file(error_temp_name)
   134     error = fp_error.read()
   147     error = fp_error.read()