Created
March 16, 2020 22:14
-
-
Save vmx/ec00d7fce28f476df62644fac8926d40 to your computer and use it in GitHub Desktop.
Script to convert a CSV file with Markdown to a CSV file with HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
import os | |
import cmarkgfm | |
FIELDNAMES = ['id', 'title', 'description'] | |
with open('talks.csv', newline='') as inputfile: | |
reviews = csv.DictReader(inputfile, delimiter=',', quotechar='"') | |
output_path = os.path.join('2020_foss4ge', 'talks_html.csv') | |
with open(output_path, 'w', newline='') as outputfile: | |
writer = csv.DictWriter(outputfile, FIELDNAMES, delimiter=',', | |
quotechar='"') | |
writer.writeheader() | |
for row in reviews: | |
description = cmarkgfm\ | |
.github_flavored_markdown_to_html(row['description']) | |
# print(description) | |
row['description'] = description | |
writer.writerow(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment