Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions askama_derive/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Config {
let config_path = key.0.config_path.as_deref();
let root = key.0.root.as_ref();

let default_dirs = vec![root.join("templates")];
let default_dirs = vec![root.join("templates"), root.to_path_buf()];

let mut syntaxes = HashMap::default();
syntaxes.insert(DEFAULT_SYNTAX_NAME.to_string(), SyntaxAndCache::default());
Expand Down Expand Up @@ -397,10 +397,12 @@ mod tests {

#[test]
fn test_default_config() {
let mut root = manifest_root();
root.push("templates");
let root = manifest_root();
let config = Config::new("", None, None, None, None).unwrap();
assert_eq!(config.dirs, vec![root]);
assert_eq!(
config.dirs,
vec![root.join("templates", root.to_path_buf())]
);
}

#[cfg(feature = "config")]
Expand Down
11 changes: 5 additions & 6 deletions askama_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ macro_rules! make_derive_template {
/// E.g. `path = "foo.html"`
///
/// Sets the path to the template file.
/// The path is interpreted as relative to the configured template directories
/// (by default, this is a `templates` directory next to your `Cargo.toml`).
/// The file name extension is used to infer an escape mode (see below). In
/// web framework integrations, the path's extension may also be used to
/// infer the content type of the resulting response.
/// Cannot be used together with `source`.
/// The path is interpreted as relative to the configured template directories (by default,
/// this is a `templates` directory next to your `Cargo.toml` or the directory where
/// `Cargo.toml` is). The file name extension is used to infer an escape mode (see below).
/// In web framework integrations, the path's extension may also be used to infer the
/// content type of the resulting response. Cannot be used together with `source`.
///
/// ### source
///
Expand Down
Loading