-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Fixed extension to ignore common jinja extensions #458
Conversation
I'd like to split the first commit into a change that separates out the abstraction logic and a separate commit that adds the Jinja extension consideration. It'd be nice to have some tests for the new version of that function, too; maybe that would be easier if it was a free function rather than a method? |
Just to be clear, so first commit is just Good idea with the tests. I can add a private function |
I would incorporate the to_str() part in the extracted function immediately, which seems to match the intended contract anyway. Private function to enable testing makes sense. |
Unsure if I'm misinterpreting or miscommunicated. But what I meant was, the first commit would just be: pub fn extension(&self) -> Option<&str> {
self.path.extension().map(|s| s.to_str().unwrap())
} Then the second commit adds the |
Yup! |
@djc fixed it Also added some extension tests for Edit: Weird, GitHub is showing the commits in the wrong order |
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, thanks!
Fixes #457
extension()
forfoo.html.{jinja,jinja2,j2}
resolves tohtml
instead of{jinja,jinja2,j2}
.path
andext
, i.e. so it would allow#[template(path = "template.foo.bar.baz", ext = "html")]
This was just a quick fix, so I hope I didn't overlook anything