|
40 | 40 | # with_header_hide (a list of strings) is a list of elements to be not
|
41 | 41 | # displayed if a table has column headers.
|
42 | 42 | #
|
43 |
| -# without_header_hide (a list of strings) is a list of elements to be |
44 |
| -# not displayed if a table doesn't have column headers. |
45 |
| -# |
46 |
| -HidingRules = namedtuple("HidingRules", ["with_header_hide", "without_header_hide"]) |
| 43 | +HidingRules = namedtuple("HidingRules", ["with_header_hide"]) |
47 | 44 |
|
48 | 45 | # A table structure is suppposed to be:
|
49 | 46 | #
|
|
90 | 87 | headerrow=DataRow("", " ", ""),
|
91 | 88 | datarow=DataRow("", " ", ""),
|
92 | 89 | padding=0,
|
93 |
| - hiding=HidingRules(with_header_hide=["lineabove", "linebelow"], |
94 |
| - without_header_hide=[])), |
| 90 | + hiding=HidingRules(with_header_hide=["lineabove", "linebelow"])), |
95 | 91 | "plain":
|
96 | 92 | TableFormat(lineabove=None, linebelowheader=None,
|
97 | 93 | linebetweenrows=None, linebelow=None,
|
@@ -776,13 +772,7 @@ def _line_segment_with_colons(linefmt, align, colwidth):
|
776 | 772 | def _format_table(fmt, headers, rows, colwidths, colaligns):
|
777 | 773 | """Produce a plain-text representation of the table."""
|
778 | 774 | lines = []
|
779 |
| - if fmt.hiding: |
780 |
| - if headers: |
781 |
| - hidden = fmt.hiding.with_header_hide |
782 |
| - else: |
783 |
| - hidden = fmt.hiding.without_header_hide |
784 |
| - else: |
785 |
| - hidden = [] |
| 775 | + hidden = fmt.hiding.with_header_hide if (fmt.hiding and headers) else [] |
786 | 776 | pad = fmt.padding
|
787 | 777 | headerrow = fmt.headerrow
|
788 | 778 |
|
|
0 commit comments