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

preserve input leading/trailing whitespace from beginning and end in output #11

Open
kevinlawler opened this issue Oct 15, 2024 · 2 comments

Comments

@kevinlawler
Copy link

whitespace is dropped if it is at the beginning or end. this is undesirable if using titlecase say as a method or plugin in a text editor such as vim. please preserve whitespace at beginning and end. I might prefer this to be the default behavior, but perhaps it makes sense to instead add this functionality as a flag like -w or --preserve-whitespace

input f g
expected F G
actual F G

or with visible spaces:
input ␣␣␣␣f␣␣g␣␣␣
expected ␣␣␣␣F␣␣G␣␣␣
actual F␣␣G

@kevinlawler kevinlawler changed the title preserve input whitespace from beginning and end in output preserve input leading/trailing whitespace from beginning and end in output Oct 15, 2024
@ap
Copy link
Owner

ap commented Oct 16, 2024

The default is always going to be whatever way John Gruber’s code behaves. But adding a switch for this seems fine. But I made the 5-line patch to implement that and all test hell failed loose: the capitalization rules expect to be operating on whole titles, and they rely on the title being trimmed to make things simpler. And I don’t want to change that code more than absolutely necessary so as not to make it harder than unavoidable to merge with upstream changes in John Gruber’s code. So this will have to be done by way of trim-then-untrim logic. Right now I have to attend to other things but I’ll get back to it.

@ap ap closed this as completed Oct 16, 2024
@ap ap reopened this Oct 16, 2024
@ap
Copy link
Owner

ap commented Oct 16, 2024

Woops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants