Ejemplo n.º 1
0
    def gather_elements(self, client, node, style):
        if isinstance(node.parent, docutils.nodes.authors):
            # Is only one of multiple authors. Return a paragraph
            node.elements = [
                Paragraph(client.gather_pdftext(node), style=style)
            ]
            if client.doc_author:
                client.doc_author += client.author_separator(style=style) \
                    + node.astext().strip()
            else:
                client.doc_author = node.astext().strip()
        else:
            # A single author: works like a field
            fb = client.gather_pdftext(node)

            t_style = TableStyle(client.styles['field-list'].commands)
            colWidths = map(client.styles.adjustUnits,
                            client.styles['field-list'].colWidths)

            node.elements = [
                Table([[
                    Paragraph(client.text_for_label("author", style) + ":",
                              style=client.styles['fieldname']),
                    Paragraph(fb, style)
                ]],
                      style=t_style,
                      colWidths=colWidths)
            ]
            client.doc_author = node.astext().strip()
        return node.elements
Ejemplo n.º 2
0
 def gather_elements(self, client, node, style):
     mflow = math_flowable.Math(node.get('latex', ''),
                                node.get('label', None))
     n = node['number']
     if n is not None:
         number = '(%s)' % node['number']
         return [Table([[mflow, number]], )]
     return [mflow]