-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Cannot specify single named argument in macro #923
Comments
Ahh, that's a silly oversight. @GuillaumeGomez want to have a look? (Or @kotx, would be great if you can do a PR. See the relevant code in #910.) |
Sending a fix in the next hours. |
I just tested with: #[derive(Template)]
#[template(
source = r#"{% macro button(label) %}
{{- label -}}
{% endmacro %}
{%- call button(label="hi") -%}
"#,
ext = "html"
)]
struct OnlyNamedArgument;
#[test]
fn test_only_named_argument() {
assert_eq!(OnlyNamedArgument.render().unwrap(), "hi");
} And it works fine. Did I miss something? |
@kotx which version of Askama are you using? We merged named arguments recently but I haven't released a version that supports it to crates.io yet, so it's possible the documentation (which gets built from the |
Oh, I didn't realize it hasn't been released yet. My mistake! I hate to ask this but any timeframe for when it gets released? I'm okay with directly pulling the main branch as a dependency for now, so thanks either way. |
Given a simple macro with a single named argument, I cannot call the macro with the named argument explicitly specified.
My guess is that this is because named arguments must be last, and the check is erroneously(?) rejecting this syntax.
It works as expected when
label=
is not specified.I could be missing something.
The text was updated successfully, but these errors were encountered: