diff options
Diffstat (limited to 'helpcontent2/to-wiki/wikiconv2.py')
-rwxr-xr-x | helpcontent2/to-wiki/wikiconv2.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index acc1b457b7..7772030aca 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -475,8 +475,10 @@ class Text: class TableCell(ElementBase): def __init__(self, attrs, parent): ElementBase.__init__(self, 'tablecell', parent) + self.cellHasChildElement = False def start_element(self, parser, name, attrs): + self.cellHasChildElement = True if name == 'bookmark': self.parse_child(Bookmark(attrs, self, 'div', parser)) elif name == 'comment': @@ -492,6 +494,18 @@ class TableCell(ElementBase): else: self.unhandled_element(parser, name) + def get_all(self): + text = '' + if not self.cellHasChildElement: # an empty element + if self.parent.isTableHeader: # get from TableRow Element + role = 'tablehead' + else: + role = 'tablecontent' + text = text + replace_paragraph_role['start'][role] + text = text + replace_paragraph_role['end'][role] + text = text + ElementBase.get_all(self) + return text + class TableRow(ElementBase): def __init__(self, attrs, parent): ElementBase.__init__(self, 'tablerow', parent) @@ -1089,6 +1103,10 @@ class TableContentParagraph(Paragraph): self.role = 'tablecontentcode' else: self.role = 'tablecontent' + if self.role == 'tablehead': + self.parent.parent.isTableHeader = True # self.parent.parent is TableRow Element + else: + self.parent.parent.isTableHeader = False class ParserBase: def __init__(self, filename, follow_embed, embedding_app, current_app, wiki_page_name, lang, head_object, buffer): |