2 # Parse markdown table into tuple of lists
6 from bs4 import BeautifulSoup
13 """Use the markdown module to convert input to HTML"""
14 with open(file, "r", encoding="utf-8") as input_file:
15 return markdown.markdown(input_file.read(), extensions=['tables'])
19 """Use BeautifulSoup to parse the HTML"""
21 return inp.get_text().rstrip()
23 soup = BeautifulSoup(html, 'html.parser')
26 for x in soup.find_all("tr"):
27 outp.append(Card([clean_text(y) for y in x.find_all("td")[:2]]))
29 # Return a tuple of nested lists
30 return ([clean_text(x) for x in soup.find_all("th")][:2], outp[1:])
34 return parse_html(md2html(file))
37 if __name__ == "__main__":
38 print(main(sys.argv[1]))