Skip to content

Commit

Permalink
Title case filter with apostrophe (#771) (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
magikstm authored Mar 8, 2023
1 parent 3f2eb6f commit 3761996
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/builtins/filters/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const PYTHON_ENCODE_SET: &AsciiSet = &USERINFO_ENCODE_SET

lazy_static! {
static ref STRIPTAGS_RE: Regex = Regex::new(r"(<!--.*?-->|<[^>]*>)").unwrap();
static ref WORDS_RE: Regex = Regex::new(r"\b(?P<first>\w)(?P<rest>\w*)\b").unwrap();
static ref WORDS_RE: Regex = Regex::new(r"\b(?P<first>[\w'])(?P<rest>[\w']*)\b").unwrap();
static ref SPACELESS_RE: Regex = Regex::new(r">\s+<").unwrap();
}

Expand Down Expand Up @@ -662,6 +662,7 @@ mod tests {
("\tfoo\tbar\t", "\tFoo\tBar\t"),
("foo bar ", "Foo Bar "),
("foo bar\t", "Foo Bar\t"),
("foo's bar", "Foo's Bar"),
];
for (input, expected) in tests {
let result = title(&to_value(input).unwrap(), &HashMap::new());
Expand Down

0 comments on commit 3761996

Please sign in to comment.