def get_formatted_text(self, context=None): if not context: context = { 'document': None, 'footnotes': [], 'endnotes': [], 'annotations': [], 'rst_mode': False, 'img_counter': 0, 'images': [], 'no_img_level': 0 } context['no_img_level'] += 1 title = odf_paragraph.get_formatted_text(self, context) context['no_img_level'] -= 1 title = title.strip() title = sub(r'\s+', ' ', title) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"#=-~`+^°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result result = [ u'\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), u'\n' ] return u''.join(result)
def get_formatted_text(self, context=None): if not context: context = { 'document': None, 'footnotes': [], 'endnotes': [], 'annotations': [], 'rst_mode': False, 'img_counter': 0, 'images': [], 'no_img_level': 0} context['no_img_level'] += 1 title = odf_paragraph.get_formatted_text(self, context) context['no_img_level'] -= 1 title = title.strip() title = sub(r'\s+', ' ', title) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"#=-~`+^°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result result = [u'\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), u'\n'] return u''.join(result)
def get_formatted_text(self, context): title = odf_paragraph.get_formatted_text(self, context) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"=-+^~°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result title = title.strip() result = ['\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), '\n'] return u''.join(result)
def get_formatted_text(self, context): title = odf_paragraph.get_formatted_text(self, context) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"=-+^~°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result title = title.strip() result = [ '\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), '\n' ] return u''.join(result)
def get_formatted_text(self, context): context['no_img_level'] += 1 title = odf_paragraph.get_formatted_text(self, context) context['no_img_level'] -= 1 title = title.strip() title = sub(r'\s+', ' ', title) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"#=-~`+^°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result result = [u'\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), u'\n'] return u''.join(result)
def get_formatted_text(self, context): context['no_img_level'] += 1 title = odf_paragraph.get_formatted_text(self, context) context['no_img_level'] -= 1 title = title.strip() title = sub(r'\s+', ' ', title) # No rst_mode ? if not context["rst_mode"]: return title # If here in rst_mode! # Get the level, max 5! LEVEL_STYLES = u"#=-~`+^°'." level = self.get_outline_level() if level > len(LEVEL_STYLES): raise ValueError, "Too many levels of heading" # And return the result result = [ u'\n', title, u'\n', LEVEL_STYLES[level - 1] * len(title), u'\n' ] return u''.join(result)