table

table related directives.

class rstobj.directives.table.ListTable(class_: Optional[str] = None, name: Optional[str] = None, data: Optional[list] = None, title: str = '', index: bool = False, header: bool = True, widths: Optional[List[int]] = None, align: Optional[str] = None)[source]

List Tabulate Table.

parameter definition see here http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table.

Parameters
  • data – list of list.

  • title – str, optional.

  • index – bool, use first column as index. default False.

  • header – bool, use first row as header. default True.

  • widths – list of int

  • align

Example:

ltable = rstobj.directives.ListTable(
    data=[["id", "name"], [1, "Alice"], [2, "Bob"]],
    title="Users",
    header=True,
)
ltable.render()

Output:

.. list-table:: Title of the table
    :widths: 10 10 10
    :header-rows: 1

    * - Header1
      - Header2
      - Header3
    * - Value1
      - Value2
      - Value3
class AlignOptions[source]

align parameter choices.