inCell and inTable

This commit is contained in:
Edgar P. Burkhart 2020-09-20 21:26:53 +02:00
parent 4be55f963c
commit 27ee15ba2d
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class GoogleSheetsCalParser(HTMLParser):
"""
def __init__(self):
self.inTable = False
self.inCell = False
self.row = -1
self.column = -1
HTMLParser.__init__(self)
@ -42,11 +43,16 @@ class GoogleSheetsCalParser(HTMLParser):
self.column = -1
elif tag == 'td':
self.column += 1
if not (self.row < 3 or (self.row - 2) % 11 < 2):
self.inCell = True
elif tag == 'tbody':
self.inTable = True
def handle_endtag(self, tag):
...
if tag == 'td':
self.inCell = False
elif tag == 'tbody':
self.inTable = False
def handle_data(self, data):
...