Skip to content

Commit e981d19

Browse files
committed
Fix missing text delimiter output for empty cells and empty rows #28
1 parent aed1e3d commit e981d19

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

folia/main.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -6882,12 +6882,21 @@ class Paragraph(AbstractStructureElement):
68826882

68836883
class Cell(AbstractStructureElement):
68846884
"""A cell in a :class:`Row` in a :class:`Table`"""
6885-
pass
68866885

6886+
def text(self, cls='current', retaintokenisation=False, previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT, normalize_spaces=False, hidden=False, trim_spaces=True):
6887+
if self.hastext(cls, strict, correctionhandling, hidden):
6888+
return super(AbstractStructureElement, self).text(cls,retaintokenisation, previousdelimiter,strict, correctionhandling, normalize_spaces, hidden, trim_spaces)
6889+
else:
6890+
return previousdelimiter #force output of previous delimiter, needed for empty cells
68876891

68886892
class Row(AbstractStructureElement):
68896893
"""A row in a :class:`Table`"""
6890-
pass
6894+
6895+
def text(self, cls='current', retaintokenisation=False, previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT, normalize_spaces=False, hidden=False, trim_spaces=True):
6896+
if self.hastext(cls, strict, correctionhandling, hidden):
6897+
return super(AbstractStructureElement, self).text(cls,retaintokenisation, previousdelimiter,strict, correctionhandling, normalize_spaces, hidden, trim_spaces)
6898+
else:
6899+
return previousdelimiter #force output of previous delimiter, needed for empty cells
68916900

68926901

68936902
class TableHead(AbstractStructureElement):

0 commit comments

Comments
 (0)