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

Add as_ref builtin #943

Merged
merged 3 commits into from
Jan 12, 2024
Merged

Add as_ref builtin #943

merged 3 commits into from
Jan 12, 2024

Conversation

GuillaumeGomez
Copy link
Collaborator

Fixes #330.

Following discussions with @djc, to keep askama template syntax as simple as possible and to go around the limitations described in #330, a good way to fix it is to add a as_ref builtin filter.

@djc
Copy link
Collaborator

djc commented Jan 10, 2024

Seems kinda reasonable to me. @Kijewski @vallentin any thoughts?

@Kijewski
Copy link
Collaborator

The PR is well implemented, and (except for the small clippy warning), LGTM.

But another alternative would be to add prefix operators & and * to the language. This could also be a fix for e.g. #894. Both options would work for me, this PR or adding &+*, and I have no strong preferences.

@djc
Copy link
Collaborator

djc commented Jan 10, 2024

But another alternative would be to add prefix operators & and * to the language. This could also be a fix for e.g. #894. Both options would work for me, this PR or adding &+*, and I have no strong preferences.

I'm not a fan of that particular alternative (https://github.com/djc/askama/pull/937#issuecomment-1874648650 motivated this PR). I don't have much of an objection to this approach, although I don't love it.

@GuillaumeGomez GuillaumeGomez changed the title As ref builtin Add as_ref builtin Jan 10, 2024
@GuillaumeGomez
Copy link
Collaborator Author

Fixed the clippy lint. :)

book/src/filters.md Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Collaborator Author

Updated sentence.

@djc
Copy link
Collaborator

djc commented Jan 12, 2024

There's still/again a clippy failure? (I approved this already, so feel free to go ahead and merge once it passes CI.)

@djc djc merged commit b52274d into rinja-rs:main Jan 12, 2024
20 checks passed
@GuillaumeGomez GuillaumeGomez deleted the as-ref-builtin branch January 12, 2024 10:10
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

Successfully merging this pull request may close these issues.

Add support for reference operator (i.e. {% let x = &y %})
3 participants