-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More useful error message and UI tests for missing escaper
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use rinja::Template; | ||
|
||
#[derive(Template)] | ||
#[template( | ||
ext = "html", | ||
source = r#"In LaTeX you write `{{text}}` like `{{text|escape("latex")}}`."#, | ||
)] | ||
struct LocalEscaper<'a> { | ||
text: &'a str, | ||
} | ||
|
||
#[derive(Template)] | ||
#[template( | ||
ext = "tex", | ||
source = r#"In HTML you write `{{text}}` like `{{text|escape("html")}}`."#, | ||
)] | ||
struct GlobalEscaper<'a> { | ||
text: &'a str, | ||
} | ||
|
||
fn main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error: invalid escaper 'latex' for `escape` filter | ||
--> LocalEscaper.html:1:38 | ||
"text|escape(\"latex\")}}`." | ||
--> tests/ui/no-such-escaper.rs:3:10 | ||
| | ||
3 | #[derive(Template)] | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: no escaper defined for extension 'tex' | ||
--> tests/ui/no-such-escaper.rs:12:10 | ||
| | ||
12 | #[derive(Template)] | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) |