Repository: askama-rs/askama (Rust)

Issue:
Using include statement in call block causes Template proc-macro to panic
**Describe the bug**
Using an `{% include "test.jinja" %}` statement from inside a `{% call macro_name() %}` block makes the `Template` proc-macro panic.

**To Reproduce**
File `other.jinja`:
```jinja
nothing special
```

Root template `page.jinja`:
```jinja
{% macro test_macro() %}
    test
    {{caller()}}
{% endmacro %}

{% call test_macro() %}
    {% include "other.jinja" %}
{% endcall %}
```

File `main.rs`:
```rust
#[derive(Template)]
#[template(path = "page.jinja")]
struct IndexPage {}
```

**Askama version**
7610b374db01efefc1b801083b91a38dfaab303a

**Rust version**
`rustc 1.90.0-nightly (b03b3a7ec 2025-06-26)`


Discussion:
looks like the test don't cover this scenario I'll have to have a look at this.



Patch:
diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs
index bfc0949be..f3d886154 100644
--- a/askama_derive/src/input.rs
+++ b/askama_derive/src/input.rs
@@ -299,10 +299,12 @@ impl TemplateInput<'_> {
                                 nested.push(&arm.nodes);
                             }
                         }
+                        Node::Call(c) => {
+                            nested.push(&c.nodes);
+                        }
                         Node::Lit(_)
                         | Node::Comment(_)
                         | Node::Expr(_, _)
-                        | Node::Call(_)
                         | Node::Extends(_)
                         | Node::Let(_)
                         | Node::Import(_)


Test patch:
diff --git a/testing/tests/calls.rs b/testing/tests/calls.rs
index 560045205..f1ff206a5 100644
--- a/testing/tests/calls.rs
+++ b/testing/tests/calls.rs
@@ -174,6 +174,47 @@ b: {{value.b}}
     assert_eq!(x.render().unwrap(), "a: one\nb: two");
 }
 
+#[test]
+fn test_include_in_call_block() {
+    #[derive(Template)]
+    #[template(
+        source = r#"
+{%- macro test_macro() -%}
+    {{caller()}}
+{%- endmacro -%}
+{%- call test_macro() %}
+    {%- include "foo.html" -%}
+{%- endcall -%}
+        "#,
+        ext = "txt"
+    )]
+    struct IncludeInCallBlock;
+    let x = IncludeInCallBlock {};
+    assert_eq!(x.render().unwrap(), "foo.html");
+}
+
+#[test]
+fn test_include_in_call_block_in_macro() {
+    #[derive(Template)]
+    #[template(
+        source = r#"
+{%- macro macro1() -%}
+    {{caller()}}
+{%- endmacro -%}
+{%- macro macro2() -%}
+    {%- call macro1() -%}
+        {%- include "foo.html" -%}
+    {%- endcall -%}
+{%- endmacro -%}
+{%- call macro2() %}{%- endcall -%}
+        "#,
+        ext = "txt"
+    )]
+    struct IncludeInCallBlock;
+    let x = IncludeInCallBlock {};
+    assert_eq!(x.render().unwrap(), "foo.html");
+}
+
 #[test]
 fn test_caller_args() {
     #[derive(Template)]
diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs
index 82284aa6e..b0b304fe9 100644
--- a/testing/tests/macro.rs
+++ b/testing/tests/macro.rs
@@ -74,6 +74,23 @@ fn test_nested_macro_with_args() {
     assert_eq!(t.render().unwrap(), "first second");
 }
 
+#[test]
+fn test_include_in_macro_block() {
+    #[derive(Template)]
+    #[template(
+        source = r#"
+{%- macro test_macro() -%}
+    {%- include "foo.html" -%}
+{%- endmacro -%}
+{%- call test_macro() %}{%- endcall -%}
+        "#,
+        ext = "txt"
+    )]
+    struct IncludeInMacroBlock;
+    let x = IncludeInMacroBlock {};
+    assert_eq!(x.render().unwrap(), "foo.html");
+}
+
 #[test]
 fn str_cmp() {
     #[derive(Template)]