Commit d1a5b601 authored by erreur401's avatar erreur401

python parser fix to check IF folderImg exist

parent 0270959a
......@@ -21,8 +21,9 @@ for file in inputMd:
# outputFile = open('pages/_PARSED_'+fileName[0]+'.md', 'w')
outputFile = open(PATH_TO_REPO_HOME +'app/pages/'+'_PARSED_'+fileName[0]+'.md', 'w')
yamlData = yaml.load(str(input.partition('...')[2].partition('...')[0]))
folderName = yamlData['folderImg']
outputMd = re.sub(r'(?:!\[(.*)\]\()(.*)(\/)(.*)(?:\))', r'![\1](/static/%s/\4)'%(folderName), input )
if yamlData['folderImg']:
folderName = yamlData['folderImg']
outputMd = re.sub(r'(?:!\[(.*)\]\()(.*)(\/)(.*)(?:\))', r'![\1](/static/%s/\4)'%(folderName), input )
outputMd = re.sub(r'(\.\.\.)\n','', outputMd )
outputFile.write(outputMd)
outputFile.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment