ws.wikitable module

class ws.wikitable.Wikitable

Bases: object

static assemble(header_fields, rows, single_line_rows=False)
Parameters
  • header_fields – list of strings representing the table header

  • rows – list of tuples, represents the table cells in a matrix-like row-major format

  • single_line_rows – if True, each row is formatted on a single line, e.g. | cell1 || cell2 || cell3.

Returns

string containing the table formatted with MediaWiki markup

static parse(text)
Parameters

text – string or a mwparserfromhell.wikicode.Wikicode object containing a table in MediaWiki format

Returns

a (fields, rows) tuple, where fields is a list of column fields and rows is a list of tuples representing the table cells in a matrix-like row-major format

exception ws.wikitable.WikitableParseError

Bases: Exception