inCell and inTable
This commit is contained in:
parent
4be55f963c
commit
27ee15ba2d
1 changed files with 7 additions and 1 deletions
|
@ -31,6 +31,7 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.inTable = False
|
self.inTable = False
|
||||||
|
self.inCell = False
|
||||||
self.row = -1
|
self.row = -1
|
||||||
self.column = -1
|
self.column = -1
|
||||||
HTMLParser.__init__(self)
|
HTMLParser.__init__(self)
|
||||||
|
@ -42,11 +43,16 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
self.column = -1
|
self.column = -1
|
||||||
elif tag == 'td':
|
elif tag == 'td':
|
||||||
self.column += 1
|
self.column += 1
|
||||||
|
if not (self.row < 3 or (self.row - 2) % 11 < 2):
|
||||||
|
self.inCell = True
|
||||||
elif tag == 'tbody':
|
elif tag == 'tbody':
|
||||||
self.inTable = True
|
self.inTable = True
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
def handle_endtag(self, tag):
|
||||||
...
|
if tag == 'td':
|
||||||
|
self.inCell = False
|
||||||
|
elif tag == 'tbody':
|
||||||
|
self.inTable = False
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
...
|
...
|
||||||
|
|
Reference in a new issue