Dataset Viewer
Auto-converted to Parquet Duplicate
repo
string
pull_number
int64
instance_id
string
issue_numbers
sequence
base_commit
string
patch
string
test_patch
string
problem_statement
string
hints_text
string
created_at
string
version
string
updated_at
string
environment_setup_commit
string
FAIL_TO_PASS
sequence
PASS_TO_PASS
sequence
FAIL_TO_FAIL
sequence
PASS_TO_FAIL
sequence
source_dir
string
rinja-rs/askama
673
rinja-rs__askama-673
[ "671" ]
358f7cd07dc42ba4189d2661461ff0b43a27c304
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -246,7 +246,7 @@ struct Generator<'a, S: std::hash::BuildHasher> { next_ws: Option<&'a str>, // Whitespace suppression from the previous non-literal. Will b...
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs --- a/askama_shared/src/lib.rs +++ b/askama_shared/src/lib.rs @@ -701,5 +705,14 @@ mod tests { ) .unwrap(); assert_eq!(config.whitespace, WhitespaceHandling::Preserve); + + let config = Config::new( + r#" + ...
Trim all but 1 whitespace jinja condition @vallentin suggested [here](https://github.com/djc/askama/pull/664#pullrequestreview-945253861) that we could extend the "trim_all_whitespace" feature to be able to trim all whitespace characters but one. So currently, we have: ```jinja <div> {%- if foo -%} blabla {%-...
I'm on board with all that, including the proposed operator. Ok, then I'll make a PR soon. :) I like that! For readability I'd like it best if a run of whitespaces becomes a single '\n' if it contains an '\n', or a space otherwise. I'm fine with implementing it this way. Anyone else has an opinion maybe? Yeah, I think ...
2022-04-21T14:51:49Z
0.11
2022-04-26T08:31:21Z
7b6f1df433a7f11612608644342b898cd6be8ff5
[ "filters::json::tests::test_json", "filters::tests::test_abs", "filters::tests::test_center", "filters::tests::test_capitalize", "filters::tests::test_filesizeformat", "filters::tests::test_indent", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_join", "f...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
652
rinja-rs__askama-652
[ "651" ]
b14982f97ffd20039286171d56e6fcfab21f56bc
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -330,20 +330,14 @@ where /// Capitalize a value. The first character will be uppercase, all others lowercase. pub fn capitalize<T: fmt::Display>(s: T) -> ...
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -655,6 +649,9 @@ mod tests { assert_eq!(capitalize(&"").unwrap(), "".to_string()); assert_eq!(capitalize(&"FoO").unwrap(), "Foo".to_string()...
Capitalize does not work with non ascii chars Capitalize filter only works with ascii chars not chars like å, ä and ö.
This custom filter does what i expected capitalize to do. ```rust mod filters { pub fn cap(s: &str) -> ::askama::Result<String> { match s.chars().next() { Some(c) => { if c.is_lowercase() { let mut replacement: String = c.to_uppercase().collect(); ...
2022-03-26T15:32:24Z
0.11
2022-03-26T17:50:42Z
7b6f1df433a7f11612608644342b898cd6be8ff5
[ "filters::tests::test_capitalize" ]
[ "filters::tests::test_abs", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::json::tests::test_json", "filters::tests::test_indent", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_join", "filters::tests::test_linebreaks", "f...
[ "filters::yaml::tests::test_yaml" ]
[]
auto_2025-06-03
rinja-rs/askama
359
rinja-rs__askama-359
[ "357" ]
17b9d06814cee84bfd57b73e1941b63187ec5f65
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -249,7 +249,7 @@ pub fn indent(s: &dyn fmt::Display, width: &usize) -> Result<String> { #[cfg(feature = "num-traits")] /// Casts number to f64 -pub fn int...
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -460,22 +460,22 @@ mod tests { #[test] #[allow(clippy::float_cmp)] fn test_into_f64() { - assert_eq!(into_f64(1).unwrap(), 1.0 as f64); ...
into_f64, into_isize unusable `{{ number | into_f64 }}` expands to `into_f64(&number)`, which doesn't compile, because borrowed number doesn't `impl NumCast`.
Thanks for the report. Would you mind submitting a patch that adds the appropriate `*` operators? Maybe it's better to have info_f64 take `&T`? That's fine, too! Whatever works in the context of Askama filters.
2020-09-16T01:05:50Z
0.10
2020-09-16T09:49:22Z
49252d2457f280026c020d0df46733578eb959a5
[ "filters::tests::test_abs", "filters::tests::test_filesizeformat", "filters::tests::test_center", "filters::tests::test_capitalize", "filters::json::tests::test_json", "filters::tests::test_into_f64", "filters::tests::test_indent", "filters::tests::test_into_isize", "filters::tests::test_lower", "...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
304
rinja-rs__askama-304
[ "285", "196" ]
cff49453a851029f87b35512f5234a999fea3e6c
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -909,7 +909,9 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { Expr::StrLit(s) => self.visit_str_lit(buf, s), Expr::CharLit(s) => s...
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1078,6 +1098,34 @@ mod tests { super::parse("{{ strvar|e }}", &Syntax::default()); } + #[test] + fn test_parse_var_call() { + assert_eq!( + ...
Call methods on root context Is there a syntax for calling methods implemented directly on the 'context'? A bare `function()` doesn't appear to do the trick Static method call Can I use static method in the template?
I think you can call `self.function()`? Documentation patches welcome. 😊 Can you give a concrete example? Presumably you have tried it? I tried like so: `{% let a = crate::a() %} ` Did you get an error? What was the error? Did you look at the generated code? The print attribute is "all", but it shows only `message: ...
2020-03-15T11:07:43Z
0.9
2020-03-18T21:33:57Z
cff49453a851029f87b35512f5234a999fea3e6c
[ "filters::tests::test_capitalize", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::json::tests::test_json", "filters::tests::test_indent", "filters::tests::test_linebreaks", "filters::tests::test_linebreaksbr", "filters::tests::test_join", "filters::tests::test_lower"...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
861
rinja-rs__askama-861
[ "860" ]
43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b
diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -248,15 +248,15 @@ impl<'a> Suffix<'a> { } fn r#macro(i: &'a str) -> IResult<&'a str, Self> { - fn nested_parenthesis(i: &str) -> IResult<&str, ()> { + fn neste...
diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs --- a/askama_parser/src/tests.rs +++ b/askama_parser/src/tests.rs @@ -788,3 +788,10 @@ fn test_parse_array() { )], ); } + +#[test] +fn fuzzed_unicode_slice() { + let d = "{eeuuu{b&{!!&{!!11{{ + 0!(!1q҄א!)!!!!!!n!"; + as...
Fuzzing askama_parser results in panic Hi, fuzzing `askama_parser` resulted in panic at following line. https://github.com/djc/askama/blob/43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b/askama_parser/src/expr.rs#L290 I suppose it happens because crash input contains Cyrillic letters which are multi-byte and we need exact b...
2023-09-11T09:42:00Z
0.12
2023-09-11T10:19:21Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "tests::fuzzed_unicode_slice" ]
[ "tests::change_delimiters_parse_filter", "tests::test_missing_space_after_kw", "tests::test_invalid_block - should panic", "tests::test_parse_comments", "tests::test_associativity", "tests::test_parse_const", "tests::test_parse_numbers", "tests::test_odd_calls", "tests::test_parse_root_path", "tes...
[]
[]
auto_2025-06-03
rinja-rs/askama
837
rinja-rs__askama-837
[ "836" ]
9de9af4a006021a63f705e420be4cdef3eb6af82
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1373,7 +1373,7 @@ impl<'a> Generator<'a> { } Expr::Group(ref inner) => self.visit_group(buf, inner)?, Expr::Call(ref obj, ref ...
diff --git a/askama_derive/src/parser/tests.rs b/askama_derive/src/parser/tests.rs --- a/askama_derive/src/parser/tests.rs +++ b/askama_derive/src/parser/tests.rs @@ -221,6 +221,51 @@ fn test_parse_root_path() { ); } +#[test] +fn test_rust_macro() { + let syntax = Syntax::default(); + assert_eq!( + ...
Parse error when using macro with expanded module path I am making a crate that allows people to embed icons from Iconify at compile time, but I ran into a little snag. Tried on main and 0.12. Only happens when using a macro, normal functions work fine. The intended usage is: ```jsx <body> <h1>Hello</h1> ...
Huh, I guess there's some subtlety in the parser relating to the combination of a path, the macro call and the filter. Care to submit a PR? Sure, I'll take a jab at it. Macro invocations are parsed specially, but they should actually be simply suffix expressions, and be handled like normal function calls: https://gi...
2023-07-05T21:49:42Z
0.12
2023-07-24T09:39:14Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "config::tests::find_absolute", "config::tests::find_relative", "config::tests::add_syntax", "config::tests::escape_modes", "config::tests::add_syntax_two", "config::tests::find_relative_sub", "config::tests::get_source", "config::tests::find_relative_nonexistent - should panic", "config::tests::ill...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
965
rinja-rs__askama-965
[ "962", "961" ]
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
diff --git a/askama/Cargo.toml b/askama/Cargo.toml --- a/askama/Cargo.toml +++ b/askama/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "askama" -version = "0.12.1" +version = "0.13.0" description = "Type-safe, compiled Jinja-like templates for Rust" documentation = "https://docs.rs/askama" keywords = ["markup", "temp...
diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -299,9 +299,9 @@ pub(crate) fn get_template_source(tpl_path: &Path) -> std::result::Result<String static CONFIG_FILE_NAME: &str = "askama.toml"; static DEFAULT_SYNTAX_NAME: &st...
Remove the need to import askama itself when using integration crates While wording on https://github.com/djc/askama/issues/961, I wandered off to find the cause for the need as the title goes. A rough scan reveals that askama_derive generates some uses of `::askama::`, for example, this: https://github.com/djc/aska...
Well, I wouldn't want to do this in a way that requires adding another intermediate allocation, but perhaps a newtype with a `Display` implementation could do the job. I'd be open to reviewing such a PR. How about checking for existence of `::askama::`, and if so, splitting the `&str` into head, prefix and tail, then 1...
2024-02-13T14:31:39Z
0.12
2024-03-05T10:34:46Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "config::tests::find_absolute", "config::tests::find_relative", "config::tests::find_relative_sub", "config::tests::add_syntax", "config::tests::add_syntax_two", "config::tests::get_source", "config::tests::find_relative_nonexistent - should panic", "config::tests::test_config_whitespace_error", "co...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
951
rinja-rs__askama-951
[ "924" ]
29b25505b496510217a39606a5f72884867ef492
diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs --- a/askama_parser/src/lib.rs +++ b/askama_parser/src/lib.rs @@ -349,9 +349,9 @@ fn path_or_identifier(i: &str) -> ParseResult<'_, PathOrIdentifier<'_>> { let rest = rest.as_deref().unwrap_or_default(); // The returned identifier can be assum...
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -484,3 +484,23 @@ fn test_num_literals() { "[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]", ); } + +#[allow(non_snake_case)] +#[derive(askama::Template)] +#[te...
0.12.1 only allow lower-case variable name in template I don't know if I asked a stupid question, but I spend one day to find it ! my rust version is 1.74.0, I run it on my win11 and WSL ubuntu 22.04, see the same error below ```rust use askama::Template; #[derive(Template)] #[template(path = "hello.html")] str...
I'm new to axum, I have learn the docs https://djc.github.io/askama/askama.html, but it seems not have the request of lower case I suggest you get the macro expansion via Rust Analyzer or via the [debugging](https://djc.github.io/askama/debugging.html) features. I guess the code generator applies some heuristics that t...
2024-01-18T09:50:05Z
0.12
2024-01-18T10:23:22Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_attr", "test_comment", "test_composition", "test_constants", "test_define_string_var", "test_else", "test_else_if", "test_empty", "test_escape", "test_func_ref_call", "test_generics", "test_if", "test_literals", "test_index", "test_literals_escape", "test_minus", "test_negation...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
943
rinja-rs__askama-943
[ "330" ]
84c2094e871b7ef16ab51c77b4a3568794c75638
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1210,6 +1210,20 @@ impl<'a> Generator<'a> { Ok(DisplayWrap::Wrapped) } + fn _visit_as_ref_filter( + &mut self, + buf: &mut Buffer, +...
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -309,3 +309,17 @@ fn test_json_script() { r#"<script>var user = "\u003c/script\u003e\u003cbutton\u003eHacked!\u003c/button\u003e"</script>"# ); } + +#[derive(askama::Template)...
Add support for reference operator (i.e. `{% let x = &y %}`) Sometimes while working with deeply nested structures, it would be useful to create an alias to a field, like say `{% let h = &parent.child.hash %}` At the moment the `&` unary operator is not supported.
Not supporting this has been a design goal from the start. If I remember correctly, your example should already work without `&`. > If I remember correctly, your example should already work without `&`. Unfortunately it doesn't (`hash` here is an owned `HashMap`, and all other structures are owned by `self`): ~~~~ ...
2024-01-10T14:11:35Z
0.12
2024-01-12T10:10:23Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "filter_escape", "filter_format", "filter_fmt", "filter_opt_escaper_html", "filter_opt_escaper_none", "into_numbers_fmt", "test_filter_let_filter", "test_filter_truncate", "test_join", "test_json", "test_json_attribute", "test_json_attribute2", "test_json_script", "test_my_filter", "test...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
911
rinja-rs__askama-911
[ "904" ]
6cbfde04514a90d4e24350c21ef490c40666d820
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1575,6 +1575,16 @@ impl<'a> Generator<'a> { } buf.write(name); } + Target::OrChain(targets) => match target...
diff --git /dev/null b/testing/templates/match-enum-or.html new file mode 100644 --- /dev/null +++ b/testing/templates/match-enum-or.html @@ -0,0 +1,8 @@ +The card is +{%- match suit %} + {%- when Suit::Clubs or Suit::Spades -%} + {{ " black" }} + {%- when Suit::Diamonds or Suit::Hearts -%} + {{ " red" }} +...
Feature request: enhance match to include multiple targets This has previously been discussed at https://github.com/djc/askama/issues/711#issuecomment-1794340598 but I would like to move it to its own issue as it can be implemented separately. The request is to enhance Askana's syntax for the `match` block (see http...
I'm happy to review a PR for this as proposed.
2023-11-19T18:50:18Z
0.12
2023-11-22T13:56:14Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_match_custom_enum", "test_match_literal_char", "test_match_literal", "test_match_literal_num", "test_match_no_whitespace", "test_match_option", "test_match_option_bool", "test_match_option_result_option", "test_match_ref_deref", "test_match_without_with_keyword", "test_match_with_comment" ...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
910
rinja-rs__askama-910
[ "885" ]
80238d7f48fd86ef939e74df9fdc9678ee78a208
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -727,7 +727,50 @@ impl<'a> Generator<'a> { args.len() ))); } - for (expr, arg) in std::iter::zip(args, &def.args) { + ...
diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs --- a/testing/tests/macro.rs +++ b/testing/tests/macro.rs @@ -95,3 +95,31 @@ fn test_macro_self_arg() { let t = MacroSelfArgTemplate { s: "foo" }; assert_eq!(t.render().unwrap(), "foo"); } + +#[derive(Template)] +#[template( + source = "{%- macr...
Allow to have named arguments in macro It'd pretty nice to be able to have named arguments. For example: ``` {% macro menu_link(href, text, target) %} ... {% endmacro menu_link %} ``` Then to be able to call it like this: ``` {% menu_link(href="/something", text="link", target="_blank") %} ``` It make...
I worry that this would be a little foreign to users -- that is, I'm not sure it passes the design test of "it should be obvious how this gets compiled to Rust code". Does it really matter? If this is a big enough concern, we can add a new entry in the askama book explaining how it is generated. It matters to me -- I t...
2023-11-17T13:50:00Z
0.12
2023-11-28T10:54:25Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_one_func", "test_one_func_binop", "test_one_func_self", "test_one_func_index", "test_coerce", "test_path_ext_html", "test_path_ext_html_and_ext_txt", "test_path_ext_html_jinja", "test_path_ext_html_jinja_and_ext_txt", "test_path_ext_jinja", "test_path_ext_jinja_and_ext_txt", "filter_esca...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
401
rinja-rs__askama-401
[ "333", "221", "107" ]
5057b75e7752f2186157fb3e1f5e5d2d0c5ff880
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -667,8 +667,26 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { ", _loop_item) in ::askama::helpers::TemplateLoop::new({}) {{", ...
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -67,3 +67,39 @@ fn test_for_range() { "foo (first)\nfoo (last)\nbar\nbar\nfoo\nbar\nbar\n" ); } + +#[derive(Template)] +#[template(source = "{% for i in [1, 2, 3] %}{{ i }}{% endfor %...
for-loop on values of a BTreeMap inside a template does not compile Hi Askama team, I'm hitting the an issue with for-loops inside template on `(some BTreeMap).values()`. ## Preliminary: what DOES work Consider first the following piece of code, which works, demonstrating that the `values()` function of `BTreeMa...
Allocating a `Vec` just to appease `djc/askama` seems unfortunate. I wonder whether adding something like the `&`-syntax could improve things: ``` {% for &foo in map.values() %} ``` I encountered the same issue trying to iterate over a `BTreeMap` using `.rev()`: ```jinja {% for (date, day_videos) in videos.video...
2020-12-15T06:21:33Z
0.10
2021-02-18T12:18:18Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_for", "test_for_range", "test_precedence_for", "test_nested_for" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
399
rinja-rs__askama-399
[ "397", "397" ]
5b01e605914a49f0b9e71e7dbe7c17ef1de2c522
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -444,8 +444,8 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { Node::Cond(ref conds, ws) => { self.write_cond(ctx, buf,...
diff --git a/testing/tests/gen_ws_tests.py b/testing/tests/gen_ws_tests.py --- a/testing/tests/gen_ws_tests.py +++ b/testing/tests/gen_ws_tests.py @@ -4,12 +4,23 @@ from itertools import product, chain, zip_longest, tee +# The amount of branches to generate +BRANCHES = 2 # branches + IF, ELSE_IF, ELSE, END_IF = 0...
Unwanted whitespace in match arm For a Template struct containing a field `ver: Option<&'a str>` and the following template: ```jinja2 {% let suffix -%} {% match ver -%} {% when Some with (ver) -%} {% let suffix = format!("-{}", ver) -%} {% when None -%} {% let suffix = String::new() -%} {% endmat...
I'm wondering where the whitespace between the `match` and the first `when` should go. Whether it should go into the first match arm or before the match expression (thus "into" all match arms). The whitespace before `endmatch` is self-explanatory. In short: ```jinja {% match ... %}[this whitespace]{% when ... %}...
2020-12-12T16:51:50Z
0.10
2020-12-13T22:08:20Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_match_custom_enum", "test_match_literal_char", "test_match_literal", "test_match_literal_num", "test_match_option", "test_match_ref_deref", "test_extra_whitespace", "test_match_ws" ]
[ "test_match_no_whitespace", "test_cond_ws" ]
[]
[]
auto_2025-06-03
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
19