Skip to content

Feature request, strip_prefix, and strip_suffix #961

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

Open
EvanCarroll opened this issue Mar 1, 2025 · 1 comment
Open

Feature request, strip_prefix, and strip_suffix #961

EvanCarroll opened this issue Mar 1, 2025 · 1 comment

Comments

@EvanCarroll
Copy link

Already internally tera makes use of path.strip_prefix. I would argue .strip_prefix is pretty useful for a templating language. It would be great to have that allowed.

My use case specifically is git cliff which uses tera. I want to strip out the project from the version in a string of project-version. Currently they're combined and I'm trying to work around orhun/git-cliff#1068

@EvanCarroll EvanCarroll changed the title Feature request, strip_prefix, and strip_suffix Feature request, strip_prefix, and strip_suffix Mar 1, 2025
@EvanCarroll
Copy link
Author

I found the way to do what I want. Since .trim_start_matches only takes a string not a pattern. I could do

 {{ version | split(pat="-") | last }}

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

1 participant