def __init__(self, element, parent=None): """ level: heading level string: text body of the paragraph """ Content.__init__(self, HEADING_TYPE, element, parent) self.level = ep.ElementProcessor.get_level_number(self.element_style)
def __init__(self, element, parent=None): """ element: xml element """ self.element = element Content.__init__(self, LIST_PARAGRAPH_TYPE, element, parent) return
def __init__(self, element, parent=None): """ parent: parent object """ Content.__init__(self, LINK_TYPE, element, parent) self.chapter = ep.ElementProcessor.get_current_chapter() self.link = element['xlink:href'] return
def __init__(self, string, parent=None): """ string: body text parent: parent object """ Content.__init__(self, TEXT_TYPE, None, parent) self.string = string return
def __init__(self, element, parent=None): """ parent: parent object """ Content.__init__(self, MARKER_TYPE, element, parent) self.chapter = ep.ElementProcessor.get_current_chapter() self.name = element['text:name'] ep.ElementProcessor.add_marker(self) return
def __init__(self, element, frame): """ element: xml element """ self.width = frame.width self.height = frame.height self.image = element['xlink:href'] Content.__init__(self, IMAGE_TYPE, element) return
def __init__(self, element, parent=None, category=0): """ element: xml element category: type of remarks 1..3 """ self.category = category Content.__init__(self, REMARK_TYPE, element, parent) if category != 0: self.category = self.remark_category(element) # self.paragraphs = [] # for paragraph in paragraphs: # self.paragraphs.append(Paragraph(paragraph.string)) return
def __init__(self, element, parent=None, level=1): self.level = level self.kind = List.TYPE_NOT_ASSIGNED if parent is None: style = None else: style = parent.element_style Content.__init__(self, LIST_TYPE, element, parent, style) self.kind = ep.ElementProcessor.get_type_list(self.element_style, self.level) # sublist if len(self.inner_objects) == 1: if len(self.inner_objects[0].inner_objects) == 1 and \ self.inner_objects[0].inner_objects[0].type == LIST_TYPE: self.inner_objects.append( self.inner_objects[0].inner_objects[0]) del self.inner_objects[0] return
def remark_category(element): """ Return the category of the Remark if the paragraph is a Remark (number greater than 0). Otherwise return 0 """ category = 0 element_style = element.get('text:style-name') if Content.is_style(element, REMARK_TYPE): category = int(element_style[element_style.rfind('_') + 1:]) return category
def __init__(self, element, parent): Content.__init__(self, LIST_ITEM_TYPE, element, parent, parent.element_style) return
def __init__(self, element, parent=None): Content.__init__(self, FOOTNOTE_BODY_TYPE, element, parent) return
def __init__(self, element, parent=None): """ element: span xml element """ Content.__init__(self, SPAN_TYPE, element, parent) return
def __init__(self, element, parent=None): Content.__init__(self, NOSUPPORTED_TYPE, None, parent) return
def __init__(self, element, parent=None): Content.__init__(self, FOOTNOTE_TYPE, element) self.__get_note_components(element) return