Improve error message when an extension escaper is missing

This commit is contained in:
Guillaume Gomez 2024-11-15 15:02:10 +01:00
parent 41425e15aa
commit b0d834c0fd
2 changed files with 4 additions and 3 deletions

View File

@ -99,7 +99,8 @@ impl TemplateInput<'_> {
.ok_or_else(|| {
CompileError::no_file_info(
format!(
"no escaper defined for extension '{escaping}'. {}",
"no escaper defined for extension '{escaping}'. You can define an escaper \
in the config file (named `rinja.toml` by default). {}",
MsgValidEscapers(&config.escapers),
),
*ext_span,

View File

@ -6,13 +6,13 @@ error: invalid escaper 'latex' for `escape` filter. The available extensions are
6 | source = r#"In LaTeX you write `{{text}}` like `{{text|escape("latex")}}`."#,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: no escaper defined for extension 'tex'. The available extensions are: "", "htm", "html", "j2", "jinja", "jinja2", "md", "none", "rinja", "svg", "txt", "xml", "yml"
error: no escaper defined for extension 'tex'. You can define an escaper in the config file (named `rinja.toml` by default). The available extensions are: "", "htm", "html", "j2", "jinja", "jinja2", "md", "none", "rinja", "svg", "txt", "xml", "yml"
--> tests/ui/no-such-escaper.rs:14:11
|
14 | ext = "tex",
| ^^^^^
error: no escaper defined for extension 'tex'. The available extensions are: "", "htm", "html", "j2", "jinja", "jinja2", "md", "none", "rinja", "svg", "txt", "xml", "yml"
error: no escaper defined for extension 'tex'. You can define an escaper in the config file (named `rinja.toml` by default). The available extensions are: "", "htm", "html", "j2", "jinja", "jinja2", "md", "none", "rinja", "svg", "txt", "xml", "yml"
--> tests/ui/no-such-escaper.rs:22:19
|
22 | #[template(path = "latex-file.tex")]