|
3 | 3 |
|
4 | 4 | tabulate.PRESERVE_WHITESPACE = True |
5 | 5 |
|
6 | | -supported_formats = ('plain', 'simple', 'grid', 'fancy_grid', 'pipe', 'orgtbl', |
7 | | - 'jira', 'psql', 'rst', 'mediawiki', 'moinmoin', 'html', |
8 | | - 'latex', 'latex_booktabs', 'textile') |
| 6 | +supported_markup_formats = ('mediawiki', 'html', 'latex', 'latex_booktabs', |
| 7 | + 'textile', 'moinmoin', 'jira') |
| 8 | +supported_table_formats = ('plain', 'simple', 'grid', 'fancy_grid', 'pipe', |
| 9 | + 'orgtbl', 'psql', 'rst') |
| 10 | +supported_formats = supported_markup_formats + supported_table_formats |
9 | 11 |
|
10 | 12 | preprocessors = (bytes_to_string, align_decimals, quote_whitespaces) |
11 | 13 |
|
12 | 14 |
|
13 | 15 | def tabulate_adapter(data, headers, table_format=None, missing_value='', **_): |
14 | 16 | """Wrap tabulate inside a standard function for OutputFormatter.""" |
15 | | - return tabulate.tabulate(data, headers, tablefmt=table_format, |
16 | | - missingval=missing_value, disable_numparse=True) |
| 17 | + kwargs = {'tablefmt': table_format, 'missingval': missing_value, |
| 18 | + 'disable_numparse': True} |
| 19 | + if table_format in supported_markup_formats: |
| 20 | + kwargs.update(numalign=None, stralign=None) |
| 21 | + |
| 22 | + return tabulate.tabulate(data, headers, **kwargs) |
0 commit comments