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

Allow to have access to imports in block calls #991

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

GuillaumeGomez
Copy link
Contributor

Fixes #989.

@@ -60,7 +60,7 @@ impl<'a> Generator<'a> {
}

// Takes a Context and generates the relevant implementations.
pub(crate) fn build(mut self, ctx: &'a Context<'_>) -> Result<String, CompileError> {
pub(crate) fn build(mut self, ctx: &Context<'a>) -> Result<String, CompileError> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I relaxed the lifetime rules as they were too strict for my use case. Like this we can pass a temporary Context as long as it points to the same data.

@GuillaumeGomez GuillaumeGomez force-pushed the block-import-access branch 2 times, most recently from 77d3805 to ef2dd67 Compare March 12, 2024 21:05
@GuillaumeGomez
Copy link
Contributor Author

Solved clippy lints as well.

Hopefully with this one, I'll have everything I need to end the switch from tera to askama on docs.rs. :)

@GuillaumeGomez
Copy link
Contributor Author

As discussed in #989, variables defined outside a block should not be accessible inside a block.

@GuillaumeGomez
Copy link
Contributor Author

Ah I need #986 to be merged first for this ui test to work. ^^'

@GuillaumeGomez
Copy link
Contributor Author

Rebased. It's now ready for review!

askama_derive/src/generator.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Contributor Author

Since you approved, merging. Thanks for the reviews!

@GuillaumeGomez GuillaumeGomez merged commit bd0bfaa into djc:main Apr 25, 2024
16 checks passed
@GuillaumeGomez GuillaumeGomez deleted the block-import-access branch April 25, 2024 09:09
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.

Scope changes inside block, preventing to call macros which should be in scope
2 participants