diff --git a/lib/pre_tables.py b/lib/pre_tables.py index 0af7c64..8c7373a 100644 --- a/lib/pre_tables.py +++ b/lib/pre_tables.py @@ -2,42 +2,6 @@ from bs4 import BeautifulSoup -html = """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IDName
56Matt
42Colin
23Lisa
45John
<table><e>
- -

Sublime Text Logo

-""" - def python_table(s_table): """Transform BeautifulSoup table into list of list""" rows = [] @@ -55,6 +19,11 @@ def pre_table(s_table): cols_width[i] = len(cell.text) text = '
'
     for i, row in enumerate(rows):
+        if i == 1:
+            for j, cell in enumerate(row):
+                text += '|' + '-' * (cols_width[j] + 2)
+            text += '|\n'
+
         for j, cell in enumerate(row):
             text += '| ' + ''.join(str(node) for node in cell.contents) \
                     + ' ' * (cols_width[j] - len(cell.text) + 1)