def wrap(self): if DEBUG: print("Wrapping list item...") p_style, list_level, list_type = get_current_li(self.section.extra) self.cell_object.add_paragraph(style=p_style) numbered = False if list_type == ORDERED_LIST_NAME: numbered = True utils.list_number(self.cell_object.cell, self.cell_object.paragraph, level=list_level, num=numbered) if isinstance(self.section.contents, str): insert_text(self.cell_object, self.section.contents) return temp_section = MarkdownSection('markdown', self.section.contents, {}, {}) temp_section.propagate_extra('inline', True) markdown.invoke(self.cell_object, temp_section, invoked_from_wrapper=True)
def insert(self): if DEBUG: print('Adding placeholder...') self.section.type = 'markdown' if isinstance(self.section.contents, str): self.section.contents = markdown_to_section_list( self.section.contents) else: self.section.contents = markdown_to_section_list( self.section.contents['text']) markdown.invoke(self.cell_object, self.section)
def wrap(self): if DEBUG: print("Wrapping Ul...") temp_section = MarkdownSection('markdown', self.section.contents, {}, {}) p_style, list_level, list_type = get_current_li( self.section.extra, UNORDERED_LIST_NAME) temp_section.propagate_extra('list_level', list_level, only_multiple_children=False) temp_section.propagate_extra('list_type', list_type, only_multiple_children=False) markdown.invoke(self.cell_object, temp_section, invoked_from_wrapper=True)
def wrap(self): if DEBUG: print('Wrapping quote...') self.cell_object.add_paragraph() cell = self.cell_object.cell.add_table(1, 1).cell(0, 0) quote_color = name_to_hex("cornsilk") new_cell = insert_cell_background(cell, quote_color) self.cell_object = CellObject(new_cell) contents = self.section.contents if isinstance(contents, str): temp_section = MarkdownSection( 'markdown', [MarkdownSection('span', contents, {}, {})], {}, {}) else: temp_section = MarkdownSection('markdown', contents, {}, {}) markdown.invoke(self.cell_object, temp_section, invoked_from_wrapper=True)
def wrap(self): if DEBUG: print("Wrapping code...") if 'inline' not in self.section.extra: self.cell_object.add_paragraph() # TODO: remove newlines from OXML cell = self.cell_object.cell.add_table(1, 1).cell(0, 0) code_color = name_to_hex("whitesmoke") new_cell = insert_cell_background(cell, code_color) self.cell_object = CellObject(new_cell) contents = self.section.contents if isinstance(contents, str): temp_section = MarkdownSection( 'markdown', [MarkdownSection('span', contents, {}, {})], {}, {}) else: temp_section = MarkdownSection('markdown', contents, {}, {}) markdown.invoke(self.cell_object, temp_section, invoked_from_wrapper=True)