label = SingleStyledText("Abstract \N{EM DASH} ", BOLD_ITALIC_STYLE) return super().__init__(label + text, style=styles['abstract']) class IndexTerms(Paragraph): def __init__(self, terms): label = SingleStyledText("Index Terms \N{EM DASH} ", BOLD_ITALIC_STYLE) text = ", ".join(sorted(terms)) + "." text = text.capitalize() return super().__init__(label + text, style=styles['abstract']) # input parsing # ---------------------------------------------------------------------------- CustomElement, NestedElement = element_factory(xml_frontend, styles) class Section(CustomElement): def parse(self, document, level=1): for element in self.getchildren(): if type(element) == Section: section = element.process(document, level=level + 1) for flowable in section: yield flowable else: if isinstance(element, Title): flowable = element.process(document, level=level, id=self.get('id', None)) else:
label = SingleStyledText("Abstract \N{EM DASH} ", BOLD_ITALIC_STYLE) return super().__init__(label + text, style=styles['abstract']) class IndexTerms(Paragraph): def __init__(self, terms): label = SingleStyledText("Index Terms \N{EM DASH} ", BOLD_ITALIC_STYLE) text = ", ".join(sorted(terms)) + "." text = text.capitalize() return super().__init__(label + text, style=styles['abstract']) # input parsing # ---------------------------------------------------------------------------- CustomElement, NestedElement = element_factory(xml_frontend, styles) class Section(CustomElement): def parse(self, document, level=1): for element in self.getchildren(): if type(element) == Section: section = element.process(document, level=level + 1) for flowable in section: yield flowable else: if isinstance(element, Title): flowable = element.process(document, level=level, id=self.get('id', None)) else: flowable = element.process(document) yield flowable
self.node.line) class NestedElement(CustomElement): def parse(self, document, *args, **kwargs): return self.process_content(document) def process_content(self, document): content = '' for child in self.getchildren(): content += child.process(document) return content return CustomElement, NestedElement CustomElement, NestedElement = element_factory(styles) class Text(CustomElement): def process(self, document, *args, **kwargs): return self.text class Document(CustomElement): pass class System_Message(CustomElement): def process(self, document, *args, **kwargs): return rt.Paragraph(self.text, style=self.style('body'))