Skip to content
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

[Feature Request] Support Merge.UP similar to Merge.LEFT #104

Open
aurkaxi opened this issue May 16, 2023 · 2 comments
Open

[Feature Request] Support Merge.UP similar to Merge.LEFT #104

aurkaxi opened this issue May 16, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@aurkaxi
Copy link

aurkaxi commented May 16, 2023

 +-----+---+---+---+---+-----+
 | ID  |     Config    | Oth |
 +     +---+---+---+---+     |
 |     | A | B | C | D |     |
 +-----+---+---+---+---+-----+
 | 0x0 | 2 | 0 | 0 | 4 |  3  |
 | 0x1 | 0 | 0 | 0 | 0 |  4  |
 | 0x2 | 0 | 2 | 0 | 1 |  5  |
 +-----+---+---+---+---+-----+

Merge.LEFT allows us to let "Config" have multiple columns.
Merge.UP will allow us to let "ID", "Oth" have multiple rows.

@DenverCoder1 DenverCoder1 changed the title [Feature Rquest] Support MERGE_UP like Merge_left [Feature Request] Support Merge.UP similar to Merge.LEFT May 16, 2023
@DenverCoder1 DenverCoder1 added enhancement New feature or request help wanted Extra attention is needed labels May 16, 2023
@DenverCoder1
Copy link
Owner

Thanks for the suggestion. This feature was planned when Merge was initially created, but it turns out to be very complicated to incorporate into the current code design since the library builds tables one row at a time.

Implementing the feature properly will probably require a lot of rewriting, however, I do have a version that should work for some use cases in the feat/merge-up branch. It is not in a pypi release since there are still some issues, but it can be installed from the commit hash with the following command:

pip install git+https://github.com/DenverCoder1/table2ascii.git@e244e3a1c7e445e91dd24d1612c217370c1fb3a7#egg=table2ascii

(Or in a requirements file -- git+https://github.com/DenverCoder1/table2ascii.git@e244e3a1c7e445e91dd24d1612c217370c1fb3a7#egg=table2ascii)

Your example table should work with this version, but note that some issues are not yet resolved including:

  • It is not possible to combine usage of Merge.LEFT and Merge.UP to make an area spanning multiple rows and columns.
  • Text does not wrap between the two vertically merged cells. If there is text in the top cell that is merged, it will remain in the top area and not expand into the lower cell.

I don't plan to resolve these issues in the near future, but I am willing to let someone else who finds this issue and can fix the remaining issues take over the branch or start a new branch to add this feature.

Feel free to let me know if you have any questions.

@aurkaxi
Copy link
Author

aurkaxi commented May 19, 2023

  1. yes merge.left and up doesn't seem possible neither practical
  2. for vertical i think text being on top is good to go.

i will test that commit. currently work around with dashtable their rst export kinda looks like ascii, but that is rst so no ascii presets. i think you might check data2rst function later.
also going through some exams, so i will test that commit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants