diff --git a/table2ascii/preset_style.py b/table2ascii/preset_style.py index 5732219..4ef96b0 100644 --- a/table2ascii/preset_style.py +++ b/table2ascii/preset_style.py @@ -46,4 +46,4 @@ class PresetStyle: ascii_rounded = TableStyle.from_string(r"/===\|| |=|=||-|-|\|=/") ascii_rounded_box = TableStyle.from_string(r"/===\||||=||||-|||\||/") markdown = TableStyle.from_string(" ||||-||| ") - plain = TableStyle.from_string(" ") + plain = TableStyle.from_string(" ").set(left_and_right_edge="") diff --git a/table2ascii/table_style.py b/table2ascii/table_style.py index 2239616..323c7d2 100644 --- a/table2ascii/table_style.py +++ b/table2ascii/table_style.py @@ -75,3 +75,21 @@ def from_string(cls, string: str) -> "TableStyle": TableStyle.from_string("╔═╦═╗║║ ╟─╫─╢ ╚╩═╝") """ return cls(*string) + + def set(self, **kwargs) -> "TableStyle": + """ + Set attributes of the TableStyle + + Args: + kwargs: The attributes to set + + Returns: + A TableStyle object with the attributes set + + Example:: + + TableStyle().set(top_left_corner="╔", top_and_bottom_edge="═") + """ + for key, value in kwargs.items(): + setattr(self, key, value) + return self diff --git a/tests/test_styles.py b/tests/test_styles.py index 3becd44..422f0c1 100644 --- a/tests/test_styles.py +++ b/tests/test_styles.py @@ -661,9 +661,9 @@ def test_plain(): style=PresetStyle.plain, ) expected = ( - " # G H R S \n" - " 1 30 40 35 30 \n" - " 2 30 40 35 30 \n" - " SUM 130 140 135 130 " + " # G H R S \n" + " 1 30 40 35 30 \n" + " 2 30 40 35 30 \n" + " SUM 130 140 135 130 " ) assert text == expected