]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/parse.py
Only grab data from first table in file
[lightcards.git] / lightcards / parse.py
index 0b4ecc1b2bdd172ad5cad07ca40e0205af07296d..a447485e4b046f4ab16bc67b251c8b140a41cba5 100644 (file)
@@ -13,8 +13,7 @@ def md2html(file):
     try:
         return markdown.markdown(open(file, "r").read(), extensions=["tables"])
     except FileNotFoundError:
-        print(f'lightcards: "{file}": No such file or directory')
-        exit(1)
+        sys.exit(f'lightcards: "{file}": No such file or directory')
 
 
 def parse_html(html):
@@ -23,7 +22,7 @@ def parse_html(html):
     def clean_text(inp):
         return inp.get_text().rstrip()
 
-    soup = BeautifulSoup(html, "html.parser")
+    soup = BeautifulSoup(html, "html.parser").find("table")
     outp = []
 
     for x in soup.find_all("tr"):