Skip to content

feat: support for multiline cells #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 11, 2022
Merged

feat: support for multiline cells #30

merged 6 commits into from
Feb 11, 2022

Conversation

DenverCoder1
Copy link
Owner

Fixes #28

Example

from table2ascii import table2ascii as t2a, PresetStyle, Alignment

table = t2a(
    header=["Multiline\nHeader\nCell", "G", "Two\nLines", "R", "S"],
    body=[[1, "Alpha\nBeta\nGamma", 3, 4, "One\nTwo"]],
    footer=["A", "Footer\nBreak", 1, "Second\nCell\nBroken", 3],
    alignments=[Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER, Alignment.LEFT, Alignment.CENTER],
    style=PresetStyle.ascii_box
)

print(table)
+-----------+--------+-------+--------+-----+
| Multiline |      G |  Two  | R      |  S  |
| Header    |        | Lines |        |     |
| Cell      |        |       |        |     |
+-----------+--------+-------+--------+-----+
| 1         |  Alpha |   3   | 4      | One |
|           |   Beta |       |        | Two |
|           |  Gamma |       |        |     |
+-----------+--------+-------+--------+-----+
| A         | Footer |   1   | Second |  3  |
|           |  Break |       | Cell   |     |
|           |        |       | Broken |     |
+-----------+--------+-------+--------+-----+

@DenverCoder1 DenverCoder1 added the enhancement New feature or request label Feb 11, 2022
@DenverCoder1 DenverCoder1 merged commit d0dcddc into main Feb 11, 2022
@DenverCoder1 DenverCoder1 deleted the multiline-cells branch February 11, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for newlines within cells
1 participant