Skip to content

Commit

Permalink
Fixed constants (fixes #291)
Browse files Browse the repository at this point in the history
  • Loading branch information
vallentin authored and djc committed Jan 13, 2021
1 parent 560d219 commit 912bbeb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions askama_shared/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,11 @@ impl MapChain<'_, &str, LocalMeta> {
}

fn resolve_or_self(&self, name: &str) -> String {
self.resolve(name)
.unwrap_or_else(|| format!("self.{}", name))
match self.resolve(name) {
Some(name) => name,
None if name.chars().any(char::is_uppercase) => name.to_string(),
None => format!("self.{}", name),
}
}
}

Expand Down

0 comments on commit 912bbeb

Please sign in to comment.