-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add support for hyphenation to wrapped text #668
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution, thanks!
You will have to add the dependency to pyproject.toml
for the CI to have a chance to succeed.
Also, it would be nice to add the corresponding parameters to the text
command in vpype_cli
, and update all the docstrings.
Alright, I think that should be most of the relevant changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a small comment on the docs to point at the right format to specify the language.
vpype_cli/text.py
Outdated
@@ -53,7 +60,8 @@ def text( | |||
|
|||
In wrap mode, the text start at (0, 0) and expends left until it reach the specified width. | |||
The `--align` option controls how the text is laid out within the column and behaves as | |||
typically expected. | |||
typically expected. The `--hyphenate` options enables hyphenation using the provided | |||
language code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
vpype/text.py
Outdated
@@ -210,6 +227,7 @@ def text_block( | |||
left alignment) | |||
line_spacing: line spacing (default: 1.0) | |||
justify: should the text be justified (default: False) | |||
hyphenate: wrapped text is hyphenated with the given language (default: None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to indicate what format(s) are acceptable for the language, and provide a couple of examples.
Something like this? Also caught a leftover print statement |
That works yes. Ready to merge as soon as CI is happy! |
darn that little doc addition made ruff unhappy |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 94.78% 94.67% -0.12%
==========================================
Files 62 62
Lines 5735 5746 +11
Branches 1308 1311 +3
==========================================
+ Hits 5436 5440 +4
- Misses 182 188 +6
- Partials 117 118 +1
☔ View full report in Codecov by Sentry. |
Description
This PR adds hyphenation to the word wrapping functionality. Example:
This needs a
poetry add pyphen
or similar but these things tend to create conflicts so I'd save that until all the tests and docs and API and bikeshedding is done.Checklist
black
andruff check .
)mypy
returns no errorpytest
succeedshelp
reference.rst
make clean && make html
indocs/
)