def build_flowable(self):
     if isinstance(self.parent, Document):
         return rt.SetMetadataFlowable(title=self.process_content())
     elif isinstance(self.parent, Section):
         try:
             kwargs = dict(custom_label=self.generated.build_styled_text())
         except AttributeError:
             kwargs = dict()
         return rt.Heading(self.process_content(), **kwargs)
     else:
         return rt.Paragraph(self.process_content(), style='title')
示例#2
0
 def build_flowable(self):
     classes = self.get('classes')
     if 'contents' in classes:
         if 'local' in classes:
             flowables = [rt.TableOfContents(local=True)]
             try:
                 flowables.insert(0, self.title.flowable())
             except AttributeError:
                 pass
             return rt.StaticGroupedFlowables(flowables,
                                              style='table of contents')
         else:
             return rt.SetMetadataFlowable(toc_ids=self.get('ids'))
     elif 'dedication' in classes:
         return self._process_topic('dedication')
     elif 'abstract' in classes:
         return self._process_topic('abstract')
     else:
         return super().build_flowable()
 def build_flowable(self):
     doc_info = {field.name: field.value for field in self.getchildren()}
     return rt.SetMetadataFlowable(**doc_info)
 def build_flowable(self):
     return rt.SetMetadataFlowable(subtitle=self.process_content())
 def _process_topic(self, topic_type):
     topic = super().build_flowable(style=topic_type)
     del topic.children[0]
     return rt.SetMetadataFlowable(**{topic_type: topic})
 def build_flowable(self):
     metadata = {self.MAP[self.get('name')]: self.get('content')}
     return rt.SetMetadataFlowable(**metadata)