diff --git a/tabulate/__init__.py b/tabulate/__init__.py index 9cf6991a..3b1a1e11 100644 --- a/tabulate/__init__.py +++ b/tabulate/__init__.py @@ -136,9 +136,9 @@ def _pipe_line_with_colons(colwidths, colaligns): def _mediawiki_row_with_attrs(separator, cell_values, colwidths, colaligns): alignment = { "left": "", - "right": 'align="right"| ', - "center": 'align="center"| ', - "decimal": 'align="right"| ', + "right": 'style="text-align: right;"| ', + "center": 'style="text-align: center;"| ', + "decimal": 'style="text-align: right;"| ', } # hard-coded padding _around_ align attribute and value together # rather than padding parameter which affects only the value @@ -1952,11 +1952,11 @@ def tabulate( {| class="wikitable" style="text-align: left;" |+ |- - ! strings !! align="right"| numbers + ! strings !! style="text-align: right;"| numbers |- - | spam || align="right"| 41.9999 + | spam || style="text-align: right;"| 41.9999 |- - | eggs || align="right"| 451 + | eggs || style="text-align: right;"| 451 |} "html" produces HTML markup as an html.escape'd str diff --git a/test/test_output.py b/test/test_output.py index 9a9a452e..9043aed3 100644 --- a/test/test_output.py +++ b/test/test_output.py @@ -2322,11 +2322,11 @@ def test_mediawiki(): '{| class="wikitable" style="text-align: left;"', "|+ ", "|-", - '! strings !! align="right"| numbers', + '! strings !! style="text-align: right;"| numbers', "|-", - '| spam || align="right"| 41.9999', + '| spam || style="text-align: right;"| 41.9999', "|-", - '| eggs || align="right"| 451', + '| eggs || style="text-align: right;"| 451', "|}", ] ) @@ -2341,9 +2341,9 @@ def test_mediawiki_headerless(): '{| class="wikitable" style="text-align: left;"', "|+ ", "|-", - '| spam || align="right"| 41.9999', + '| spam || style="text-align: right;"| 41.9999', "|-", - '| eggs || align="right"| 451', + '| eggs || style="text-align: right;"| 451', "|}", ] )