New feature: Software columns - #645
Merged
Merged
Conversation
This reverts commit 546391c.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #645 +/- ##
==========================================
- Coverage 80.59% 78.72% -1.87%
==========================================
Files 21 21
Lines 1618 1669 +51
Branches 286 303 +17
==========================================
+ Hits 1304 1314 +10
- Misses 233 274 +41
Partials 81 81
Flags with carried forward coverage won't be shown. Click here to find out more.
|
belono
marked this pull request as ready for review
June 3, 2024 18:24
patkan
approved these changes
Jul 11, 2024
patkan
left a comment
Member
There was a problem hiding this comment.
Thank you! Looks good to me and the CI hasn't found issues.
This was referenced Jul 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This implements
software_columns()as a new feature to help in the tricky task of printing texts in columns or aligning multiple texts in different alignments within the same line.The method receives a list of strings and formats them as horizontal columns by adding spaces between each element. If some text is too long it is wrapped to the column width by adding new lines and even truncating words that are too long by adding a placeholder.
It is also possible to set the width and the text alignment of each column independently. The method is flexible enough to repeat the last width and/or alignment till the last element if there are more text elements than column widths or alignments.
widths=[20, 10]to the method so it will be expanded to '[20, 10, 10, 10]`.widths=40so it will be expanded to[10, 10, 10, 10].This is also true for the alignment parameter:
align=['left', 'center', 'right']would expand to['left', 'center', 'right', 'right']. Alternatively a single valuealign='center'would expand to['center', 'center', 'center', 'center'].At the moment, the user is responsible for not exceeding the width of the paper when passing the list of
widthsparameter, but this behavior could be modified by adding a check, an exception or whatever.As always all suggestions, corrections, etc. are very welcome.
Closes #27
Closes #635
Tested with