def md2html(file):
+ """Use the markdown module to convert input to HTML"""
with open(file, "r", encoding="utf-8") as input_file:
return markdown.markdown(input_file.read(), extensions=['tables'])
def parse_html(html):
+ """Use BeautifulSoup to parse the HTML"""
def clean_text(inp):
return inp.get_text().rstrip()
for x in soup.find_all("tr"):
outp.append(Card([clean_text(y) for y in x.find_all("td")]))
+ # Return a tuple of nested lists
return ([clean_text(x) for x in soup.find_all("th")],
clean_list(outp))