mirror of
https://github.com/askama-rs/askama.git
synced 2025-12-30 13:21:32 +00:00
66 lines
1.6 KiB
Rust
66 lines
1.6 KiB
Rust
use askama::Template;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{%- macro thrice(param) -%}
|
|
{{ param }}
|
|
{%- endmacro -%}
|
|
|
|
{%- call thrice(2, 3) -%}{%- endcall -%}", ext = "html")]
|
|
struct InvalidNumberOfArgs;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{%- macro thrice(param, param2) -%}
|
|
{{ param }} {{ param2 }}
|
|
{%- endmacro -%}
|
|
|
|
{%- call thrice() -%}{%- endcall -%}", ext = "html")]
|
|
struct InvalidNumberOfArgs2;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{%- macro thrice() -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- call thrice(1, 2) -%}{%- endcall -%}", ext = "html")]
|
|
struct InvalidNumberOfArgs3;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{% macro thrice( %}{% endmacro %}", ext = "html")]
|
|
struct NoClosingParen1;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{% macro thrice(a, b, c %}{% endmacro %}", ext = "html")]
|
|
struct NoClosingParen2;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{% macro thrice(a, b, c= %}{% endmacro %}", ext = "html")]
|
|
struct NoClosingParen3;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = "{% macro thrice(a, b, c = %}{% endmacro %}", ext = "html")]
|
|
struct NoClosingParen4;
|
|
|
|
#[derive(askama::Template)]
|
|
#[template(
|
|
source = r#"
|
|
{% macro example(name, value, current, label="", id="") %}
|
|
{% endmacro %}
|
|
{% call example(name="name", value="") %}{% endcall %}
|
|
"#,
|
|
ext = "txt"
|
|
)]
|
|
struct WrongNumberOfParams;
|
|
|
|
#[derive(askama::Template)]
|
|
#[template(
|
|
source = r#"
|
|
{% macro example(name, value, arg=12) %}
|
|
{% endmacro %}
|
|
{% call example(0, name="name", value="") %}{% endcall %}
|
|
"#,
|
|
ext = "txt"
|
|
)]
|
|
struct DuplicatedArg;
|
|
|
|
fn main() {
|
|
}
|