Fixed multirow cells
This commit is contained in:
parent
95c9183bdf
commit
436a334fd0
1 changed files with 9 additions and 0 deletions
|
@ -43,6 +43,7 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
self.column = -1
|
self.column = -1
|
||||||
self.nextCol = -1
|
self.nextCol = -1
|
||||||
self.rowspan = 0
|
self.rowspan = 0
|
||||||
|
self.multirows = {}
|
||||||
self.date = {}
|
self.date = {}
|
||||||
|
|
||||||
import priv
|
import priv
|
||||||
|
@ -64,6 +65,9 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
self.row += 1
|
self.row += 1
|
||||||
self.nextCol = -1
|
self.nextCol = -1
|
||||||
elif tag == 'td':
|
elif tag == 'td':
|
||||||
|
while self.nextCol in self.multirows.keys() and self.multirows[self.nextCol][1] > 0:
|
||||||
|
self.nextCol += self.multirows[self.nextCol][0]
|
||||||
|
|
||||||
self.column = self.nextCol
|
self.column = self.nextCol
|
||||||
if 'colspan' in dAttrs.keys():
|
if 'colspan' in dAttrs.keys():
|
||||||
self.nextCol += int(dAttrs['colspan'])
|
self.nextCol += int(dAttrs['colspan'])
|
||||||
|
@ -73,6 +77,8 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
self.inCell = True
|
self.inCell = True
|
||||||
if 'rowspan' in dAttrs.keys():
|
if 'rowspan' in dAttrs.keys():
|
||||||
self.rowspan = int(dAttrs['rowspan'])
|
self.rowspan = int(dAttrs['rowspan'])
|
||||||
|
self.multirows[self.column] = [self.nextCol -
|
||||||
|
self.column, self.rowspan]
|
||||||
else: self.rowspan = 1
|
else: self.rowspan = 1
|
||||||
elif (self.row - 2) % 12 == 1:
|
elif (self.row - 2) % 12 == 1:
|
||||||
self.inDate = True
|
self.inDate = True
|
||||||
|
@ -83,6 +89,9 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
if tag == 'td':
|
if tag == 'td':
|
||||||
self.inCell = False
|
self.inCell = False
|
||||||
self.inDate = False
|
self.inDate = False
|
||||||
|
elif tag == 'tr':
|
||||||
|
for mr in self.multirows.values():
|
||||||
|
mr[1] -= 1
|
||||||
elif tag == 'tbody':
|
elif tag == 'tbody':
|
||||||
self.inTable = False
|
self.inTable = False
|
||||||
|
|
||||||
|
|
Reference in a new issue