Ejemplo n.º 1
0
def convert(source_path, file_name, output_path):
    """
    Call Vim to do the convertion.

    """
    ori_file = os.path.join(source_path, file_name)
    html_file = os.path.join(source_path, file_name + '.html')
    out_file = os.path.join(output_path, file_name + '.html')

    #  Just display, not actually performing the conversion
    print(u'Converting %s into %s' % (ori_file, out_file))

    global pre

    if not pre:
        global vimrc_file
        cmd = vim_command(vimrc_file) + [ori_file]

        try:
            subprocess.call(cmd, shell=get_shell())
            move(html_file, out_file)
        except Exception:
            sys.exit(u'ERROR: Fail to convert files, aborted.')
Ejemplo n.º 2
0
def convert(source_path, file_name, output_path):
    """
    Call Vim to do the convertion.

    """
    ori_file = os.path.join(source_path, file_name)
    html_file = os.path.join(source_path, file_name + '.html')
    out_file = os.path.join(output_path, file_name + '.html')

    #  Just display, not actually performing the conversion
    print(u'Converting %s into %s' % (ori_file, out_file))

    global pre

    if not pre:
        global vimrc_file
        cmd = vim_command(vimrc_file) + [ori_file]

        try:
            subprocess.call(cmd, shell=get_shell())
            move(html_file, out_file)
        except Exception:
            sys.exit(u'ERROR: Fail to convert files, aborted.')
Ejemplo n.º 3
0
 def test_vim_command(self):
     vimrc_file = '/tmp/temporary-vimrc'
     expected = 'vim -u /tmp/temporary-vimrc -c TOhtml -c wqa'
     self.assertEqual(expected, ' '.join(vim_command(vimrc_file)))