Skip to content

Commit

Permalink
Fix missing text delimiter output for empty cells and empty rows #28
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Mar 25, 2024
1 parent aed1e3d commit e981d19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions folia/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6882,12 +6882,21 @@ class Paragraph(AbstractStructureElement):

class Cell(AbstractStructureElement):
"""A cell in a :class:`Row` in a :class:`Table`"""
pass

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

class Row(AbstractStructureElement):
"""A row in a :class:`Table`"""
pass

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


class TableHead(AbstractStructureElement):
Expand Down

0 comments on commit e981d19

Please sign in to comment.