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

tpl/strings: Add TrimSpace function #12962

Closed
jmooring opened this issue Oct 18, 2024 · 0 comments · Fixed by #12969
Closed

tpl/strings: Add TrimSpace function #12962

jmooring opened this issue Oct 18, 2024 · 0 comments · Fixed by #12969
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Oct 18, 2024

Use https://pkg.go.dev/strings#TrimSpace so we can do this:

{{ $v | strings.TrimSpace }}

Instead of this:

{{ strings.Trim $v "\n\r " }}

In addition to having a standard definition of white space, we can pipe values into strings.TrimSpace. We can't pipe values into strings.Trim.

@bep bep added this to the v0.137.0 milestone Oct 18, 2024
@jmooring jmooring self-assigned this Oct 18, 2024
jmooring added a commit to jmooring/hugo that referenced this issue Oct 19, 2024
bep pushed a commit that referenced this issue Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants