mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 14:31:36 +00:00

The string concatenation operator `~` is present in jinja and tera: <https://jinja.palletsprojects.com/en/stable/templates/#other-operators>. While it's not the most important operator, it can come in handy e.g. with filters: `{{ a|upper }}{{ b|upper }}` → `{{ (a ~ b)|upper }}`.
71 lines
1.1 KiB
Rust
71 lines
1.1 KiB
Rust
use rinja::Template;
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{ a~b }}"#, ext = "txt")]
|
|
struct NoSpaces {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{ a ~b }}"#, ext = "txt")]
|
|
struct OnlyFront {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{ a~ b }}"#, ext = "txt")]
|
|
struct OnlyBack {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{~a~b~}}"#, ext = "txt")]
|
|
struct NoSpaces2 {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{~a ~b~}}"#, ext = "txt")]
|
|
struct OnlyFront2 {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{~a~ b~}}"#, ext = "txt")]
|
|
struct OnlyBack2 {
|
|
a: u32,
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{ a ~ }}"#, ext = "txt")]
|
|
struct MissingLhs {
|
|
a: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{ ~ b }}"#, ext = "txt")]
|
|
struct MissingRhs {
|
|
b: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{~a ~~}}"#, ext = "txt")]
|
|
struct MissingLhs2 {
|
|
a: u32,
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(source = r#"{{~~ b~}}"#, ext = "txt")]
|
|
struct MissingRhs2 {
|
|
b: u32,
|
|
}
|
|
|
|
fn main() {
|
|
}
|