Пример #1
0
 def build_flowable(self):
     tgroup = self.tgroup
     if 'colwidths-given' in self.get('classes'):
         column_widths = [
             int(colspec.get('colwidth')) for colspec in tgroup.colspec
         ]
     else:
         column_widths = None
     try:
         head = tgroup.thead.get_table_section()
     except AttributeError:
         head = None
     body = tgroup.tbody.get_table_section()
     align = self.get('align')
     width_string = self.get('width')
     table = rt.Table(body,
                      head=head,
                      align=None if align == 'default' else align,
                      width=convert_quantity(width_string),
                      column_widths=column_widths)
     try:
         caption = rt.Caption(self.title.process_content())
     except AttributeError:
         return table
     table_with_caption = rt.TableWithCaption([caption, table])
     return table_with_caption
Пример #2
0
 def flowables(self):
     table, = super().flowables()
     try:
         caption = rt.Caption(self.title.process_content())
         table_with_caption = rt.TableWithCaption([caption, table])
         table_with_caption.classes.extend(self.get('classes'))
         yield table_with_caption
     except AttributeError:
         yield table
Пример #3
0
 def build_flowable(self):
     tgroup = self.tgroup
     if tgroup.get('colwidths', 'auto') == 'given':
         column_widths = [int(colspec.get('colwidth'))
                          for colspec in tgroup.colspec]
     else:
         column_widths = None
     try:
         head = tgroup.thead.get_table_section()
     except AttributeError:
         head = None
     body = tgroup.tbody.get_table_section()
     width_string = self.get('width')
     table = rt.Table(body, head=head, width=convert_quantity(width_string),
                      column_widths=column_widths)
     try:
         caption = rt.Caption(self.title.process_content())
         return rt.TableWithCaption([caption, table])
     except AttributeError:
         return table