Closed astanin closed 1 year ago
Hmmm. It always occurred to me that all styles from the *_outline
family never supported multi-lines cells. I merely added new styles following the pattern introduced by @vrza in #80. So if the latter was supposed to work, something else broke the rendering. I'll try to get more evidences...
Yep, all *_outline
styles are broken since the beginning, way before I added the new variants:
>>> import tabulate
>>> tabulate.__version__
'0.8.8'
>>> from tabulate import tabulate
>>> print(tabulate([["a\nbb", "a\nbb\nccc\ndddd"]], rowalign="center", tablefmt="fancy_outline"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: tabulate() got an unexpected keyword argument 'rowalign'
>>> print(tabulate([["a\nbb", "a\nbb\nccc\ndddd"]], tablefmt="fancy_outline"))
╒═╤═╕
│ a
bb │ a
bb
ccc
dddd │
╘═╧═╛
Just found a solution:
>>> import tabulate
>>> tabulate.__version__
'0.9.0'
>>> print(tabulate.tabulate([["a\nbb", "a\nbb\nccc\ndddd"]], rowalign="center", tablefmt="heavy_outline"))
┏━┳━┓
┃ a
bb ┃ a
bb
ccc
dddd ┃
┗━┻━┛
>>> tabulate.multiline_formats.update({'heavy_outline':'heavy_outline'})
>>> print(tabulate.tabulate([["a\nbb", "a\nbb\nccc\ndddd"]], rowalign="center", tablefmt="heavy_outline"))
┏━━━━┳━━━━━━┓
┃ a ┃ a ┃
┃ bb ┃ bb ┃
┃ ┃ ccc ┃
┃ ┃ dddd ┃
┗━━━━┻━━━━━━┛
Give me a couple of minutes and I'll produce a PR.
I just proposed a fix in: https://github.com/astanin/python-tabulate/pull/204
Perfect, thanks!
Wrong:
Correct:
heavy_grid
works fine too:@kdeldycke You have implemented these formats. Would you mind to take a look?