def visit_title(self, node): if isinstance(node.parent, nodes.topic): # title of table of contents text = node.astext() self.word.setStyle(CST.wdStyleSubtitle) self.word.addText(text) elif isinstance(node.parent, nodes.sidebar): pass elif isinstance(node.parent, nodes.Admonition): self.in_admonition = True self.word.setFont("Bold") elif isinstance(node.parent, nodes.table): pass # caption elif isinstance(node.parent, nodes.document): # document title self.doc_property_name = "Title" self.in_doc_property = True else: assert isinstance(node.parent, nodes.section) level = len( self.sections ) - 1 # we do not take the first section as it is dummy if level > 9: level = 9 self.word.setStyle(getCST("wdStyleHeading%d" % level)) bookmark_id = ILLEGAL_REX.subn("_", node.astext())[0] self.sections[ -1].title = self.sections[-1].title + "_" + bookmark_id
def visit_title(self, node): if isinstance(node.parent, nodes.topic): # title of table of contents text = node.astext() self.word.setStyle(CST.wdStyleSubtitle) self.word.addText(text) elif isinstance(node.parent, nodes.sidebar): pass elif isinstance(node.parent, nodes.Admonition): self.in_admonition = True self.word.setFont("Bold") elif isinstance(node.parent, nodes.table): pass # caption elif isinstance(node.parent, nodes.document): # document title self.doc_property_name = "Title" self.in_doc_property = True else: assert isinstance(node.parent, nodes.section) level = len(self.sections) - 1 # we do not take the first section as it is dummy if level > 9 : level = 9 self.word.setStyle(getCST("wdStyleHeading%d" % level)) bookmark_id = ILLEGAL_REX.subn("_", node.astext())[0] self.sections[-1].title = self.sections[-1].title + "_" + bookmark_id
def visit_enumerated_list(self, node): if not (self.skip_text or self.in_admonition): self.list_level += 1 if self.list_level > 5: self.list_level = 5 if self.list_level == 1: style = CST.wdStyleListNumber else: style = getCST("wdStyleListNumber%d" % self.list_level) self.word.setStyle(style) self.word.resetListStartNumber() self.in_list = True
def visit_bullet_list(self, node): if not (self.skip_text or self.in_admonition): self.list_level += 1 if self.list_level > 5: self.list_level = 5 if self.list_level == 1: style = CST.wdStyleListBullet else: style = getCST("wdStyleListBullet%d" % self.list_level) self.word.setStyle(style) self.in_list = True self.remove_carriage_return = False
def visit_enumerated_list(self, node): if not (self.skip_text or self.in_admonition): self.list_level += 1 if self.list_level > 5: self.list_level = 5 if self.list_level == 1: style = CST.wdStyleListNumber else: style = getCST("wdStyleListNumber%d" % self.list_level) self.word.setStyle(style) self.word.resetListStartNumber() self.in_list = True
def visit_bullet_list(self, node): if not (self.skip_text or self.in_admonition): self.list_level += 1 if self.list_level > 5: self.list_level = 5 if self.list_level == 1: style = CST.wdStyleListBullet else: style = getCST("wdStyleListBullet%d" % self.list_level) self.word.setStyle(style) self.in_list = True self.remove_carriage_return = False