pyRestTable¶
author: | Pete R. Jemian |
---|---|
version: | 2020.0.2 |
release: | 2020.0.2+35.g6dbd9a5.dirty |
published: | Nov 09, 2020 |
source code documentation¶
Format a nice table in reST (restructured text)
User Interface | Description |
---|---|
Table |
Construct a table in reST |
addLabel() |
add label for one additional column |
addRow() |
add list of items for one additional row |
setLongtable() |
set longtable attribute |
setTabularColumns() |
set use_tabular_columns & alignment attributes |
reST() |
render the table in reST format |
Table () |
Construct a table in reST (no row or column spans). |
example_minimal () |
minimal example table |
example_basic () |
basic example table |
example_complicated () |
complicated example table |
-
class
pyRestTable.rest_table.
Table
[source]¶ Construct a table in reST (no row or column spans).
Parameters: - use_tabular_columns (bool) – if True, embed table in Sphinx ‘.. tabularcolumns:: |%s|’ % alignment’ role
- alignment ([str]) – with use_tabular_columns, each list item is a column format string, as specified by LaTeX tabulary package format: http://sphinx-doc.org/markup/misc.html?highlight=tabularcolumns#directive-tabularcolumns
- longtable (bool) – with use_tabular_columns, if True, add Sphinx :longtable: directive
MAIN METHODS
addLabel
(text)add label for one additional column addRow
(list_of_items)add list of items for one additional row reST
([indentation, fmt])render the table in reST format SUPPORTING METHODS
setLongtable
([state])set longtable attribute setTabularColumns
([state, column_spec])set use_tabular_columns & alignment attributes plain_table
([indentation])render the table in plain reST format simple_table
([indentation])render the table in simple reST format grid_table
([indentation])render the table in grid reST format list_table
([indentation])render the table in list-table reST format: html_table
([indentation])render the table in HTML -
addLabel
(text)[source]¶ add label for one additional column
Parameters: text (str) – column label text Return int: number of labels
-
addRow
(list_of_items)[source]¶ add list of items for one additional row
Parameters: list_of_items ([obj]) – list of items for one complete row Return int: number of rows
-
find_widths
()[source]¶ measure the maximum width of each column, considering possible line breaks in each cell
-
list_table
(indentation='')[source]¶ render the table in list-table reST format:
See: http://docutils.sourceforge.net/docs/ref/rst/directives.html ¶ Treat Quantity Description Albatross 2.99 On a stick! Crunchy Frog 1.49 If we took the bones out, it wouldn’t be crunchy, now would it? Gannet Ripple 1.99 On a stick!
-
markdown_table
(indentation='')[source]¶ render the table in GitHub-flavored markdown (not reST) format
see: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#tables
-
setLongtable
(state=True)[source]¶ set longtable attribute
Parameters: longtable (bool) – True | False