basant/basant/grab/convert.py

11 lines
373 B
Python

import pypandoc
def convert_file(file):
filename = file.strip('wiki')[:-1] # filenames can contain ../ ./ etc, so we strip only the final wiki, and then drop the last character which is a '.'
pypandoc.convert_file(filename + '.wiki', 'md',format='vimwiki', outputfile=filename + '.md')
def convert_files(files):
for file in files:
convert_file(file)